You can also do this as:
    (r^users/activate_user/(?P<code>[^/])/, views.activate_user')
which gets you away from relying on the final equal signs, though it
would allow any characters into the code other than a slash.  That
should be okay since the code would not be correct in that case.
- Bob

On Mar 1, 9:38 am, "Giuseppe Franchi" <[EMAIL PROTECTED]> wrote:
> Cheers, thanks a lot Scott, you were right and i resolved ^^
>
> I post, maybe someone could find it useful.
> In my view i used the base64 library.
>
> import md5, base64
> ...
>                 key = md5.new(string).digest()
>                 key = base64.urlsafe_b64encode(key)
>                 validation.md5_key = key
>                 validation.save()
>
> The URL is
> (r'^users/activate_user/(?P<code>[a-zA-Z0-9%\-]+==)/',
> 'views.activate_user'),
>
> the final '+==' make it works, as any key generated this way ends with
> 2 equal signs.
>
> On 27 Feb, 17:11, "ScottB" <[EMAIL PROTECTED]> wrote:
>
> > Hi Giuseppe.
>
> > > As i said, i need to pass in my URL a <code> variable, wich is the
> > > result of a md5 digest.
> > > (no private information... only a validation key).
>
> > > Obviously i tried with
> > > (r'^users/activate_user/(?P<code>)/', 'views.register'),
> > > (r'^users/activate_user/(?P<code>[a-zA-Z0-9%\-]+=)/',
> > > 'views.register'),
> > > but it doesn't work: Django always return 404.
>
> > It works for me if the code ends with a single equals sign.
> > e.g.http://localhost/users/activate_user/abc123=/
>
> > If you're stuck, maybe you could post a couple of example urls that
> > give you 404 errors.
>
> > Scott


--~--~---------~--~----~------------~-------~--~----~
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