event suscriber, request property or session

2012-07-02 Thread Antonio Beamud Montero
Hi all: I want to have the inbox messages number associated with a user always available. What's the best way to do this?. As I can read in documentation, I can accomplish this with: - adding a property to the request with 'set_request_property', like: myconf.set_request_property(calcula

Re: event suscriber, request property or session

2012-07-02 Thread Chris McDonough
On 07/02/2012 11:13 AM, Antonio Beamud Montero wrote: Hi all: I want to have the inbox messages number associated with a user always available. What's the best way to do this?. As I can read in documentation, I can accomplish this with: - adding a property to the request with 'set_request_proper

Re: event suscriber, request property or session

2012-07-02 Thread Jonathan Vanasco
> - adding a property to the request with 'set_request_property', like: >       myconf.set_request_property(calculate_user_inbox, 'inbox') > > - Using an event suscriber: >      myconf.add_subscriber('myapp.calculate_user_inbox_suscriber', >                            'pyramid.events.NewRequest')

Re: event suscriber, request property or session

2012-07-02 Thread Antonio Beamud Montero
El 02/07/12 17:17, Chris McDonough escribió: On 07/02/2012 11:13 AM, Antonio Beamud Montero wrote: Hi all: I want to have the inbox messages number associated with a user always available. What's the best way to do this?. As I can read in documentation, I can accomplish this with: - adding a pr

Re: event suscriber, request property or session

2012-07-02 Thread Michael Merickel
Well when you say "always available", are you *sure*? Do you want it available when serving static resources? If you create a request property then it is lazily calculated when you actually do request it and with reify=True it will cache the result for the request duration. NewRequest subscribers a