On Saturday, April 2, 2011 12:26:18 PM UTC-4, Νικόλαος Κούρας wrote:
> Hello, after inserting this line if "@" in mail and comment not in
> ("Σχολιάστε ή ρωτήστε με σχετικά....", ""):
> 
> iam getting the following error which i dont understand
> 
> **************************************************************
> 163         # insert guest comments into database if form was
> submitted
>   164         if "@" in mail and comment not in ("Σχολιάστε ή ρωτήστε
> με σχετικά....", ""):
>   165                 try:
>   166                         cursor.execute( '''INSERT INTO
> users(mail, comment) VALUES(%s, %s)''', (mail, comment) )
> mail = None, comment = None
> 
> TypeError: iterable argument required
>       args = ('iterable argument required',)

Here's how I parse what you've written so far:

INVALID_COMMENTS = ("Σχολιάστε ή ρωτήστεμε σχετικά....", "")
SQL_COMMENT_FORM = "INSERT INTO users(mail, comment) VALUES(%s, %s)"

# insert guest comments into database if form was submitted
mail = form.getvalue('mail')
comment = form.getvalue('comment')
if "@" in mail and comment not in INVALID_COMMENTS:
    try:        
        cursor.execute(SQL_COMMENT_FORM % (mail, comment))
    except MySQLdb.Error as e:
        print("Error %d: %s" % (e.args[0], e.args[1]))
    else:
        mail = comment = None
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to