Re: Simple request history

2013-06-25 Thread Torsten Irländer
Thank you Michael for your answer. I will try the NewResponse subscriber 
today
and see if it works.

And sorry for posting this question here. It belongs indeed into the
pylons-discuss group :)

Am Dienstag, 25. Juni 2013 01:27:17 UTC+2 schrieb Michael Merickel:

 I think that if you use a NewResponse subscriber instead of NewRequest 
 that will be good enough to get what you want. pyramid_beaker commits the 
 session changes in the response callbacks which happen immediately after 
 the NewResponse event. So you're probably running into some ordering issue 
 between response callbacks (yours happening after beaker's).

 Finally, this thread probably belongs on pylons-discuss. :-)


 On Mon, Jun 24, 2013 at 4:11 PM, Torsten Irländer 
 torsten@googlemail.com javascript: wrote:

 Hi,

 I need to add a really simple request history in my application and I am
 running in some problems.  The idea is to save a list of URLs 
 (request.url) in
 the user session (Beaker).

 So far this is no problem by using a subscriber on NewRequest and adding 
 the
 URL to e.g session['history] at the very begin of every new Request.

 But I only want to add the URL in case the request was successful
 (response.status == 200).  I thought this could easily be done by adding
 either a add_finished_callback or  add_response_callback to be able to
 modify the history at the end of the request where I should have access 
 to the
 status code.

 Unfortunately it seems not to work as modifications on the session does 
 not
 take effect at this point. Maybe because the request has already been
 processed?

 So you have any ideas how to implement such an easy history?

 Torsten

 -- 
 You received this message because you are subscribed to the Google Groups 
 pylons-devel group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to pylons-devel...@googlegroups.com javascript:.
 To post to this group, send email to pylons...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/pylons-devel.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 
You received this message because you are subscribed to the Google Groups 
pylons-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/groups/opt_out.




Simple request history

2013-06-24 Thread Torsten Irländer
Hi,

I need to add a really simple request history in my application and I am
running in some problems.  The idea is to save a list of URLs (request.url) 
in
the user session (Beaker).

So far this is no problem by using a subscriber on NewRequest and adding the
URL to e.g session['history] at the very begin of every new Request.

But I only want to add the URL in case the request was successful
(response.status == 200).  I thought this could easily be done by adding
either a add_finished_callback or  add_response_callback to be able to
modify the history at the end of the request where I should have access to 
the
status code.

Unfortunately it seems not to work as modifications on the session does not
take effect at this point. Maybe because the request has already been
processed?

So you have any ideas how to implement such an easy history?

Torsten

-- 
You received this message because you are subscribed to the Google Groups 
pylons-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Simple request history

2013-06-24 Thread Michael Merickel
I think that if you use a NewResponse subscriber instead of NewRequest that
will be good enough to get what you want. pyramid_beaker commits the
session changes in the response callbacks which happen immediately after
the NewResponse event. So you're probably running into some ordering issue
between response callbacks (yours happening after beaker's).

Finally, this thread probably belongs on pylons-discuss. :-)


On Mon, Jun 24, 2013 at 4:11 PM, Torsten Irländer 
torsten.irlaen...@googlemail.com wrote:

 Hi,

 I need to add a really simple request history in my application and I am
 running in some problems.  The idea is to save a list of URLs
 (request.url) in
 the user session (Beaker).

 So far this is no problem by using a subscriber on NewRequest and adding
 the
 URL to e.g session['history] at the very begin of every new Request.

 But I only want to add the URL in case the request was successful
 (response.status == 200).  I thought this could easily be done by adding
 either a add_finished_callback or  add_response_callback to be able to
 modify the history at the end of the request where I should have access to
 the
 status code.

 Unfortunately it seems not to work as modifications on the session does not
 take effect at this point. Maybe because the request has already been
 processed?

 So you have any ideas how to implement such an easy history?

 Torsten

 --
 You received this message because you are subscribed to the Google Groups
 pylons-devel group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to pylons-devel+unsubscr...@googlegroups.com.
 To post to this group, send email to pylons-devel@googlegroups.com.
 Visit this group at http://groups.google.com/group/pylons-devel.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups 
pylons-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/groups/opt_out.