if you raise HTTP yes.
On Aug 5, 7:37 am, Niphlod <niph...@gmail.com> wrote: > wonderful, this works, also if the workaround smells fishy ^_^ > > regarding response.status and response.header .... are they ignored at > all ? > > On 5 Ago, 13:40, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > You can do > > > a= {'foo-':'bar','bar':'foo'} > > HTTP(404,**a) > > > On Aug 5, 5:45 am, Niphlod <niph...@gmail.com> wrote: > > > > ok, I digged more, and sadly I think that for problem 1) HTTP should > > > be rewritten, or at least a new class should be extended to let more > > > flexibility. > > > > Don't know if I'm boring some ultra-technical pythonist, but I'll try > > > to explain what I managed to understand. > > > > this is how HTTP is defined in http.py : > > > > class HTTP(BaseException): > > > > def __init__( self, status, body='', **headers ): > > > bla bla bla > > > > basically, every extra argument passed get transformed to a dict and > > > passed along with the function. > > > > eg. HTTP(401,['hello'],foo='bar', bar='foo') ---> HTTP(401, > > > ['hello'],dict(foo='bar',bar='foo')) --> __init__ done > > > > Now, the hard part: dict() only allow "keyword" syntax for the keys, > > > and that will be in our case the various headers "name", while their > > > values should be header content. Unfortunately, keywords accept > > > letters, digit and underscore.... no dash. > > > > In fact: > > > ************** > > > python> a= dict(foo='bar',bar='foo') > > > > a= dict(foo_1='bar',bar='foo') > > > > a= dict(foo-1='bar',bar='foo') > > > > SyntaxError: keyword can't be an expression > > > ************** > > > > So, we can't actually pass any header to HTTP() without interfering > > > with dict() call that gets called on **headers if our keyword contains > > > '-' . That eliminates a LOT of standard headers and make HTTP quite > > > unuseful... I can't get the reason behind this wasn't a problem for > > > peoples writing APIs or services.... > > > > Another question popped: can we use response.status and > > > response.headers ? It seems that if my controller function return > > > anything (string, list or dict) the status is always 200 and no added > > > headers show up in firebug....