[Zope-PTK] A nice URL when using the email address as the account name

Andrew Wilcox circle@gwi.net
Thu, 04 May 2000 11:36:21 -0400


Hey, here's a nice URL convention for when I want to use the user's email
address as the account name.

The context is, imagine I have a portal where to log in, the user types in
their email address and their password.  So in this case, I'm using the
email address itself as the account name, rather than trying to come up
with a unique account name that doesn't clash with other users.

Ok, so how would I like to show the account name in URL's?  I could try
using the email address as-is:

    http://myportal.com/users/fred@yahoo.com/freds_published_object

but whoops, at-signs are encoded in URL's, so what I really get is:

    http://myportal.com/users/fred%40yahoo.com/freds_published_object

which is pretty ugly.


I could just map the at-sign to a slash:

    http://myportal.com/users/fred/yahoo.com/freds_published_object

Which works, but just doesn't look right to my eye.


So, what's not allowed in email addresses but can be used in URL's?

Hmm, turns out the comma doesn't need to be encoded in URL's.  And the
comma can't be used in an email address, so I can map the at-sign to a
comma without fear of clashing with other possible email addresses.

    http://myportal.com/users/fred,yahoo.com/freds_published_object

Hmm, doesn't look too bad!

Once I got used to it, it almost reads like "somebody, somewhere", like as
if I were saying "Fred Franklin, Portland, Maine".

Zope is happy to have object id's with a comma in them, so I can create a
"fred,yahoo.com" folder and Zope will generate URL's such as:

    http://myportal.com/users/fred,yahoo.com/manage_main

What do you think?

Andrew