[Zope] external method and forms

murat bilal murat.bilal at gmail.com
Mon Jan 7 20:33:46 UTC 2013


Hi,

I try to make a simple paswd recovery page for my site.Username and
password stored in mysql db.My DTML document is:
<form action="deg" method="POST">
 <h2>Şifre değiştirme sayfasına hoşgeldiniz<h2>
<br>
  KULLANICI ADI: <br><input type="text" name="name:ignore_empty"></br>
<p><br>  ŞİFRE: <br> <input type="text" name="sifre:ignore_empty"></br>
<p><br>  ŞİFRE TEKRAR: <br> <input type="text"
name="sifret:ignore_empty"></br>
<p><br>  <input type="submit" value="yenile" align="center" >
<dtml-var "deg(REQUEST)">
</form>

and my external python method is as follows:

import crypt
import MySQLdb
conn = MySQLdb.connect(host="localhost",
                       user = "rxxxx",
                       passwd = "yyyy",
                       db = "zzzz")
cursor = conn.cursor()
#return context.responseMessage()
def deg(self):

  cryp = crypt.crypt(sifre,'mysecret')
  if request.form["sifre"] == request.form["sifret"]:
    cursor.execute("""update mytable set PASS_WORD=%s where
USERNAME=%s""",(cryp,name))
    print "SUCCESS"
  else:
    print "please try again!"
cursor=conn.close()
But when i tested from DTML Document I got this error

*Error Type: NameError*
*Error Value: global name 'sifre' is not defined*

Can anybody help me?

Regards

MuratB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/zope/attachments/20130107/43fba7f3/attachment.html>


More information about the Zope mailing list