Skip to content

Conversation

@mark0978
Copy link

I ran into some difficulty with webapp2 because of the way RequestHandler.init worked. Basically there was no way to have a derived class from RequestHandler due to the call of self.dispatch at the bottom of init.

If you called super at the beginning of your derived class init then you never executed your code. If you called it at the end, then self.request and self.response were not set when you tried to do your specific code.

I fixed all this and seeing how initialize was not callable, took a swat at fixing it too. Now, if you substitue webapp2 for webapp and the derived RequestHandler based object has an self.initialize method, it will be called (just like in webapp?).

Let me know if you see any problems with this. If you don't please feel free to include it in your code. I will license it under the same license you choose for the project.

Thanks for the good work BTW.

@moraes
Copy link
Owner

moraes commented May 15, 2011

I made some changes to help overriding init():

https://github.com/moraes/webapp-improved/blob/master/webapp2/__init__.py#L126

Also please take a look at the explanation here:

https://github.com/moraes/webapp-improved/blob/master/docs/requesthandler.rst

Do you think it is ok this way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants