* 'VirtualMailManager/VirtualMailManager.py'
authorPascal Volk <neverseen@users.sourceforge.net>
Wed, 27 Aug 2008 20:42:41 +0000
changeset 69 0c124160a991
parent 68 7ae95b9938c4
child 70 a3663ad491bf
* 'VirtualMailManager/VirtualMailManager.py' - Moved unused RE_MAILLOCATION to VirtualMailManager/MailLocation.py * 'VirtualMailManager/MailLocation.py' - MailLocation.__init__() checks 'maillocation' for validity if given * 'VirtualMailManager/Config.py' - Overwritten ConfigParser.get() -> string as Config.get() -> unicode * 'po/de.po' * 'po/vmm.pot' - updated
VirtualMailManager/Config.py
VirtualMailManager/MailLocation.py
VirtualMailManager/VirtualMailManager.py
po/de.po
po/vmm.pot
--- a/VirtualMailManager/Config.py	Wed Aug 27 04:52:32 2008 +0000
+++ b/VirtualMailManager/Config.py	Wed Aug 27 20:42:41 2008 +0000
@@ -110,6 +110,10 @@
         """Return a list with all configurable sections."""
         return self.__VMMsections[:-1]
 
+    def get(self, section, option, raw=False, vars=None):
+        return unicode(ConfigParser.get(self, section, option, raw, vars),
+                ENCODING, 'replace')
+
     def configure(self, sections):
         """Interactive method for configuring all options in the given section
 
--- a/VirtualMailManager/MailLocation.py	Wed Aug 27 04:52:32 2008 +0000
+++ b/VirtualMailManager/MailLocation.py	Wed Aug 27 20:42:41 2008 +0000
@@ -14,9 +14,13 @@
 __revision__ = 'rev '+'$Rev$'.split()[1]
 __date__ = '$Date$'.split()[1]
 
+import re
+
 from Exceptions import VMMMailLocationException as MLE
 import constants.ERROR as ERR
 
+RE_MAILLOCATION = """^[\w]{1,20}$"""
+
 class MailLocation:
     """A wrapper class thats provide access to the maillocation table"""
     def __init__(self, dbh, mid=None, maillocation=None):
@@ -40,8 +44,15 @@
                 raise MLE(_('mid must be an int/long.'), ERR.MAILLOCATION_INIT)
             self._loadByID()
         else:
-            self.__maillocation = maillocation
-            self._loadByName()
+            re.compile(RE_MAILLOCATION)
+            if re.match(RE_MAILLOCATION, maillocation):
+                self.__maillocation = maillocation
+                self._loadByName()
+            else:
+                raise MLE(
+                    _(u'Invalid folder name »%s«, it may consist only of\n\
+1 - 20 single byte characters (A-Z, a-z, 0-9 and _).') % maillocation,
+                        ERR.MAILLOCATION_INIT)
 
     def _loadByID(self):
         dbc = self._dbh.cursor()
--- a/VirtualMailManager/VirtualMailManager.py	Wed Aug 27 04:52:32 2008 +0000
+++ b/VirtualMailManager/VirtualMailManager.py	Wed Aug 27 20:42:41 2008 +0000
@@ -36,7 +36,6 @@
 RE_DOMAIN = """^(?:[a-z0-9-]{1,63}\.){1,}[a-z]{2,6}$"""
 RE_DOMAIN_SRCH = """^[a-z0-9-\.]+$"""
 RE_LOCALPART = """[^\w!#$%&'\*\+-\.\/=?^_`{\|}~]"""
-RE_MAILLOCATION = """^[\w]{1,20}$"""
 RE_MBOX_NAMES = """^[\x20-\x25\x27-\x7E]*$"""
 
 class VirtualMailManager:
--- a/po/de.po	Wed Aug 27 04:52:32 2008 +0000
+++ b/po/de.po	Wed Aug 27 20:42:41 2008 +0000
@@ -6,8 +6,8 @@
 msgstr ""
 "Project-Id-Version: vmm 0.5\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-08-25 20:03+0200\n"
-"PO-Revision-Date: 2008-08-25 22:31+0200\n"
+"POT-Creation-Date: 2008-08-27 21:50+0200\n"
+"PO-Revision-Date: 2008-08-27 22:30+0200\n"
 "Last-Translator: Pascal Volk <p.volk@veb-it.de>\n"
 "Language-Team: German\n"
 "MIME-Version: 1.0\n"
@@ -32,39 +32,39 @@
 msgid "Unknown service »%s«."
 msgstr "Unbekannter Service »%s«."
 
-#: VirtualMailManager/Account.py:93 VirtualMailManager/Account.py:157
-#: VirtualMailManager/Account.py:184 VirtualMailManager/Account.py:205
+#: VirtualMailManager/Account.py:93 VirtualMailManager/Account.py:159
+#: VirtualMailManager/Account.py:186 VirtualMailManager/Account.py:207
 #, python-format
 msgid "The account »%s« doesn't exists."
 msgstr "Der Account »%s« existiert nicht."
 
-#: VirtualMailManager/Account.py:152
+#: VirtualMailManager/Account.py:154
 #, python-format
 msgid "The account »%s« already exists."
 msgstr "Der Account »%s« existiert bereits."
 
-#: VirtualMailManager/Account.py:192
+#: VirtualMailManager/Account.py:194
 msgid "enabled"
 msgstr "aktiviert"
 
-#: VirtualMailManager/Account.py:194
+#: VirtualMailManager/Account.py:196
 msgid "disabled"
 msgstr "deaktiviert"
 
-#: VirtualMailManager/Account.py:228
+#: VirtualMailManager/Account.py:229
 #, python-format
 msgid "There are %(count)d aliases with the destination address »%(address)s«."
 msgstr "Es gibt %(count)d Alias(e) mit der Zieladresse »%(address)s«."
 
-#: VirtualMailManager/Account.py:236
+#: VirtualMailManager/Account.py:237
 msgid "uid must be an int/long."
 msgstr "Die UID muss eine Ganzzahl sein."
 
-#: VirtualMailManager/Account.py:238
+#: VirtualMailManager/Account.py:239
 msgid "uid must be greater than 0."
 msgstr "Die UID muss größer als 0 sein."
 
-#: VirtualMailManager/Account.py:246
+#: VirtualMailManager/Account.py:247
 #, python-format
 msgid "There is no account with the UID »%d«."
 msgstr "Es existiert kein Account mit der UID »%d«."
@@ -121,22 +121,22 @@
 msgid "The alias domain »%s« doesn't exist yet."
 msgstr "Die Alias-Domain »%s« existiert noch nicht."
 
-#: VirtualMailManager/Config.py:101
+#: VirtualMailManager/Config.py:102
 #, python-format
 msgid "missing section: %s\n"
 msgstr "Fehlender Abschnitt: %s\n"
 
-#: VirtualMailManager/Config.py:103
+#: VirtualMailManager/Config.py:104
 #, python-format
 msgid "missing options in section %s:\n"
 msgstr "Fehlende Optionen im Abschnitt %s:\n"
 
-#: VirtualMailManager/Config.py:130
+#: VirtualMailManager/Config.py:135
 #, python-format
 msgid "* Config section: »%s«"
 msgstr "* Konfigurations Abschnitt: »%s«"
 
-#: VirtualMailManager/Config.py:133
+#: VirtualMailManager/Config.py:138
 #, python-format
 msgid "Enter new value for option %(opt)s [%(val)s]: "
 msgstr "Neuer Wert für Option %(opt)s [%(val)s]: "
@@ -163,15 +163,24 @@
 msgid "The domain »%s« already exists."
 msgstr "Die Domain »%s« existiert bereits."
 
-#: VirtualMailManager/MailLocation.py:34
+#: VirtualMailManager/MailLocation.py:38
 msgid "Either mid or maillocation must be specified."
 msgstr "Entweder mid oder maillocation muss angegeben werden."
 
-#: VirtualMailManager/MailLocation.py:40
+#: VirtualMailManager/MailLocation.py:44
 msgid "mid must be an int/long."
 msgstr "Die MID muss eine Ganzzahl sein."
 
-#: VirtualMailManager/MailLocation.py:55
+#: VirtualMailManager/MailLocation.py:53
+#, python-format
+msgid ""
+"Invalid folder name »%s«, it may consist only of\n"
+"1 - 20 single byte characters (A-Z, a-z, 0-9 and _)."
+msgstr ""
+"Unzulässiger Verzeichnisname »%s«, dieser darf nur aus\n"
+"1 - 20 Einzelbytezeichen (A-Z, a-z, 0-9 und _) bestehen."
+
+#: VirtualMailManager/MailLocation.py:66
 msgid "Unknown mid specified."
 msgstr "Unbekannte MID angegeben."
 
@@ -290,28 +299,28 @@
 msgstr "Entschuldigung, die Passwörter stimmen nicht überein"
 
 #: VirtualMailManager/VirtualMailManager.py:252
-#: VirtualMailManager/VirtualMailManager.py:322
+#: VirtualMailManager/VirtualMailManager.py:340
 #, python-format
 msgid "No such directory: %s"
 msgstr "Verzeichnis nicht gefunden: %s"
 
-#: VirtualMailManager/VirtualMailManager.py:310
+#: VirtualMailManager/VirtualMailManager.py:328
 msgid "Found \"..\" in home directory path."
 msgstr "\"..\" im Pfad zum Benutzerverzeichnis entdeckt."
 
-#: VirtualMailManager/VirtualMailManager.py:318
+#: VirtualMailManager/VirtualMailManager.py:336
 msgid "Owner/group mismatch in home directory detected."
 msgstr "Benutzerverzeichnis gehört dem/der falschen Benutzer/Gruppe."
 
-#: VirtualMailManager/VirtualMailManager.py:333
+#: VirtualMailManager/VirtualMailManager.py:351
 msgid "FATAL: \"..\" in domain directory path detected."
 msgstr "FATAL: \"..\" im Pfad zum Domain-Verzeichnis entdeckt."
 
-#: VirtualMailManager/VirtualMailManager.py:339
+#: VirtualMailManager/VirtualMailManager.py:357
 msgid "FATAL: group mismatch in domain directory detected"
 msgstr "FATAL: Domain-Verzeichnis gehört der falschen Gruppe"
 
-#: VirtualMailManager/VirtualMailManager.py:426
+#: VirtualMailManager/VirtualMailManager.py:444
 #, python-format
 msgid ""
 "Configurtion error: \"%s\"\n"
@@ -320,24 +329,24 @@
 "Konfigurations Fehler: \"%s\"\n"
 "(im Abschnitt \"connfig\", Option \"done\") Siehe auch: vmm.cfg(5)\n"
 
-#: VirtualMailManager/VirtualMailManager.py:446
+#: VirtualMailManager/VirtualMailManager.py:464
 #, python-format
 msgid "Invalid section: '%s'"
 msgstr "Ungültiger Abschnitt: '%s'"
 
-#: VirtualMailManager/VirtualMailManager.py:456
+#: VirtualMailManager/VirtualMailManager.py:474
 #, python-format
 msgid "Invalid argument: '%s'"
 msgstr "Ungültiges Argument: '%s'"
 
-#: VirtualMailManager/VirtualMailManager.py:466
-#: VirtualMailManager/VirtualMailManager.py:485
-#: VirtualMailManager/VirtualMailManager.py:576
+#: VirtualMailManager/VirtualMailManager.py:484
+#: VirtualMailManager/VirtualMailManager.py:503
+#: VirtualMailManager/VirtualMailManager.py:594
 #, python-format
 msgid "Invalid argument: »%s«"
 msgstr "Ungültiges Argument: »%s«"
 
-#: VirtualMailManager/VirtualMailManager.py:489
+#: VirtualMailManager/VirtualMailManager.py:507
 msgid ""
 "The keyword »detailed« is deprecated and will be removed in a future "
 "release.\n"
@@ -347,12 +356,12 @@
 "    Version entfernt werden.\n"
 "    Verwenden Sie bitte das Schlüsselwort »full«, um alle Details zu erhalten."
 
-#: VirtualMailManager/VirtualMailManager.py:553
+#: VirtualMailManager/VirtualMailManager.py:571
 #, python-format
 msgid "The pattern »%s« contains invalid characters."
 msgstr "Das Muster »%s« enthält ungültige Zeichen."
 
-#: VirtualMailManager/VirtualMailManager.py:588
+#: VirtualMailManager/VirtualMailManager.py:606
 #, python-format
 msgid ""
 "The account has been successfully deleted from the database.\n"
@@ -365,7 +374,7 @@
 "    »%(directory)s«\n"
 "    Grund: %(raeson)s"
 
-#: VirtualMailManager/VirtualMailManager.py:620
+#: VirtualMailManager/VirtualMailManager.py:638
 msgid "Account doesn't exists"
 msgstr "Der Account existiert nicht"
 
--- a/po/vmm.pot	Wed Aug 27 04:52:32 2008 +0000
+++ b/po/vmm.pot	Wed Aug 27 20:42:41 2008 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: vmm 0.5\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-08-25 20:03+0200\n"
+"POT-Creation-Date: 2008-08-27 21:50+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -33,39 +33,39 @@
 msgid "Unknown service »%s«."
 msgstr ""
 
-#: VirtualMailManager/Account.py:93 VirtualMailManager/Account.py:157
-#: VirtualMailManager/Account.py:184 VirtualMailManager/Account.py:205
+#: VirtualMailManager/Account.py:93 VirtualMailManager/Account.py:159
+#: VirtualMailManager/Account.py:186 VirtualMailManager/Account.py:207
 #, python-format
 msgid "The account »%s« doesn't exists."
 msgstr ""
 
-#: VirtualMailManager/Account.py:152
+#: VirtualMailManager/Account.py:154
 #, python-format
 msgid "The account »%s« already exists."
 msgstr ""
 
-#: VirtualMailManager/Account.py:192
+#: VirtualMailManager/Account.py:194
 msgid "enabled"
 msgstr ""
 
-#: VirtualMailManager/Account.py:194
+#: VirtualMailManager/Account.py:196
 msgid "disabled"
 msgstr ""
 
-#: VirtualMailManager/Account.py:228
+#: VirtualMailManager/Account.py:229
 #, python-format
 msgid "There are %(count)d aliases with the destination address »%(address)s«."
 msgstr ""
 
-#: VirtualMailManager/Account.py:236
+#: VirtualMailManager/Account.py:237
 msgid "uid must be an int/long."
 msgstr ""
 
-#: VirtualMailManager/Account.py:238
+#: VirtualMailManager/Account.py:239
 msgid "uid must be greater than 0."
 msgstr ""
 
-#: VirtualMailManager/Account.py:246
+#: VirtualMailManager/Account.py:247
 #, python-format
 msgid "There is no account with the UID »%d«."
 msgstr ""
@@ -122,22 +122,22 @@
 msgid "The alias domain »%s« doesn't exist yet."
 msgstr ""
 
-#: VirtualMailManager/Config.py:101
+#: VirtualMailManager/Config.py:102
 #, python-format
 msgid "missing section: %s\n"
 msgstr ""
 
-#: VirtualMailManager/Config.py:103
+#: VirtualMailManager/Config.py:104
 #, python-format
 msgid "missing options in section %s:\n"
 msgstr ""
 
-#: VirtualMailManager/Config.py:130
+#: VirtualMailManager/Config.py:135
 #, python-format
 msgid "* Config section: »%s«"
 msgstr ""
 
-#: VirtualMailManager/Config.py:133
+#: VirtualMailManager/Config.py:138
 #, python-format
 msgid "Enter new value for option %(opt)s [%(val)s]: "
 msgstr ""
@@ -164,15 +164,22 @@
 msgid "The domain »%s« already exists."
 msgstr ""
 
-#: VirtualMailManager/MailLocation.py:34
+#: VirtualMailManager/MailLocation.py:38
 msgid "Either mid or maillocation must be specified."
 msgstr ""
 
-#: VirtualMailManager/MailLocation.py:40
+#: VirtualMailManager/MailLocation.py:44
 msgid "mid must be an int/long."
 msgstr ""
 
-#: VirtualMailManager/MailLocation.py:55
+#: VirtualMailManager/MailLocation.py:53
+#, python-format
+msgid ""
+"Invalid folder name »%s«, it may consist only of\n"
+"1 - 20 single byte characters (A-Z, a-z, 0-9 and _)."
+msgstr ""
+
+#: VirtualMailManager/MailLocation.py:66
 msgid "Unknown mid specified."
 msgstr ""
 
@@ -281,64 +288,64 @@
 msgstr ""
 
 #: VirtualMailManager/VirtualMailManager.py:252
-#: VirtualMailManager/VirtualMailManager.py:322
+#: VirtualMailManager/VirtualMailManager.py:340
 #, python-format
 msgid "No such directory: %s"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:310
+#: VirtualMailManager/VirtualMailManager.py:328
 msgid "Found \"..\" in home directory path."
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:318
+#: VirtualMailManager/VirtualMailManager.py:336
 msgid "Owner/group mismatch in home directory detected."
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:333
+#: VirtualMailManager/VirtualMailManager.py:351
 msgid "FATAL: \"..\" in domain directory path detected."
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:339
+#: VirtualMailManager/VirtualMailManager.py:357
 msgid "FATAL: group mismatch in domain directory detected"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:426
+#: VirtualMailManager/VirtualMailManager.py:444
 #, python-format
 msgid ""
 "Configurtion error: \"%s\"\n"
 "(in section \"connfig\", option \"done\") see also: vmm.cfg(5)\n"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:446
+#: VirtualMailManager/VirtualMailManager.py:464
 #, python-format
 msgid "Invalid section: '%s'"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:456
+#: VirtualMailManager/VirtualMailManager.py:474
 #, python-format
 msgid "Invalid argument: '%s'"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:466
-#: VirtualMailManager/VirtualMailManager.py:485
-#: VirtualMailManager/VirtualMailManager.py:576
+#: VirtualMailManager/VirtualMailManager.py:484
+#: VirtualMailManager/VirtualMailManager.py:503
+#: VirtualMailManager/VirtualMailManager.py:594
 #, python-format
 msgid "Invalid argument: »%s«"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:489
+#: VirtualMailManager/VirtualMailManager.py:507
 msgid ""
 "The keyword »detailed« is deprecated and will be removed in a future "
 "release.\n"
 "    Please use the keyword »full« to get full details."
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:553
+#: VirtualMailManager/VirtualMailManager.py:571
 #, python-format
 msgid "The pattern »%s« contains invalid characters."
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:588
+#: VirtualMailManager/VirtualMailManager.py:606
 #, python-format
 msgid ""
 "The account has been successfully deleted from the database.\n"
@@ -347,7 +354,7 @@
 "    Reason: %(raeson)s"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:620
+#: VirtualMailManager/VirtualMailManager.py:638
 msgid "Account doesn't exists"
 msgstr ""