under pylons I had a lot of code that did misc prep work for certain
methods in the request.
because every view was an instance, it was pretty safe to just store
stuff in the instance of the 'handler' class, and i didn't need to
store it into the request object.
i'm not sure how pyramid is set up. it seems that every view creates
a new instance of the handler class as well -- but i wanted to be
sure.
the paradigms i used sort of look like the following, where i have a
'setup' helper and a multi-method form submission process:
---
def _shared_setup_a():
"used by one or more methods , but not all"
self.db = newdb()
self.gaq= new_google_analaytics()
def login(self):
self._shared_setup_a()
self._login_form= Form()
if submit:
return self._login_submit()
return self._login_print()
def _login_print(self):
render( template, self._login_form )
def _login_validate(self):
if not validate(self._login_form, self.request):
return self._login_print()
redirect( success page )
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.