[ZOPE] using re.compile(...) raises an HTTP401 (basic authencication) ??????

Gilles Lenfant glenfant.nospam at bigfoot.com
Wed May 2 19:54:30 CEST 2001


Can't understand this !!!

I made a simple ZOPE python script for checking some text fields (runs OK)
The same script checks an e-mail field and when testing (the "Test" tab with
the parameter/value form), the browser raises a user/password login box
(HTTP status 401 I guess)

=== my script==
...
import string
import re
...
# Test other fields with <string> package resources (OK)
...
# Test of e-mail address
email = string.strip(email)
if len(email) == 0:
    errortext = errortext + '<li>You must provide a mail address</li>\n'
else:
    # Execution of next line raises the
    mailre = re.compile(r'^([\w at .=/_-]+)@([\w-]+)(\.[\w-]+)*$')
    if not mailre.match(email):
        errortext = errortext + '<li>%s is not a valid mail address</li>\n'
% email
...
====end====

AFAIK, "re" is not in the current ZOPE namespace when executing the script.

Note: when I remove the e-mail check, the test just runs fine (including
"import re")!

Can anybody help ?






More information about the Python-list mailing list