* 'VirtualMailManager/EmailAddress.py'
* 'VirtualMailManager/MailLocation.py'
* 'VirtualMailManager/VirtualMailManager.py'
* 'VirtualMailManager/ext/Postconf.py'
- Removed wrong placed re.compile() calls
--- a/VirtualMailManager/EmailAddress.py Tue Sep 16 05:55:54 2008 +0000
+++ b/VirtualMailManager/EmailAddress.py Tue Sep 16 20:03:09 2008 +0000
@@ -75,10 +75,10 @@
if len(localpart) > 64:
raise VMMEAE(_(u'The local part »%s« is too long') %
localpart, ERR.LOCALPART_TOO_LONG)
- ic = re.compile(RE_LOCALPART).findall(localpart)
+ ic = set(re.findall(RE_LOCALPART, localpart))
if len(ic):
ichrs = ''
- for c in set(ic):
+ for c in ic:
ichrs += u"»%s« " % c
raise VMMEAE(_(u"The local part »%(lpart)s« contains invalid\
characters: %(ichrs)s") % {'lpart': localpart, 'ichrs': ichrs},
--- a/VirtualMailManager/MailLocation.py Tue Sep 16 05:55:54 2008 +0000
+++ b/VirtualMailManager/MailLocation.py Tue Sep 16 20:03:09 2008 +0000
@@ -18,7 +18,7 @@
from Exceptions import VMMMailLocationException as MLE
import constants.ERROR as ERR
-RE_MAILLOCATION = """^[\w]{1,20}$"""
+RE_MAILLOCATION = """^\w{1,20}$"""
class MailLocation:
"""A wrapper class thats provide access to the maillocation table"""
@@ -43,7 +43,6 @@
raise MLE(_('mid must be an int/long.'), ERR.MAILLOCATION_INIT)
self._loadByID()
else:
- re.compile(RE_MAILLOCATION)
if re.match(RE_MAILLOCATION, maillocation):
self.__maillocation = maillocation
self._loadByName()
--- a/VirtualMailManager/VirtualMailManager.py Tue Sep 16 05:55:54 2008 +0000
+++ b/VirtualMailManager/VirtualMailManager.py Tue Sep 16 20:03:09 2008 +0000
@@ -151,13 +151,11 @@
Keyword arguments:
domainname -- the domain name that should be validated
"""
- re.compile(RE_ASCII_CHARS)
if not re.match(RE_ASCII_CHARS, domainname):
domainname = VirtualMailManager.idn2ascii(domainname)
if len(domainname) > 255:
raise VMMException(_(u'The domain name is too long.'),
ERR.DOMAIN_TOO_LONG)
- re.compile(RE_DOMAIN)
if not re.match(RE_DOMAIN, domainname):
raise VMMException(_(u'The domain name »%s« is invalid.') %\
domainname, ERR.DOMAIN_INVALID)
@@ -305,7 +303,6 @@
oldpwd = os.getcwd()
os.chdir(domdir)
- re.compile(RE_MBOX_NAMES)
maildir = self.__Cfg.get('maildir', 'name')
folders = [maildir]
for folder in self.__Cfg.get('maildir', 'folders').split(':'):
@@ -583,7 +580,6 @@
domain = pattern[1:]
elif pattern.endswith('%'):
domain = pattern[:-1]
- re.compile(RE_DOMAIN_SRCH)
if not re.match(RE_DOMAIN_SRCH, domain):
raise VMMException(
_(u"The pattern »%s« contains invalid characters.") %
--- a/VirtualMailManager/ext/Postconf.py Tue Sep 16 05:55:54 2008 +0000
+++ b/VirtualMailManager/ext/Postconf.py Tue Sep 16 20:03:09 2008 +0000
@@ -1,5 +1,5 @@
# -*- coding: UTF-8 -*-
-# Copyright 2007-2008 VEB IT
+# Copyright 2008 VEB IT
# See COPYING for distribution information.
# $Id$
@@ -30,8 +30,7 @@
"""
self.__bin = postconf_bin
self.__val = ''
- re.compile(RE_PC_PARAMS)
- re.compile(RE_PC_VARIABLES)
+ self.__varFinder = re.compile(RE_PC_VARIABLES)
def read(self, parameter, expand_vars=True):
"""Returns the parameters value.
@@ -56,7 +55,7 @@
def __expandVars(self):
while True:
- pvars = set(re.findall(RE_PC_VARIABLES, self.__val))
+ pvars = set(self.__varFinder.findall(self.__val))
pvars_len = len(pvars)
if pvars_len < 1:
break