2011/6/13 Branko Vukelic <[email protected]>: > On Mon, Jun 13, 2011 at 3:45 AM, Anand Chitipothu <[email protected]> > wrote: >> 2011/6/13 Branko Vukelic <[email protected]>: >>> Let me just add one more. Make a superclass that handles the auth part >>> in __init__ and subclass your controller classes. >> >> Thats a bad idea. I don't think you should rely on the fact that >> web.py creates a new object of the class before handling the request. >> Also it might not be possible to raise http errors from __init__. > > For real? It used to work reliably for me in the past... Are there > cases when web.py doesn't create a new object?
It does create and only creates an instance of the class that it is going to call GET/POST method. But that is an implementation detail and not an API. The implementation may change to create instances of all classes. Also whether the instance is created before or after the application processors are created is not well defined. I strongly discourage adding application code in __init__. Anand -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
