Hi all, I am trying to learn and if possible migrate some of my office apps to zope. The trouble is somewhere here From Index_html page I am using a input form to get the login, password so that it can authenticated of the currently internal central auth system. The form is posted to login_verify having content as follows. The Authenticate_user is a ZSQL method taking user ID as parameter and is supposed to return password, name and access level of that user. <dtml-in Authenticate_user> <dtml-if expr="password==upassword"> Auth success <dtml-call RESPONSE.redirect('main')> <dtml-else> Auth Failed </dtml-if> </dtml-in> Unfortunately I dot get Auth Sucess but the redirect never happens. I tried earlier this using dtml-call instead of dtml-in but soon I realized that dtml-call does not return any values I need the output of password, access level so that I can set the apporiarte permissons on the respective page. Please advise. Regards
The best piece of advice I can give you is to use a python script to handle this. DTML does not lend itself very well to handling form postings, IMHO. Try creating a script that does something like this (untested): RESPONSE = context.REQUEST.RESPONSE auth = context.Authenticate_user() # I'm assuming this returns a single row if auth and len(auth) : if password == auth[0].upassword : return RESPONSE.redirect('main') else : return RESPONSE.redirect('somewhere_else') S K Rahman wrote:
Hi all,
I am trying to learn and if possible migrate some of my office apps to zope. The trouble is somewhere here
From Index_html page I am using a input form to get the login, password so that it can authenticated of the currently internal central auth system. The form is posted to login_verify having content as follows. The Authenticate_user is a ZSQL method taking user ID as parameter and is supposed to return password, name and access level of that user.
<dtml-in Authenticate_user>
<dtml-if expr="password==upassword">
Auth success
<dtml-call RESPONSE.redirect('main')>
<dtml-else>
Auth Failed
</dtml-if>
</dtml-in>
Unfortunately I dot get Auth Sucess but the redirect never happens. I tried earlier this using dtml-call instead of dtml-in but soon I realized that dtml-call does not return any values I need the output of password, access level so that I can set the apporiarte permissons on the respective page.
Please advise.
Regards
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Thanx for the reply, Unfortunately it does not works as well. Some Error "global name 'password' is not defined" problem. I tried hunting the current zope apps looking for some info but it seems all of them reply of the zope auth method. Just in case remember any link with the information I am looking for please let me know. BTW is there any revelant call for revelant thing like dtml-call that returns the value from ZSQL method that can me compared? Regards Kevin Carlson wrote:
The best piece of advice I can give you is to use a python script to handle this. DTML does not lend itself very well to handling form postings, IMHO. Try creating a script that does something like this (untested):
RESPONSE = context.REQUEST.RESPONSE auth = context.Authenticate_user() # I'm assuming this returns a single row if auth and len(auth) : if password == auth[0].upassword : return RESPONSE.redirect('main') else : return RESPONSE.redirect('somewhere_else')
S K Rahman wrote:
Hi all,
I am trying to learn and if possible migrate some of my office apps to zope. The trouble is somewhere here
From Index_html page I am using a input form to get the login, password so that it can authenticated of the currently internal central auth system. The form is posted to login_verify having content as follows. The Authenticate_user is a ZSQL method taking user ID as parameter and is supposed to return password, name and access level of that user.
<dtml-in Authenticate_user>
<dtml-if expr="password==upassword">
Auth success
<dtml-call RESPONSE.redirect('main')>
<dtml-else>
Auth Failed
</dtml-if>
</dtml-in>
Unfortunately I dot get Auth Sucess but the redirect never happens. I tried earlier this using dtml-call instead of dtml-in but soon I realized that dtml-call does not return any values I need the output of password, access level so that I can set the apporiarte permissons on the respective page.
Please advise.
Regards
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
In my example I was using the variable 'password' that I'm guess you supplied in the request from your form. You need to substitute your own variables for these items. The equivalent to dtml-call in a script is just to call the item (e.g., auth=context.Authenticate_user()). If you don't care about the return value, don't make an assignment. It would probably be a good idea to read the chapter on scripting in the Zope Book which you can find online at www.zope.org. Kevin S K Rahman wrote:
Thanx for the reply,
Unfortunately it does not works as well. Some Error "global name 'password' is not defined" problem. I tried hunting the current zope apps looking for some info but it seems all of them reply of the zope auth method. Just in case remember any link with the information I am looking for please let me know.
BTW is there any revelant call for revelant thing like dtml-call that returns the value from ZSQL method that can me compared?
Regards
Kevin Carlson wrote:
The best piece of advice I can give you is to use a python script to handle this. DTML does not lend itself very well to handling form postings, IMHO. Try creating a script that does something like this (untested):
RESPONSE = context.REQUEST.RESPONSE auth = context.Authenticate_user() # I'm assuming this returns a single row if auth and len(auth) : if password == auth[0].upassword : return RESPONSE.redirect('main') else : return RESPONSE.redirect('somewhere_else')
S K Rahman wrote:
Hi all,
I am trying to learn and if possible migrate some of my office apps to zope. The trouble is somewhere here
From Index_html page I am using a input form to get the login, password so that it can authenticated of the currently internal central auth system. The form is posted to login_verify having content as follows. The Authenticate_user is a ZSQL method taking user ID as parameter and is supposed to return password, name and access level of that user.
<dtml-in Authenticate_user>
<dtml-if expr="password==upassword">
Auth success
<dtml-call RESPONSE.redirect('main')>
<dtml-else>
Auth Failed
</dtml-if>
</dtml-in>
Unfortunately I dot get Auth Sucess but the redirect never happens. I tried earlier this using dtml-call instead of dtml-in but soon I realized that dtml-call does not return any values I need the output of password, access level so that I can set the apporiarte permissons on the respective page.
Please advise.
Regards
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Do this: <dtml-call "RESPONSE.redirect('main')"> Note the double quotes. Any time your expression is more complex than a single name, you're going to need them. HTH, Dylan On Fri, 2003-08-01 at 06:14, S K Rahman wrote:
Hi all,
I am trying to learn and if possible migrate some of my office apps to zope. The trouble is somewhere here
From Index_html page I am using a input form to get the login, password so that it can authenticated of the currently internal central auth system. The form is posted to login_verify having content as follows. The Authenticate_user is a ZSQL method taking user ID as parameter and is supposed to return password, name and access level of that user.
<dtml-in Authenticate_user>
<dtml-if expr="password==upassword">
Auth success
<dtml-call RESPONSE.redirect('main')>
<dtml-else>
Auth Failed
</dtml-if>
</dtml-in>
Unfortunately I dot get Auth Sucess but the redirect never happens. I tried earlier this using dtml-call instead of dtml-in but soon I realized that dtml-call does not return any values I need the output of password, access level so that I can set the apporiarte permissons on the respective page.
Please advise.
Regards
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Bravo....Thanx it did worked. I have actually wasted lots of my time to get this solved. Rest most of my migration work got over expect for this. BTW I wonder in such a scenario isn't Zope supposed to throw an expection? Regards Dylan Reinhardt wrote:
Do this:
<dtml-call "RESPONSE.redirect('main')">
Note the double quotes. Any time your expression is more complex than a single name, you're going to need them.
HTH,
Dylan
On Fri, 2003-08-01 at 06:14, S K Rahman wrote:
Hi all,
I am trying to learn and if possible migrate some of my office apps to zope. The trouble is somewhere here
From Index_html page I am using a input form to get the login, password so that it can authenticated of the currently internal central auth system. The form is posted to login_verify having content as follows. The Authenticate_user is a ZSQL method taking user ID as parameter and is supposed to return password, name and access level of that user.
<dtml-in Authenticate_user>
<dtml-if expr="password==upassword">
Auth success
<dtml-call RESPONSE.redirect('main')>
<dtml-else>
Auth Failed
</dtml-if>
</dtml-in>
Unfortunately I dot get Auth Sucess but the redirect never happens. I tried earlier this using dtml-call instead of dtml-in but soon I realized that dtml-call does not return any values I need the output of password, access level so that I can set the apporiarte permissons on the respective page.
Please advise.
Regards
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
On Fri, 2003-08-01 at 09:08, S K Rahman wrote:
BTW I wonder in such a scenario isn't Zope supposed to throw an expection?
This falls into a bit of a gray area. Since dtml-call provides no return, exceptions are ignored as well. IMO, a namespace error should be thrown *regardless* but that's not how it works. If you're in a situation in the future where a dtml-call isn't working, try changing it over to dtml-var for debugging... that will provide you with the return value and exceptions you may need to fix the problem. Dylan
participants (3)
-
Dylan Reinhardt -
Kevin Carlson -
S K Rahman