john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

google app engine inherit from requesthandler init super

Apparently super is slightly more future proof than using the specific base class name (i.e. RequestHandler) as it allows mixins, etc.

class MyHandler( webapp2.RequestHandler ):

    def __init__( self, request, response ):
        self.myService = MyService()
        super( MyHandler, self ).__init__( request, response )        # inherits from RequestHandler

Alternatively , this seems to work though my IDE complains https://github.com/pizzapanther/Python-Google-Drive-Presentation/blob/master/google_appengine/lib/webapp2/docs/guide/handlers.rst

class MyHandler( webapp2.RequestHandler ):

    def __init__( self, request, response ):
        self.initialize( request, response )
    # custom stuff
        self.myService = MyService()

  • « Java plugin chromium browser 64 bit ubuntu
  • google app engine blob store upload and download delete »

Published

Jul 15, 2013

Category

python-appengine

~65 words

Tags

  • appengine 18
  • engine 12
  • from 24
  • google 18
  • inherit 2
  • init 4
  • python 180
  • requesthandler 1
  • super 3