On 4 Απρ, 17:38, Mel <mwil...@the-wire.com> wrote: > Íéêüëáïò Êïýñáò wrote: > >> > 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',) > > > In my original question can you explain to me what the meaning of the > > following error is? > > > ******************************************** > > mail = None, comment = None > > TypeError: iterable argument required > > args = ('iterable argument required',) > > ********************************************* > > > Also i noticed that if i append a query string in the end of a url > > with the varibble mail attached like > > >http://superhost.gr/hosting.html?mail=test > > > then page hosting.html does load without any problem. > > > If i remove the query string from the ned of the URL then i'am getting > > the error message i posted. > > > So its not that the if condition is wrong but something happens with > > the form variable 'mail' ..... > > My wild guess is that the trouble is in `if "@" in mail` . You can only > test somthing `in` something if the second thing is iterable. So when > you don't supply a value via `?mail=' -- maybe the code that sets the > value of `mail` from the URL (code you don't show us) sets `mail=None`, > your server-side code blows up. Things would be simpler if you included > a traceback in your error logging. > > Mel.
I think you and Peter are right. Somehow mail variable which is taken its value from a form field is assigned a None value. Here is the hosting.html part of the code that include the form variable mail <form method="post" action=""> <input type="text" name="mail" value="Ποιό είναι το email σου?"><br> <textarea name="comment" cols="40" rows="5"> Σχολιάστε ή ρωτήστε με σχετικά.... </textarea><br> <input type="hidden" name="page" value="hosting.html"> <input type="submit" value="Ρώτα"> </form> But as you can see it has a default value of "Ποιό είναι το email σου?" So how can be of a NoneType ? > Things would be simpler if you included a traceback in your error logging. You mean the web server's last error log messages for the error.log file? -- http://mail.python.org/mailman/listinfo/python-list