VMM/handler: Handler._make_domain_dir(): Check if the domain v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Wed, 02 Feb 2011 20:45:40 +0000
branchv0.6.x
changeset 380 5aaf2dd6b146
parent 379 7518d927d443
child 381 98223e5c95e0
VMM/handler: Handler._make_domain_dir(): Check if the domain directory exists before calling os.mkdir().
VirtualMailManager/handler.py
--- a/VirtualMailManager/handler.py	Wed Feb 02 19:03:54 2011 +0000
+++ b/VirtualMailManager/handler.py	Wed Feb 02 20:45:40 2011 +0000
@@ -293,6 +293,9 @@
         if not dir_created and not lisdir(hashdir):
             raise VMMError(_(u"'%s' is not a directory.") % hashdir,
                            NO_SUCH_DIRECTORY)
+        if os.path.exists(domain.directory):
+            raise VMMError(_(u"The file/directory '%s' already exists.") %
+                           domdir.directory, VMM_ERROR)
         os.mkdir(os.path.join(hashdir, domdir),
                  self._cfg.dget('domain.directory_mode'))
         os.chown(domain.directory, 0, domain.gid)