i have a controller file with multiple methods. in each method i am
calling another method ("start") that sets up some basic variables for use
by various template files for that controller/method. Currently i am
calling self.start() in each method, but I know there must be a better way
to do it, but can't figure it out. I was thinking Init, but not sure.
class SiteController(BaseController):
def method1(self):
self.start()
# get all table1 info about selected site
dataAccess.cursor.execute("select * FROM table1")
self.siteTab1 = dataAccess.cursor.fetchall()
def method2(self):
self.start()
# get all table2 info about selected site
dataAccess.cursor.execute("select * FROM table2")
self.siteTab2 = dataAccess.cursor.fetchall()
def start(self):
# setup for variables used by all methods
dataAccess.cursor.execute("select * FROM Menu")
self.siteMainMenu = dataAccess.cursor.fetchall()
Thanks for any tips
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine/-/esI1VywnVysJ.
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/google-appengine?hl=en.