VMM/Handler: import the errors before raising them. v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Mon, 03 May 2010 20:00:06 +0000
branchv0.6.x
changeset 285 d30a94f5aef5
parent 284 ec1966828246
child 286 e2046d47688b
VMM/Handler: import the errors before raising them. Rephrased the 'permission error' message.
VirtualMailManager/Handler.py
--- a/VirtualMailManager/Handler.py	Mon May 03 08:25:26 2010 +0000
+++ b/VirtualMailManager/Handler.py	Mon May 03 20:00:06 2010 +0000
@@ -28,7 +28,8 @@
 from VirtualMailManager.Config import Config as Cfg
 from VirtualMailManager.Domain import Domain, ace2idna, get_gid
 from VirtualMailManager.EmailAddress import EmailAddress
-from VirtualMailManager.errors import VMMError, DomainError
+from VirtualMailManager.errors import \
+     DomainError, NotRootError, PermissionError, VMMError
 from VirtualMailManager.Relocated import Relocated
 from VirtualMailManager.Transport import Transport
 
@@ -94,11 +95,11 @@
         fstat = os.stat(self._cfgFileName)
         fmode = int(oct(fstat.st_mode & 0777))
         if fmode % 100 and fstat.st_uid != fstat.st_gid or \
-            fmode % 10 and fstat.st_uid == fstat.st_gid:
-                raise PermissionError(_(
-                    u'fix permissions (%(perms)s) for ā€œ%(file)sā€\n\
-`chmod 0600 %(file)s` would be great.') % {'file':
-                    self._cfgFileName, 'perms': fmode}, ERR.CONF_WRONGPERM)
+           fmode % 10 and fstat.st_uid == fstat.st_gid:
+            raise PermissionError(_(u"wrong permissions for '%(file)s': \
+%(perms)s\n`chmod 0600 %(file)s` would be great.") %
+                                  {'file': self._cfgFileName, 'perms': fmode},
+                                  ERR.CONF_WRONGPERM)
         else:
             return True