Re: Best way for passing variable between callables

2011-12-08 Thread Dan Sommers
On Wed, 07 Dec 2011 16:56:20 -0800, H.T. Wei wrote: Hi, I am a newbie to Pyramid and have a question about passing variable between callable like this one: def callable_a(request): id = 1 ... return dict( ... ) def callable_b(request): # get id from

Re: Best way for passing variable between callables

2011-12-08 Thread H.T. Wei
Thank you all for the suggestion! On Thu, Dec 8, 2011 at 2:55 AM, Dan Sommers d...@tombstonezero.net wrote: On Wed, 07 Dec 2011 16:56:20 -0800, H.T. Wei wrote: Hi, I am a newbie to Pyramid and have a question about passing variable between callable like this one: def

Best way for passing variable between callables

2011-12-07 Thread H.T. Wei
Hi, I am a newbie to Pyramid and have a question about passing variable between callable like this one: def callable_a(request): id = 1 ... return dict( ... ) def callable_b(request): # get id from callable_a Is there a best way for getting 'id' defined in callable_a in

Re: Best way for passing variable between callables

2011-12-07 Thread Michael Merickel
Well if it's a view callable then it the most reasonable thing to do is probably modify the request object to a state that view_b is expecting. If you really need to special case something so that view_b knows it's not serving a real request then it should probably be refactored into a separate

Re: Best way for passing variable between callables

2011-12-07 Thread H.T. Wei
Is there a example to show how to shove things into request? I tried to google the topic but no lucky, thanks in advance. On Wed, Dec 7, 2011 at 6:11 PM, Michael Merickel mich...@merickel.orgwrote: Well if it's a view callable then it the most reasonable thing to do is probably modify the

Re: Best way for passing variable between callables

2011-12-07 Thread Mark Erbaugh
On Dec 7, 2011, at 7:56 PM, H.T. Wei wrote: Hi, I am a newbie to Pyramid and have a question about passing variable between callable like this one: def callable_a(request): id = 1 ... return dict( ... ) def callable_b(request): # get id from callable_a