* 'vmm'
authorPascal Volk <neverseen@users.sourceforge.net>
Wed, 06 Aug 2008 22:11:17 +0000
changeset 40 ab0748a5da9a
parent 39 8dcf739fc97e
child 41 fbcb7e314510
* 'vmm' - _getOrder() Respects now vmm.cfg/maildir/diskusage settings * 'VirtualMailManager/VirtualMailManager.py' - Adds a warning if a directory not exists + VirtualMailManager.__getDiskUsage() + VirtualMailManager.__maildirdelete() + VirtualMailManager.__domdirdelete() - Implemented + VirtualMailManager.__isdir() + VirtualMailManager.cfgGetBoolean() + VirtualMailManager.cfgGetInt() + VirtualMailManager.cfgGetString() * 'po/de.po' * 'po/vmm.pot' - updated
ChangeLog
VirtualMailManager/VirtualMailManager.py
po/de.po
po/vmm.pot
vmm
--- a/ChangeLog	Tue Jun 17 00:37:23 2008 +0000
+++ b/ChangeLog	Wed Aug 06 22:11:17 2008 +0000
@@ -1,4 +1,21 @@
 === 0.0.0 ===
+2008-08-06  Pascal Volk  <neverseen@users.sourceforge.net>
+
+	* vmm (_getOrder):
+		Respect vmm.cfg/maildir/diskusage settings
+	* VirtualMailManager/VirtualMailManager.py:
+		Adds a warning if a directory not exists:
+		  VirtualMailManager.__getDiskUsage()
+		  VirtualMailManager.__maildirdelete()
+		  VirtualMailManager.__domdirdelete()
+		Implemented:
+		  VirtualMailManager.__isdir()
+		  VirtualMailManager.cfgGetBoolean()
+		  VirtualMailManager.cfgGetInt()
+		  VirtualMailManager.cfgGetString()
+	* po/vmm.pot, po/de.po:
+		Updated
+
 2008-05-25  Pascal Volk  <neverseen@users.sourceforge.net>
 
 	* VirtualMailManager/VirtualMailManager.py (VirtualMailManager):
