# HG changeset patch # User Pascal Volk # Date 1221595389 0 # Node ID f9090d1a0730eb8ef71914d2cc43f5481dce7b54 # Parent e43e4e7e9ec0b13a61e3c5c0c8b8c3b1ab4a8646 * 'VirtualMailManager/EmailAddress.py' * 'VirtualMailManager/MailLocation.py' * 'VirtualMailManager/VirtualMailManager.py' * 'VirtualMailManager/ext/Postconf.py' - Removed wrong placed re.compile() calls diff -r e43e4e7e9ec0 -r f9090d1a0730 VirtualMailManager/EmailAddress.py --- 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}, diff -r e43e4e7e9ec0 -r f9090d1a0730 VirtualMailManager/MailLocation.py --- 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() diff -r e43e4e7e9ec0 -r f9090d1a0730 VirtualMailManager/VirtualMailManager.py --- 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.") % diff -r e43e4e7e9ec0 -r f9090d1a0730 VirtualMailManager/ext/Postconf.py --- 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