external method and forms

murat bilal <[email protected]>
Newsgroups gmane.comp.web.zope.general
Message-ID <CAMRfwGuJjTPzJJ7jNezXrJjjO4v-Ny-6Zw6_YEBvmbPm2C2_tQ@mail.gmail.com>
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

_______________________________________________
Zope maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.