While I have not found the complete solution, I am closer. I added
this to my apache settings for the virtual host:

AllowEncodedSlashes On

I am no longer getting a 404. But even though the url has two
instances of %2f to represent two slashes:

http://mydomain.com/find/http%3A%2F%2Fwww.wired.com%2F

I am able to capture the URL, but with only one slash. I pass it to my
ModelForm and it prints in my template as:

http:/www.wired.com/

Note the lack of double forward slashes after the colon.




On Oct 6, 4:10 pm, Merrick <[EMAIL PROTECTED]> wrote:
> keith, thanks for trying.
>
> %2f is the encoded value of /, but urls contain other characters as
> well not just alphanumeric.
>
> I suspect this issue may have to do with apache or WSGI but not sure
> what.
>
> On Oct 6, 4:06 pm, "Keith Eberle" <[EMAIL PROTECTED]> wrote:
>
> > quick solution, i think you could add the % to the regex  (i'm hardly a
> > regex master):
>
> > r'^find/(?P<url>[%-\w]+)$
>
> > keith
>
> > On Mon, Oct 6, 2008 at 7:05 PM, Merrick <[EMAIL PROTECTED]> wrote:
>
> > > I have narrowed down the problem to %2F in my url, anyone?
>
> > > On Oct 6, 2:55 pm, Merrick <[EMAIL PROTECTED]> wrote:
> > > > \w will only match alphanumeric characters, I need to match anything
> > > > and will let my modelform verify that it is indeed a URL.
>
> > > > On Oct 6, 2:43 pm, Merrick <[EMAIL PROTECTED]> wrote:
>
> > > > > Thank you, I meant urls.py. APPEND_SLASH = False so I omitted the
> > > > > trailing slash from the regex line:
>
> > > > > r'^find/(?P<url>[-\w]+)$
>
> > > > > and if I pull up the address:
>
> > > > >http://mydomain.com/find/http%3A%2F%2Fwww.wired.com%2F
>
> > > > > I still get
>
> > > > > Not Found
>
> > > > > The requested URL /find/http://www.wired.com/wasnotfoundon this
> > > > > server.
>
> > > > > I did figure out how to decode the URL in python using unquote_plus(),
> > > > > but I cannot figure out this problem.
>
> > > > > On Oct 6, 1:27 pm, "Keith Eberle" <[EMAIL PROTECTED]> wrote:
>
> > > > > > it looks like you have mismatched parens, and no trailing slash,
> > > which will
> > > > > > matter if APPEND_SLASH = True.  the regex should look like:
>
> > > > > >     r'^find/(?P<url>[-\w]+)/$'
>
> > > > > > should be urls.py too, not views.py.
>
> > > > > > keith
>
> > > > > > On Mon, Oct 6, 2008 at 1:17 PM, Merrick <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I am trying to figure out how to match / capture a URL.
>
> > > > > > > views.py
> > > > > > > =======
> > > > > > > urlpatterns = patterns('',
> > > > > > >    url(r'^find/(?P<url>(.*)$',
> > > > > > >        view = 'myapp.views.find',
> > > > > > >        name = 'find'
> > > > > > >    ),
>
> > > > > > > when I enter in this address:
>
> > > > > > > mydomain.com/find/www.wired.com
>
> > > > > > > my view / template are executed, but if I do this:
>
> > > > > > > mydomain.com/find/http%3A%2F%2Fwww.wired.com%2F
>
> > > > > > > I get:
>
> > > > > > > Not Found
>
> > > > > > > The requested URL /find/http://www.wired.com/wasnotfoundonthis
> > > > > > > server.
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to