--- a/VirtualMailManager/VirtualMailManager.py	Tue Jun 17 00:37:23 2008 +0000
+++ b/VirtualMailManager/VirtualMailManager.py	Wed Aug 06 22:11:17 2008 +0000
@@ -247,8 +247,17 @@
         Keyword arguments:
         directory -- the directory to summarize recursively disk usage for
         """
-        return Popen([self.__Cfg.get('bin', 'du'), "-hs", directory],
+        if self.__isdir(directory):
+            return Popen([self.__Cfg.get('bin', 'du'), "-hs", directory],
                 stdout=PIPE).communicate()[0].split('\t')[0]
+        else:
+            return 0
+
+    def __isdir(self, directory):
+        isdir = os.path.isdir(directory)
+        if not isdir:
+            self.__warnings.append(_('No such directory: %s') % directory)
+        return isdir
 
     def __makedir(self, directory, mode=None, uid=None, gid=None):
         if mode is None:
@@ -316,9 +325,14 @@
                            _('FATAL: owner/group mismatch in maildir detected'),
                            ERR.MAILDIR_PERM_MISMATCH))
                     rmtree(maildir, ignore_errors=True)
+                else:
+                    self.__warnings.append(_('No such directory: %s/%s') %
+                            (domdir,uid))
 
     def __domdirdelete(self, domdir, gid):
         if gid > 0:
+            if not self.__isdir(domdir):
+                return
             basedir = '%s' % self.__Cfg.get('domdir', 'base')
             domdirdirs = domdir.replace(basedir+'/', '').split('/')
             if basedir.count('..') or domdir.count('..'):
@@ -402,6 +416,15 @@
         """Returns a list with all available warnings."""
         return self.__warnings
 
+    def cfgGetBoolean(self, section, option):
+        return self.__Cfg.getboolean(section, option)
+
+    def cfgGetInt(self, section, option):
+        return self.__Cfg.getint(section, option)
+
+    def cfgGetString(self, section, option):
+        return self.__Cfg.get(section, option)
+
     def setupIsDone(self):
         """Checks if vmm is configured, returns bool"""
         try:
--- a/po/de.po	Tue Jun 17 00:37:23 2008 +0000
+++ b/po/de.po	Wed Aug 06 22:11:17 2008 +0000
@@ -5,8 +5,8 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: vmm 0.4\n"
-"POT-Creation-Date: 2008-06-11 06:25+CEST\n"
-"PO-Revision-Date: 2008-06-11 06:30+0200\n"
+"POT-Creation-Date: 2008-08-06 23:07+CEST\n"
+"PO-Revision-Date: 2008-06-11 23:09+0200\n"
 "Last-Translator: Pascal Volk <p.volk@veb-it.de>\n"
 "Language-Team: German\n"
 "MIME-Version: 1.0\n"
@@ -30,7 +30,7 @@
 #: VirtualMailManager/Account.py:99 VirtualMailManager/Account.py:156
 #: VirtualMailManager/Account.py:183 VirtualMailManager/Account.py:211
 #: VirtualMailManager/Account.py:230
-#: VirtualMailManager/VirtualMailManager.py:554
+#: VirtualMailManager/VirtualMailManager.py:577
 msgid "Account doesn't exists"
 msgstr "Der Account existiert nicht"
 
@@ -203,23 +203,31 @@
 msgid "Sorry, passwords do not match"
 msgstr "Entschuldigung, die Passwörter stimmen nicht überein"
 
-#: VirtualMailManager/VirtualMailManager.py:308
+#: VirtualMailManager/VirtualMailManager.py:259
+msgid "No such directory: %s"
+msgstr "Verzeichnis nicht gefunden: %s"
+
+#: VirtualMailManager/VirtualMailManager.py:317
 msgid "FATAL: \"..\" in maildir path detected."
 msgstr "FATAL: \"..\" im Pfad zum Maildir entdeckt."
 
-#: VirtualMailManager/VirtualMailManager.py:316
+#: VirtualMailManager/VirtualMailManager.py:325
 msgid "FATAL: owner/group mismatch in maildir detected"
 msgstr "FATAL: Maildir gehört dem/der falschen Benutzer/Gruppe."
 
-#: VirtualMailManager/VirtualMailManager.py:326
+#: VirtualMailManager/VirtualMailManager.py:329
+msgid "No such directory: %s/%s"
+msgstr "Verzeichnis nicht gefunden: %s/%s"
+
+#: VirtualMailManager/VirtualMailManager.py:340
 msgid "FATAL: \"..\" in domain directory path detected."
 msgstr "FATAL: \"..\" im Pfad zum Domain-Verzeichnis entdeckt."
 
-#: VirtualMailManager/VirtualMailManager.py:332
+#: VirtualMailManager/VirtualMailManager.py:346
 msgid "FATAL: group mismatch in domain directory detected"
 msgstr "FATAL: Domain-Verzeichnis gehört der falschen Gruppe"
 
-#: VirtualMailManager/VirtualMailManager.py:410
+#: VirtualMailManager/VirtualMailManager.py:433
 msgid ""
 "Configurtion error: \"%s\"\n"
 "(in section \"connfig\", option \"done\")'\n"
@@ -229,20 +237,20 @@
 "(im Abschnitt \"connfig\", Option \"done\")'\n"
 "Siehe auch: vmm.cfg(5)\n"
 
-#: VirtualMailManager/VirtualMailManager.py:429
+#: VirtualMailManager/VirtualMailManager.py:452
 msgid "Invalid section: '%s'"
 msgstr "Ungültiger Abschnitt: '%s'"
 
-#: VirtualMailManager/VirtualMailManager.py:443
-#: VirtualMailManager/VirtualMailManager.py:453
+#: VirtualMailManager/VirtualMailManager.py:466
+#: VirtualMailManager/VirtualMailManager.py:476
 msgid "Invalid argument: '%s'"
 msgstr "Ungültiges Argument: '%s'"
 
-#: VirtualMailManager/VirtualMailManager.py:482
+#: VirtualMailManager/VirtualMailManager.py:505
 msgid "Invalid argument"
 msgstr "Ungültiges Argument"
 
-#: VirtualMailManager/VirtualMailManager.py:500
+#: VirtualMailManager/VirtualMailManager.py:523
 msgid "The pattern '%s' contains invalid characters."
 msgstr "Das Muster '%s' enthält ungültige Zeichen."
 
@@ -258,11 +266,11 @@
 "  Unterbefehl           Objekt           args (* = optional)\n"
 "\n"
 
-#: vmm:61 vmm:70 vmm:307 vmm:357
+#: vmm:61 vmm:70 vmm:305 vmm:355
 msgid "Error"
 msgstr "Fehler"
 
-#: vmm:80 vmm:354
+#: vmm:80 vmm:352
 msgid "Ouch"
 msgstr "Autsch"
 
@@ -314,39 +322,39 @@
 msgid "Missing new transport."
 msgstr "Neuer Transport fehlt."
 
-#: vmm:192 vmm:202 vmm:208 vmm:232 vmm:240 vmm:248
+#: vmm:192 vmm:201 vmm:207 vmm:231 vmm:239 vmm:247
 msgid "Missing e-mail address."
 msgstr "E-Mail-Adresse fehlt."
 
-#: vmm:216
+#: vmm:215
 msgid "Missing e-mail address and users name."
 msgstr "E-Mail-Adresse und der Name des Benutzers fehlen."
 
-#: vmm:218
+#: vmm:217
 msgid "Missing users name."
 msgstr "Name des Benutzers fehlt."
 
-#: vmm:224
+#: vmm:223
 msgid "Missing e-mail address and transport."
 msgstr "E-Mail-Adresse und Transport fehlen."
 
-#: vmm:226
+#: vmm:225
 msgid "Missing transport."
 msgstr "Transport fehlt."
 
-#: vmm:258
+#: vmm:256
 msgid "Missing alias address and destination."
 msgstr "Alias- und Ziel-Adresse fehlen."
 
-#: vmm:264 vmm:270
+#: vmm:262 vmm:268
 msgid "Missing alias address"
 msgstr "Alias-Adresse fehlt."
 
-#: vmm:278
+#: vmm:276
 msgid "Missing userid"
 msgstr "Keine UID angegeben."
 
-#: vmm:290
+#: vmm:288
 msgid ""
 "\n"
 "Warnings:"
@@ -354,6 +362,6 @@
 "\n"
 "Warnungen:"
 
-#: vmm:351
+#: vmm:349
 msgid "Unknown subcommand"
 msgstr "Unbekannter Unterbefehl"
--- a/po/vmm.pot	Tue Jun 17 00:37:23 2008 +0000
+++ b/po/vmm.pot	Wed Aug 06 22:11:17 2008 +0000
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2008-06-11 06:25+CEST\n"
+"POT-Creation-Date: 2008-08-06 23:07+CEST\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"
@@ -30,7 +30,7 @@
 #: VirtualMailManager/Account.py:99 VirtualMailManager/Account.py:156
 #: VirtualMailManager/Account.py:183 VirtualMailManager/Account.py:211
 #: VirtualMailManager/Account.py:230
-#: VirtualMailManager/VirtualMailManager.py:554
+#: VirtualMailManager/VirtualMailManager.py:577
 msgid "Account doesn't exists"
 msgstr ""
 
@@ -201,43 +201,51 @@
 msgid "Sorry, passwords do not match"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:308
+#: VirtualMailManager/VirtualMailManager.py:259
+msgid "No such directory: %s"
+msgstr ""
+
+#: VirtualMailManager/VirtualMailManager.py:317
 msgid "FATAL: \"..\" in maildir path detected."
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:316
+#: VirtualMailManager/VirtualMailManager.py:325
 msgid "FATAL: owner/group mismatch in maildir detected"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:326
+#: VirtualMailManager/VirtualMailManager.py:329
+msgid "No such directory: %s/%s"
+msgstr ""
+
+#: VirtualMailManager/VirtualMailManager.py:340
 msgid "FATAL: \"..\" in domain directory path detected."
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:332
+#: VirtualMailManager/VirtualMailManager.py:346
 msgid "FATAL: group mismatch in domain directory detected"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:410
+#: VirtualMailManager/VirtualMailManager.py:433
 msgid ""
 "Configurtion error: \"%s\"\n"
 "(in section \"connfig\", option \"done\")'\n"
 "see also: vmm.cfg(5)\n"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:429
+#: VirtualMailManager/VirtualMailManager.py:452
 msgid "Invalid section: '%s'"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:443
-#: VirtualMailManager/VirtualMailManager.py:453
+#: VirtualMailManager/VirtualMailManager.py:466
+#: VirtualMailManager/VirtualMailManager.py:476
 msgid "Invalid argument: '%s'"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:482
+#: VirtualMailManager/VirtualMailManager.py:505
 msgid "Invalid argument"
 msgstr ""
 
-#: VirtualMailManager/VirtualMailManager.py:500
+#: VirtualMailManager/VirtualMailManager.py:523
 msgid "The pattern '%s' contains invalid characters."
 msgstr ""
 
@@ -249,11 +257,11 @@
 "\n"
 msgstr ""
 
-#: vmm:61 vmm:70 vmm:307 vmm:357
+#: vmm:61 vmm:70 vmm:305 vmm:355
 msgid "Error"
 msgstr ""
 
-#: vmm:80 vmm:354
+#: vmm:80 vmm:352
 msgid "Ouch"
 msgstr ""
 
@@ -305,45 +313,45 @@
 msgid "Missing new transport."
 msgstr ""
 
-#: vmm:192 vmm:202 vmm:208 vmm:232 vmm:240 vmm:248
+#: vmm:192 vmm:201 vmm:207 vmm:231 vmm:239 vmm:247
 msgid "Missing e-mail address."
 msgstr ""
 
-#: vmm:216
+#: vmm:215
 msgid "Missing e-mail address and users name."
 msgstr ""
 
-#: vmm:218
+#: vmm:217
 msgid "Missing users name."
 msgstr ""
 
-#: vmm:224
+#: vmm:223
 msgid "Missing e-mail address and transport."
 msgstr ""
 
-#: vmm:226
+#: vmm:225
 msgid "Missing transport."
 msgstr ""
 
-#: vmm:258
+#: vmm:256
 msgid "Missing alias address and destination."
 msgstr ""
 
-#: vmm:264 vmm:270
+#: vmm:262 vmm:268
 msgid "Missing alias address"
 msgstr ""
 
-#: vmm:278
+#: vmm:276
 msgid "Missing userid"
 msgstr ""
 
-#: vmm:290
+#: vmm:288
 msgid ""
 "\n"
 "Warnings:"
 msgstr ""
 
-#: vmm:351
+#: vmm:349
 msgid "Unknown subcommand"
 msgstr ""
 
--- a/vmm	Tue Jun 17 00:37:23 2008 +0000
+++ b/vmm	Wed Aug 06 22:11:17 2008 +0000
@@ -90,14 +90,14 @@
         order = (('domainname', 0), ('gid', 1), ('transport', 0),
                 ('domaindir', 0), ('accounts', 0), ('aliases', 0))
     elif sys.argv[1] in ['ui', 'userinfo']:
-        if argc == 3:
+        if argc == 4 or vmm.cfgGetBoolean('maildir', 'diskusage'):
+            order = (('address', 0), ('name', 0), ('uid', 1), ('gid', 1),
+                    ('transport', 0), ('maildir', 0), ('disk usage', 0),
+                    ('smtp', 1), ('pop3', 1), ('imap', 1), ('managesieve', 1))
+        else:
             order = (('address', 0), ('name', 0), ('uid', 1), ('gid', 1),
                     ('transport', 0), ('maildir', 0), ('smtp', 1), ('pop3', 1),
                     ('imap', 1), ('managesieve', 1))
-        else:
-            order = (('address', 0), ('name', 0), ('uid', 1), ('gid', 1),
-                    ('transport', 0), ('maildir', 0), ('disk usage', 0),
-                    ('smtp', 1), ('pop3', 1), ('imap', 1), ('managesieve', 1))
     elif sys.argv[1] in ['gu', 'getuser']:
         order = (('uid', 1), ('gid', 1), ('address', 0))
     return order