Critical Question for Dieter - Testing with <dtml-in Catalog>
First of all, I want to thank you for all of your help in the past. Every question of mine you have responded to has been right on target. I am trying to put up a site, was counting on Zope as a solution, am out of money, behind schedule, have posted this question before and got no response, can not find any documentation, and do not have the money to hire Zope Corp consultants to help fix it. I'm mortgagedto the hilt, and if I can't find a solution, I'm history. I have a new account form which can be filled out on line. I'm auto-generating a unique id in my product class by : <dtml-call "REQUEST.set('ts', ZopeTime())"> <dtml-call "REQUEST.set('id',_.str(_.int(ts)))"> <dtml-with "candidate_info_entry.createInObjectManager(REQUEST['id'], REQUEST)"> ---(from the web tutorial) I'm trying to keep people from entering some of the same information twice such as email address. (I am using their email address as their username for login, since it is unique) I need to be able to test the Catalog to see if the username is already indexed, and if so, raise a message that that username is already on file. I've tried : <dtml-in Catalog> <dtml-if "_['username'] == _['sequence-item']"> <dtml-call "RESPONSE.redirect('/duplicate_record')"> <dtml-else> <dtml-call "REQUEST.set('username', username)"> <dtml-call "REQUEST.set('password', password)"> <dtml-call "REQUEST.set('password_confirm', password_confirm)"> <dtml-call "REQUEST.set('user_hint', user_hint)"> <dtml-call "REQUEST.set('user_fname', user_fname)"> <dtml-call "REQUEST.set('user_lname', user_lname)"> <dtml-call "REQUEST.set('user_email', user_email)"> <dtml-call "REQUEST.set('user_city', user_city)"> <dtml-call "REQUEST.set('user_state', user_state)"> <dtml-call "REQUEST.set('user_province', user_province)"> <dtml-call "REQUEST.set('user_country', user_country)"> <dtml-call "REQUEST.set('title', user_fname+' - '+user_lname+' -'+user_email)"> <dtml-with "manage_addProduct['CandidateInfo']"> <dtml-call "candidate_info_entry_add(_.None, _, NoRedir=1)"> </dtml-with> I've tried many other possibilitiesas well, but it just blows past and enters the record anyway. I also tried setting the email address as the id and then do a "try and except", but that doesn't work either Do you know a possible solution to this, or where I could find some documentation on it? I'm desperate. Thanks in Advance, Michael
I need to be able to test the Catalog to see if the username is already indexed, and if so, raise a message that that username is already on file.
I've tried : <dtml-in Catalog> <dtml-if "_['username'] == _['sequence-item']">
a lot of stuff snipped what's the username index in the Catalog? let's say the index is u_name <dtml-if "Catalog(u_name={'query':_['username']})"> user exist <dtml-else> do your thang here </dtml-if> this code is untested, and i claim no responsibility for any data munged, zope instance sank, etc, etc hth -- http://www.kedai.com.my/ http://www.kedai.com.my/eZine http://www.zope.org/Members/kedai http://www.my-zope.org Am I Evil?
Bakhtiar, Thanks!!! That did it. How did you learn this? Is this documented somewhere? You are really a life saver. I was using the other syntax because it worked for me when calling in a list. Michael Bakhtiar A Hamid wrote:
what's the username index in the Catalog?
let's say the index is u_name
<dtml-if "Catalog(u_name={'query':_['username']})"> user exist <dtml-else> do your thang here </dtml-if>
this code is untested, and i claim no responsibility for any data munged, zope instance sank, etc, etc
hth
On Wednesday 15 May 2002 04:10 pm, Michael wrote:
Bakhtiar,
Thanks!!! That did it. How did you learn this? Is this documented somewhere? You are really a life saver. I was using the other syntax because it worked for me when calling in a list.
Michael
a *lot* of head bangin ;) p/s - i do like head bangin zope with some head bangin bands -- http://www.kedai.com.my/ http://www.kedai.com.my/eZine http://www.zope.org/Members/kedai http://www.my-zope.org As you woke this morning, and open up your eyes... did you notice the tear stains lining your face were mine.
Man, it must have been a lot of head bangin. Now can I use this same method for let's say limiting the number of postings someone could make? For example, say I have a variable called max_limit. max_limit=10, could I do <dtml-if "Catalog(max_limit<={'query':_['sequence-number']})"> Sometimes this syntax issue gets rather confusing. Thanks again, Michael Bakhtiar A Hamid wrote:
a *lot* of head bangin ;)
p/s - i do like head bangin zope with some head bangin bands
participants (2)
-
Bakhtiar A Hamid -
Michael