Closed mitra42 closed 4 years ago
I will be fixing the code to use the deferred class of twisted (which is a the right way of doing it) to asynchronously return the data and errors. https://twistedmatrix.com/documents/current/web/howto/web-in-60/asynchronous-deferred.html
Looks lke this is done ...
Its unclear how to do do this a: change line server.py Simple.render line 98 to pass the request to every function b: somehow know in the return from each function that its an error, c: have the function throw an exception and wrap line 98 to catch that. (In Javascript I throw an Error Class with a status and message field, but I’m not sure what the pythonic/twisted way to do this is
For now, I'm assuming that a string return is an error - detecting that in Simple.render line 98 and then doing the request.setResponseCode(302) thing that Dan suggested.
This seems the WRONG way to do it, so I've flagged everywhere I've done this with TODO-71 and can quickly change it to any of a,b or c once I get clarity (from Dan).