Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18946

Re: Problem filling an html form

Date 2012-01-13 21:13 +0000
From MRAB <python@mrabarnett.plus.com>
Subject Re: Problem filling an html form
References <adffac88-65e7-4057-b7b0-956fde49a8bd@p42g2000vbt.googlegroups.com> <mailman.4724.1326483339.27778.python-list@python.org> <41330576-e597-4e7a-82b1-1aeca9434b00@n6g2000vbz.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.4731.1326489211.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 13/01/2012 20:16, Νικόλαος Κούρας wrote:
> On 13 Ιαν, 21:35, MRAB<pyt...@mrabarnett.plus.com>  wrote:
>>  On 13/01/2012 17:02, Íéêüëáïò Êïýñáò wrote:
>>
>>  >  # get some enviromental values
>>  >  form = cgi.FieldStorage()
>>  >  mail = form.getvalue('mail') or ''
>>  >  comment = form.getvalue('comment') or ''
>>
>>  >      # insert guest comments into database if form was submitted
>>  >      if '@' in mail and comment not in ("ÑùôÞóôå ìå ó÷åôéêÜ..."):
>>
>>  [snip]
>>
>>  Do you really want to look for the comment in that string instead of
>>  looking for that string in the comment?
>
> What do you mean?
>
> I just want to check that the user hasnt pressed the submit button
> leaving the default values with the input comment box.
>
> Iam not sure what you mean.

In the first part of the condition you're asking:

     '@' in mail

which is OK, but in the second part of the condition you're asking:

     comment not in ("Ρωτήστε με σχετικά...")

which I think should be:

     "Ρωτήστε με σχετικά..." not in comment

Incidentally, it looks to me like you're using Python 2, in which case
it's probably a good idea to use Unicode, so that would be:

     u"Ρωτήστε με σχετικά..." not in comment

and so forth.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Problem filling an html form Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2012-01-13 09:02 -0800
  Re: Problem filling an html form MRAB <python@mrabarnett.plus.com> - 2012-01-13 19:35 +0000
    Re: Problem filling an html form Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2012-01-13 12:16 -0800
      Re: Problem filling an html form MRAB <python@mrabarnett.plus.com> - 2012-01-13 21:13 +0000
        Re: Problem filling an html form Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2012-01-13 13:30 -0800
          Re: Problem filling an html form Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2012-01-13 17:20 -0800

csiph-web