[Zope] "@" in object id's : invalid

Mike Renfro renfro@tntech.edu
Tue, 3 Jul 2001 11:06:29 -0500


On Tue, Jul 03, 2001 at 04:04:47PM +0200, Philippe Jadin wrote:

> I'd like to setup a simple list of emails stored as dtml docs with
> the emails as id.

My solution may be (ok, is) ugly, but it worked for us (we wanted a
ZClass with the emails as id, but otherwise the problem was the same).

We ended up naming all the ids email__AT__domain.name, and replaced
the __AT__ with an @ symbol whenever we needed to render it in a
page. Something like:

  <dtml-call "REQUEST.set('email',restore_at_in_email(text=id))">

in the page to be rendered, where restore_at_in_email was an acquired
DTML method with the content:

  <dtml-var expr="_.string.replace(text,'__AT__','@')">

We have a corresponding method replace_at_in_email with the content:

  <dtml-var expr="_.string.replace(text,'@','__AT__')">

I think we used replace_at_in_email in the constructor code for the
ZClass; I didn't see it in my quick scan through the ZODB-stored code.

Feel free to comment on how this can be made cleaner.

-- 
Mike Renfro  / R&D Engineer, Center for Manufacturing Research,
931 372-3601 / Tennessee Technological University -- renfro@tntech.edu