Pyramid modify query parameter of current url

2011-03-18 Thread oO
What would be the best way to modify only one of the query parameters
of the current url without modifying anything else?

I have a query based pagination in a mako template, and I want it to
only modify the page=X part of the url, without having to know
anything about the current view, or the other potential parameters
that might exist on the query already (sorting for example)

I'm using traversal and so I can't really use current_route_url() but
I wish there was something similar. I can extract the current
resource, view_name, but I'm now sure how I would get the query as a
dictionary that would be compatible with what resource_url() expects
to rebuild the modified url.

Any ideas?

oO

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: Pyramid modify query parameter of current url

2011-03-18 Thread Michael Merickel
The query parameter to resource url expects a list of 2-tuples,
coincidentally the same as what is returned by request.GET.items().

I'd suggest:
qs = dict(request.GET)
qs['page'] = 2
url = resource_url(context, request, query=qs.items())

This is untested, but it is not far off from working.

Michael


On Fri, Mar 18, 2011 at 4:53 PM, oO oliv...@ozoux.com wrote:

 What would be the best way to modify only one of the query parameters
 of the current url without modifying anything else?

 I have a query based pagination in a mako template, and I want it to
 only modify the page=X part of the url, without having to know
 anything about the current view, or the other potential parameters
 that might exist on the query already (sorting for example)

 I'm using traversal and so I can't really use current_route_url() but
 I wish there was something similar. I can extract the current
 resource, view_name, but I'm now sure how I would get the query as a
 dictionary that would be compatible with what resource_url() expects
 to rebuild the modified url.

 Any ideas?

 oO

 --
 You received this message because you are subscribed to the Google Groups
 pylons-discuss group.
 To post to this group, send email to pylons-discuss@googlegroups.com.
 To unsubscribe from this group, send email to
 pylons-discuss+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/pylons-discuss?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: https urls with pyramid

2011-03-18 Thread Chris McDonough


On Mar 17, 1:15 pm, Eric Rasmussen ericrasmus...@gmail.com wrote:
 Thank you both -- that's what I was looking for (Daniel -- I am using
 reverse proxy so that it explains it).

Really all you should have to do is make sure that the HTTP_HOST
header is passed to Pyramid through the proxy.

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.