Re: match_param not behaving as expected - pyramid-1.2.1-Py2.7
Thanks for the clarification, and your very prompt reply. For anyone following along, I've shown the correction to my example below. Michael; your article shows practical use of match_param beautifully: http://michael.merickel.org/2011/8/23/outgrowing-pyramid-handlers/ I agree the Pyramid manual is very verbose, and a greater emphasis on examples for each feature ahead of the conceptual explanation would help newcomers (and probably save a few thousand words). Still, my first day with Pyramid has led me to believe it is very mature in approach, and the manual at least demonstrates a team wrestling with difficult concepts and showing their workings - concision usually follows such a feat of mental gymnastics! def vc_match_param(request): return Response('Will only respond when matchdict action is present and has value edit (like.. /match_param/edit)' % request.matchdict) config.add_route('match_param', '/match_param/{action}') config.add_view( vc_match_param, route_name='match_param', match_param='action=edit' ) -- 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.
match_param not behaving as expected - pyramid-1.2.1-Py2.7
Could anyone explain why the below test for request_param works ok, but the test for match_param does not? MATCH - http://127.0.0.1:8080/request_param?action=anything NO MATCH - http://127.0.0.1:8080/match_param?action=edit Pyramid 1.2.1 / Python 2.7 def vc_request_param(request): return Response('Will only respond when GET param action is present (like.. ?action=anything)') def vc_match_param(request): return Response('Will only respond when GET param action is present and has value edit (like.. ?action=edit)') For these views.. config.add_route('request_param', '/request_param') config.add_view( vc_request_param, route_name='request_param', request_param='action' ) config.add_route('match_param', '/match_param') config.add_view( vc_match_param, route_name='match_param', match_param='action=edit' ) -- 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: match_param not behaving as expected - pyramid-1.2.1-Py2.7
match_param is for matching items in the matchdict. These are patterns in your url, for example if you had the url /match/{param}, then you might use match_param='param=edit' to only match when that pattern is edit. request_param is used to match the query string in your url (things after the ?-mark). So you might do request_param='action' to match any url with an action parameter, or request_param='action=edit' to match any url with ?action=edit. -- Michael -- 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.