equal
deleted
inserted
replaced
12 import os |
12 import os |
13 import re |
13 import re |
14 from binascii import a2b_base64, b2a_base64 |
14 from binascii import a2b_base64, b2a_base64 |
15 from subprocess import Popen, PIPE |
15 from subprocess import Popen, PIPE |
16 |
16 |
|
17 from VirtualMailManager import ENCODING |
17 from VirtualMailManager.account import Account |
18 from VirtualMailManager.account import Account |
18 from VirtualMailManager.common import lisdir |
19 from VirtualMailManager.common import lisdir |
19 from VirtualMailManager.errors import VMMError |
20 from VirtualMailManager.errors import VMMError |
20 from VirtualMailManager.constants import VMM_ERROR |
21 from VirtualMailManager.constants import VMM_ERROR |
21 |
22 |
255 cmd_args.extend(mailboxes) |
256 cmd_args.extend(mailboxes) |
256 process = Popen(cmd_args, stderr=PIPE) |
257 process = Popen(cmd_args, stderr=PIPE) |
257 stderr = process.communicate()[1] |
258 stderr = process.communicate()[1] |
258 if process.returncode: |
259 if process.returncode: |
259 e_msg = _('Failed to create mailboxes: %r\n') % mailboxes |
260 e_msg = _('Failed to create mailboxes: %r\n') % mailboxes |
260 raise VMMError(e_msg + stderr.strip().decode(), VMM_ERROR) |
261 raise VMMError(e_msg + stderr.strip().decode(ENCODING), VMM_ERROR) |
261 |
262 |
262 def create(self): |
263 def create(self): |
263 """Create a dbox INBOX""" |
264 """Create a dbox INBOX""" |
264 os.mkdir(self._root, cfg_dget('account.directory_mode')) |
265 os.mkdir(self._root, cfg_dget('account.directory_mode')) |
265 os.chown(self._root, self._user.uid, self._user.gid) |
266 os.chown(self._root, self._user.uid, self._user.gid) |