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


Groups > comp.lang.python > #18946

Re: Problem filling an html form

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'mrab': 0.04; 'forth.': 0.07; 'python': 0.08; 'be:': 0.09; 'from:addr:python': 0.09; 'subject:Problem': 0.09; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'reply-to:addr:python-list': 0.16; 'subject:form': 0.16; 'wrote:': 0.16; 'insert': 0.19; 'input': 0.21; 'header:In-Reply-To:1': 0.22; 'string': 0.24; 'looks': 0.27; 'second': 0.29; '8bit%:78': 0.30; 'unicode,': 0.30; 'values': 0.32; 'idea': 0.32; 'header:User-Agent:1': 0.33; 'instead': 0.33; 'to:addr:python-list': 0.33; 'received:84': 0.34; 'reply- to:addr:python.org': 0.34; 'probably': 0.35; 'comment': 0.35; 'skip:" 10': 0.36; 'but': 0.37; 'using': 0.37; 'skip:\xce 10': 0.38; 'skip:\xcf 10': 0.38; 'some': 0.38; 'think': 0.38; 'comments': 0.38; 'should': 0.38; 'ok,': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; '8bit%:93': 0.67; '8bit%:74': 0.67; '8bit%:88': 0.68; '8bit%:100': 0.69; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'guest': 0.73; 'mean.': 0.73; "'@'": 0.84; 'skip:\xc3 10': 0.84; '8bit%:70': 0.91
X-CM-Score 0.00
X-CNFS-Analysis v=2.0 cv=J8QoHXbS c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=9jsOeB20M3cA:10 a=1qANcUZvIwcA:10 a=OUOv7kDek9cA:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=p4M5yE4J0CA17B-Du2EA:9 a=AWnN18poZQXalvvsAZUA:7 a=QEXdDO2ut3YA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117
X-AUTH mrabarnett:2500
Date Fri, 13 Jan 2012 21:13:40 +0000
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version 1.0
To python-list@python.org
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>
In-Reply-To <41330576-e597-4e7a-82b1-1aeca9434b00@n6g2000vbz.googlegroups.com>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To python-list@python.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4731.1326489211.27778.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1326489211 news.xs4all.nl 6843 [2001:888:2000:d::a6]:49844
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18946

Show key headers only | 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