[mod_python] spaces from a web form

Rakotomandimby Mihamina mihamina at gulfsat.mg
Thu Jul 23 02:21:15 EDT 2009


07/23/2009 08:38 AM, Amand Tihon::
>> let the following simplified code be:
>>
>>     import re
>>     textarea=for.getfirst('text')
>>     spaces=re.compile('^( )+$')
>
> This regexp will only match a string that contains nothing else than one or
> more spaces.

That is the goal: If only "spaces", strip it to ''.
I know there is a built-in stripping utility, but as I said,
I simplified the problem.

> Remove the caret and the dollar sign, and it should be fine.

That will not achieve our final goal.
Wa want to consider "only spaces" as ''.

The problem is if I enter manu spaces in the form, and just that,
it's not matched. already tested in ipython interactive promt,
the logic is OK.

-- 
                             Architecte Informatique:
    Administration Systeme, Recherche & Developpement
                                   + 261 32 11 401 65
Pensez a l'environnement avant d'imprimer ce message


More information about the Mod_python mailing list