Running the same code for get(self) as post(self)

Posted by Peter Farmer on Stack Overflow See other posts from Stack Overflow or by Peter Farmer
Published on 2010-05-21T14:26:00Z Indexed on 2010/05/21 14:30 UTC
Read the original article Hit count: 172

Filed under:
|

Its been mentioned in other answers about getting the same code running for both the def get(self) and the def post(self) for any given request. I was wondering what techniques people use, I was thinking of:

class ListSubs(webapp.RequestHandler):
    def get(self):
        self._run()

    def post(self):
        self._run()

    def _run(self):
        self.response.out.write("This works nicely!")

© Stack Overflow or respective owner

Related posts about google-app-engine

Related posts about python