Isn't + and %20 considered the same in HTTP??

On Mar 17, 12:12 am, "Mike Orr" <[EMAIL PROTECTED]> wrote:
> I have a bunch of images with spaces in the filenames.  I need to
> embed the filename in the URL with the proper escaping, so:
>     6001/1355/SHELLNAIRN08OCT05 _24_.jpg
> should be:
>     /attachments/6001/1355/SHELLNAIRN08OCT05%20_24_.jpg
>
> I have a route like this:
>
>     NUMERIC = R"\d+"
>     map.connect("attachment", "/attachments/:orr_id/:entry_id/:filename",
>         requirements={"orr_id": NUMERIC, "entry_id": NUMERIC})
>
> $ paster shell development.ini>>> h.url_for("attachment", orr_id=6001, 
> entry_id=1355,
>
> filename='SHELLNAIRN08OCT05 _24_.jpg')
> '/attachments/6001/1355/SHELLNAIRN08OCT05+_24_.jpg'
>
> Oops, it quoted it query-string style.  Maybe I should escape the
> argument myself.
>
> >>> h.url_for("attachment", orr_id=6001, entry_id=1355,
>
> filename='SHELLNAIRN08OCT05%20_24_.jpg')
> '/attachments/6001/1355/SHELLNAIRN08OCT05%2520_24_.jpg'
>
> Now it double-quoted.  Is this a bug or am I using it wrong?  My
> Quixote application uses "%20" for spaces and has never had a problem
> finding the images.
>
> My current workaround is to replace the '+' afterward.
>
> >>> url = h.url_for("attachment", orr_id=6001, entry_id=1355,
>
> filename='SHELLNAIRN08OCT05 _24_.jpg')>>> url.replace("+", "%20")
>
> '/attachments/6001/1355/SHELLNAIRN08OCT05%20_24_.jpg'
>
> --
> Mike Orr <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to