Previously Aaron R wrote:
> I did something similar using the __before__ method
>
> class CustomerController(BaseController):
> def __before__(self):
> if 'cust_id' in request.environ['pylons.routes_dict']:
> cust_id = request.environ['pylons.routes_dict']
> ['cust_id']
> c.customer=meta.Session.query(Customer).get(cust_id)
> else:
> c.customer = None
>
> def DoSomething(self, cust_id, id):
> .....
>
> def DoMore(self, cust_id, id):
> .....
>
>
> The routes_dict looks like this:
>
> {'action': u'dostuff', 'controller': u'customert', 'id': u'123'}
>
> Hopefully that works.
It works and is indeed better. I still think my approach is nicer: it
does not require poking manually at the routes memory but provides a
clean interface.
Wichert.
--
Wichert Akkerman <[EMAIL PROTECTED]> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---