[Zope] zcatalog, zclass instances

josh on josh@futurefarmers.com
Sat, 9 Dec 2000 17:50:46 -0800


Hello,

I am building a small community site.
I am building the login/signup system.
I have a problem with the creation of new users on signup.  I have a users
zclass which is catalog aware.  I used the job board tutorial to set it up
(thanks! very useful documentation)
When I a user signs up I search the catalog for their username, because I
want to keep that unique. here is the code:

Content-type: application/x-www-form-urlencoded

<dtml-in Catalog>
_root.feedback=sorry+name+taken
<dtml-if sequence-end>
</dtml-if sequence-end>
<dtml-else>
<dtml-var add_user_dtml>
</dtml-in>

This page is passed the variable "username".  This works to catch existing
usernames most of the time.  However, in a few cases it will miss the fact
that the name matches an existing name and go ahead to the <dtml-var
add_user_dtml> page:

<dtml-call "REQUEST.set('password', signuppassword)">
<dtml-call "REQUEST.set('username', username)">
<dtml-with "manage_addProduct['swatchuser']">
<dtml-call "swatchuser_add(_.None, _, NoRedir=1)">
</dtml-with>
_root.feedback=success

This code usually successfully adds a new user.  However if the username is
a duplicate (it shouldn't arrive at this page, but if it does) it will only
successfully make a new zclass instance of the user if they are a single
letter long!!!!
Thus I get a user list that looks like this:

max , yay , josh , mary , peter , john , ann , dog , cat , badger , fork , g
, k , ww
, u , u , u , u , u , b , u , erm , frog , erk , damn , erkf , this , bg , q
, q , e , u , aname , j , j , j , j , j , j , j , j , j , j , amy , y , y ,
y

So for single letter names the user signs up no matter whether someone else
has that name or not.  Which is not what I want. But the problem does not
end their, else I would just not permit one letter name. For those who
choose names of more than one letter, they may be told that they have
successfulluy created a new user when they haven't.  The times when this
happens are usually if I haven't closed and opened the browser between
sign-ups.  However it happens seemingly randomly.

I am calling all this code from a flash file in the same directory.  I have
the same thing working using zope and SQL no problem, but can't work it out
with zcatalog.  Unfortunately I need to!

My first inuitions are that:

1: it has something to do with the pages being cached.
2: I am not updating the catalog properly, though I added the lines
suggested in the job board tutorial to the add method of the zclass:
  <dtml-call reindex_object>

Any hints will be appreciated...

I think I may be reporting the same problem that is mentioned in:

http://www.egroups.com/message/zope/44901

but I am not sure.

thanks for your time

josh on




===========================
write: josh@futurefarmers.com
read: www.futurefarmers.com
read: www.crd.rca.ac.co.uk/~josh
interrupt (i love it): (415) 552 2124
=============================