This list is closed, nobody may subscribe to it.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(18) |
Feb
(43) |
Mar
(11) |
Apr
(50) |
May
(10) |
Jun
|
Jul
(39) |
Aug
(30) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
(14) |
Feb
(43) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(4) |
Oct
(12) |
Nov
(45) |
Dec
(3) |
| 2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(65) |
May
(2) |
Jun
(19) |
Jul
(6) |
Aug
(19) |
Sep
(23) |
Oct
(11) |
Nov
(21) |
Dec
(16) |
| 2013 |
Jan
(21) |
Feb
(2) |
Mar
(2) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
(4) |
Feb
(34) |
Mar
(10) |
Apr
|
May
|
Jun
(10) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
(3) |
2
(2) |
3
(3) |
4
|
5
|
6
|
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
|
14
|
15
|
16
|
17
|
18
|
19
|
20
|
|
21
(3) |
22
|
23
|
24
|
25
|
26
|
27
|
|
28
|
29
|
30
|
31
|
|
|
|
|
From: <nev...@us...> - 2010-03-21 09:59:37
|
details: http://hg.localdomain.org/vmm/rev/55503d63ba30 changeset: 233:55503d63ba30 user: Pascal Volk date: Sun Mar 21 09:59:05 2010 +0000 description: merged changes from default(8c4df3dd2d2c) diffstat: VirtualMailManager/Handler.py | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diffs (18 lines): diff -r 3c766114d0b9 -r 55503d63ba30 VirtualMailManager/Handler.py --- a/VirtualMailManager/Handler.py Sun Mar 21 09:26:00 2010 +0000 +++ b/VirtualMailManager/Handler.py Sun Mar 21 09:59:05 2010 +0000 @@ -383,9 +383,11 @@ return '{%s}%s' % (self._scheme, self.__pwMD4(password)) elif self._scheme in ['SMD5', 'SSHA', 'CRAM-MD5', 'HMAC-MD5', 'LANMAN', 'NTLM', 'RPA']: - return Popen([self._Cfg.dget('bin.dovecotpw'), - '-s', self._scheme, '-p', password], - stdout=PIPE).communicate()[0][:-1] + cmd_args = [self._Cfg.dget('bin.dovecotpw'), '-s', self._scheme, + '-p', password] + if self._Cfg.dget('misc.dovecot_version') >= 20: + cmd_args.insert(1, 'pw') + return Popen(cmd_args, stdout=PIPE).communicate()[0][:-1] else: return '{%s}%s' % (self._scheme, password) |
|
From: <nev...@us...> - 2010-03-21 09:47:03
|
details: http://hg.localdomain.org/vmm/rev/3c766114d0b9 changeset: 232:3c766114d0b9 user: Pascal Volk date: Sun Mar 21 09:26:00 2010 +0000 description: vmm: minimal cleanups. diffstat: vmm | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diffs (26 lines): diff -r eefbe052a135 -r 3c766114d0b9 vmm --- a/vmm Wed Mar 03 20:54:18 2010 +0000 +++ b/vmm Sun Mar 21 09:26:00 2010 +0000 @@ -381,18 +381,18 @@ usage(EXIT.MISSING_ARGS, _(u'Missing alias address')) try: _printAliases(argv[2].lower(), vmm.aliasInfo(argv[2].lower())) - except VMME.VMMAliasException, e: + except VMME.VMMException, e: if e.code() is ERR.ACCOUNT_EXISTS: w_std(plan_a_b % {'subcommand': u'userinfo', - 'object': argv[2].lower()}) + 'object': argv[2].lower()}) argv[1] = u'ui' # necessary manipulation to get the order user_info() elif e.code() is ERR.RELOCATED_EXISTS: w_std(plan_a_b % {'subcommand': u'relocatedinfo', - 'object': argv[2].lower()}) + 'object': argv[2].lower()}) relocated_info() else: - raise e + raise def alias_delete(): if argc < 3: |
|
From: <nev...@us...> - 2010-03-21 09:18:06
|
details: http://hg.localdomain.org/vmm/rev/8c4df3dd2d2c changeset: 231:8c4df3dd2d2c user: Pascal Volk date: Sun Mar 21 09:17:26 2010 +0000 description: VMM: VirtualMailManager.__pwhash() added support for 'doveadm pw'. dovecotpw was replaced by `doveadm pw` in Dovecot v2.0. To use doveadm instead of dovecotpw use the following settings in vmm.cfg: [bin] dovecotpw = /path/to/doveadm [misc] dovecotvers = 20 diffstat: VirtualMailManager/VirtualMailManager.py | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diffs (17 lines): diff -r 6526072ec709 -r 8c4df3dd2d2c VirtualMailManager/VirtualMailManager.py --- a/VirtualMailManager/VirtualMailManager.py Fri Jan 22 04:22:59 2010 +0000 +++ b/VirtualMailManager/VirtualMailManager.py Sun Mar 21 09:17:26 2010 +0000 @@ -415,8 +415,11 @@ return '{%s}%s' % (self.__scheme, self.__pwMD4(password)) elif self.__scheme in ['SMD5', 'SSHA', 'CRAM-MD5', 'HMAC-MD5', 'LANMAN', 'NTLM', 'RPA']: - return Popen([self.__Cfg.get('bin', 'dovecotpw'), '-s', - self.__scheme,'-p',password],stdout=PIPE).communicate()[0][:-1] + cmd_args = [self.__Cfg.get('bin', 'dovecotpw'), '-s', + self.__scheme, '-p', password] + if self.__Cfg.getint('misc', 'dovecotvers') >= 20: + cmd_args.insert(1, 'pw') + return Popen(cmd_args, stdout=PIPE).communicate()[0][:-1] else: return '{%s}%s' % (self.__scheme, password) |
|
From: <nev...@us...> - 2010-03-03 20:54:36
|
details: http://hg.localdomain.org/vmm/rev/eefbe052a135 changeset: 230:eefbe052a135 user: Pascal Volk date: Wed Mar 03 20:54:18 2010 +0000 description: man: updated configuration manual pages (maildir.* -> mailbox.*). diffstat: man/de/man5/vmm.cfg.5.rst | 40 ++++++++++++++++++++++++++-------------- man/man5/vmm.cfg.5.rst | 39 ++++++++++++++++++++++++++------------- man/substitute_links_5.rst | 1 + 3 files changed, 53 insertions(+), 27 deletions(-) diffs (151 lines): diff -r 0fb2f12648a7 -r eefbe052a135 man/de/man5/vmm.cfg.5.rst --- a/man/de/man5/vmm.cfg.5.rst Wed Mar 03 20:23:18 2010 +0000 +++ b/man/de/man5/vmm.cfg.5.rst Wed Mar 03 20:54:18 2010 +0000 @@ -7,7 +7,7 @@ --------------------------- :Author: Pascal Volk <nev...@us...> -:Date: 2010-02-01 +:Date: 2010-03-03 :Version: vmm-0.6.0 :Manual group: vmm Manual :Manual section: 5 @@ -276,33 +276,45 @@ force_deletion = false -MAILDIR +MAILBOX ------- -In der **maildir**-Sektion werden die für die Maildirs erforderlichen -Optionen festgelegt. +In der **mailbox**-Sektion werden die für die Erstellung von Mailboxen +erforderlichen Optionen festgelegt. Die INBOX wird in jedem Fall erstellt. -.. _maildir.folders: +.. _mailbox.folders: ``folders (Vorgabe: Drafts:Sent:Templates:Trash)`` : *String* - Eine durch Doppelpunkten getrennte Liste mit Verzeichnisnamen, die - innerhalb des Maildirs erstellt werden sollen. Sollen innerhalb des - Maildirs keine Verzeichnisse angelegt werden, ist dieser Optionen ein + Eine durch Doppelpunkten getrennte Liste mit Mailboxnamen die + erstellt werden sollen. (Wird derzeit nur berücksichtigt, wenn + |mailbox.format|_ entweder **maildir** oder **mbox** ist. Sollte das + gewählte Format ein anderes sein, kann Dovecots autocreate Plugin + <http://wiki.dovecot.org/Plugins/Autocreate> verwendet werden.) Sollen + keine zusätzlichen Mailboxen angelegt werden, ist dieser Optionen ein einzelner Doppelpunkt ('**:**') als Wert zuzuweisen. Sollen Verzeichnisse mit Unterverzeichnissen angelegt werden, ist ein einzelner Punkt ('**.**') als Separator zu verwenden. -.. _maildir.name: +.. _mailbox.format: -``name (Vorgabe: Maildir)`` : *String* - Der Standard-Name des Maildir-Verzeichnisses im Verzeichnis des jeweiligen - Anwenders. +``format (Vorgabe: maildir)`` : *String* + Das zu verwendende Format der Mailbox der Benutzer. Abhängig von der + verwendeten Dovecot-Version, stehen bis zu vier Formate zur Verfügung: + + ``maildir`` + seit Dovecot v1.0.0 + ``mbox`` + seit Dovecot v1.0.0 + ``dbox`` + seit Dovecot v1.2.0 + ``mdbox`` + seit Dovecot v2.0.0 Beispiel:: - [maildir] + [mailbox] folders = Drafts:Sent:Templates:Trash:Lists.Dovecot:Lists.Postfix - name = Maildir + format = maildir .. _imap_uft7: diff -r 0fb2f12648a7 -r eefbe052a135 man/man5/vmm.cfg.5.rst --- a/man/man5/vmm.cfg.5.rst Wed Mar 03 20:23:18 2010 +0000 +++ b/man/man5/vmm.cfg.5.rst Wed Mar 03 20:54:18 2010 +0000 @@ -7,7 +7,7 @@ -------------------------- :Author: Pascal Volk <nev...@us...> -:Date: 2010-02-01 +:Date: 2010-03-03 :Version: vmm-0.6.0 :Manual group: vmm Manual :Manual section: 5 @@ -264,31 +264,44 @@ force_deletion = false -MAILDIR +MAILBOX ------- -The **maildir** section is used to specify some default options for new -created Maildirs and folders inside. +The **mailbox** section is used to specify some options for new created +mailboxes in the users home directories. The INBOX will be created always. -.. _maildir.folders: +.. _mailbox.folders: ``folders (default: Drafts:Sent:Templates:Trash)`` : *String* - A colon separated list of folder names, that should be created. If no - folders should be created inside the Maildir, set the value of this option - to a single colon ('**:**'). + A colon separated list of mailboxes that should be created. (Works currently + only if the |mailbox.format|_ is either **maildir** or **mbox**. For other + formats use Dovecot's autocreate plugin + <http://wiki.dovecot.org/Plugins/Autocreate>.) If no additionally mailboxes + should be created, set the value of this option to a single colon ('**:**'). If you want to create folders containing one or more subfolders, separate them with a single dot ('**.**'). -.. _maildir.name: +.. _mailbox.format: -``name (default: Maildir)`` : *String* - Default name of the Maildir folder in users home directories. +``format (default: maildir)`` : *String* + The mailbox format to be used for a user's mailbox. Depending on the used + Dovecot version there are up to four supported formats: + + ``maildir`` + since Dovecot v1.0.0 + ``mbox`` + since Dovecot v1.0.0 + ``dbox`` + since Dovecot v1.2.0 + ``mdbox`` + comes with Dovecot v2.0.0 + Example:: - [maildir] + [mailbox] folders = Drafts:Sent:Templates:Trash:Lists.Dovecot:Lists.Postfix - name = Maildir + format = maildir .. _imap_uft7: diff -r 0fb2f12648a7 -r eefbe052a135 man/substitute_links_5.rst --- a/man/substitute_links_5.rst Wed Mar 03 20:23:18 2010 +0000 +++ b/man/substitute_links_5.rst Wed Mar 03 20:54:18 2010 +0000 @@ -1,6 +1,7 @@ .. Substitutions in section 5 .. |account.password_length| replace:: **password_length** +.. |mailbox.format| replace:: **format** .. |misc.password_scheme| replace:: **misc.password_scheme** .. |vmm configure| replace:: **vmm configure** |
|
From: <nev...@us...> - 2010-03-03 20:23:35
|
details: http://hg.localdomain.org/vmm/rev/0fb2f12648a7 changeset: 229:0fb2f12648a7 user: Pascal Volk date: Wed Mar 03 20:23:18 2010 +0000 description: vmm.cfg: renamed maildir.folders to mailbox.folders. maildir.name was removed. new: mailbox.format, in order to support all mailbox formats from Dovecot. Maildir is the default format. Adjusted VirtualMailManager/Config and update_config.py to the changes mentioned above. diffstat: VirtualMailManager/Config.py | 4 ++-- update_config.py | 4 +++- vmm.cfg | 18 +++++++++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diffs (69 lines): diff -r a7b000ca4ac9 -r 0fb2f12648a7 VirtualMailManager/Config.py --- a/VirtualMailManager/Config.py Wed Mar 03 14:32:30 2010 +0000 +++ b/VirtualMailManager/Config.py Wed Mar 03 20:23:18 2010 +0000 @@ -336,9 +336,9 @@ 'directory_mode': LCO(int, 504, self.getint), 'force_deletion': LCO(bool_t, False, self.getboolean), }, - 'maildir': { + 'mailbox': { 'folders': LCO(str, 'Drafts:Sent:Templates:Trash', self.get), - 'name': LCO(str, 'Maildir', self.get), + 'format': LCO(str, 'maildir', self.get), }, 'misc': { 'base_directory': LCO(str, '/srv/mail', self.get, is_dir), diff -r a7b000ca4ac9 -r 0fb2f12648a7 update_config.py --- a/update_config.py Wed Mar 03 14:32:30 2010 +0000 +++ b/update_config.py Wed Mar 03 20:23:18 2010 +0000 @@ -75,7 +75,7 @@ global had_config had_config = cp.remove_section('config') - add_sections(cp, ('domain', 'account')) + add_sections(cp, ('domain', 'account', 'mailbox')) if cp.has_section('domdir'): for src, dst in (('domdir.mode', 'domain.directory_mode'), ('domdir.delete', 'domain.delete_directory'), @@ -89,10 +89,12 @@ for src, dst in (('maildir.mode', 'account.directory_mode'), ('maildir.diskusage', 'account.disk_usage'), ('maildir.delete', 'account.delete_directory'), + ('maildir.folders', 'mailbox.folders'), ('misc.forcedel', 'domain.force_deletion'), ('misc.passwdscheme', 'misc.password_scheme'), ('misc.dovecotvers', 'misc.dovecot_version')): move_option(cp, src, dst) + cp.remove_section('maildir') # def main(): if __name__ == '__main__': diff -r a7b000ca4ac9 -r 0fb2f12648a7 vmm.cfg --- a/vmm.cfg Wed Mar 03 14:32:30 2010 +0000 +++ b/vmm.cfg Wed Mar 03 20:23:18 2010 +0000 @@ -16,12 +16,20 @@ name = mailsys # -# Maildir folder +# mailbox settings # -[maildir] -; Default name of the Maildir folder (String) -name = Maildir -; A colon separated list of folder names, that should be created (String) +[mailbox] +; The mailbox format to be used for user's mailboxes. (String) +; Depending on the used Dovecot version there are up to four supported formats: +; * maildir - since Dovecot v1.0.0 +; * mbox - since Dovecot v1.0.0 +; * dbox - since Dovecot v1.2.0 +; * mdbox - comes with Dovecot v2.0.0 +format = maildir +; A colon separated list of mailbox names, that should be created (String) +; Works currently only if the format is either 'maildir' or 'mbox' . For +; other formats use Dovecot's Autocreate plugin: +; <http://wiki.dovecot.org/Plugins/Autocreate> ; e.g.: folders = Drafts:Sent:Templates:Trash:Lists.Dovecot:Lists.Postfix folders = Drafts:Sent:Templates:Trash |
|
From: <nev...@us...> - 2010-03-03 14:32:47
|
details: http://hg.localdomain.org/vmm/rev/a7b000ca4ac9 changeset: 228:a7b000ca4ac9 user: Pascal Volk date: Wed Mar 03 14:32:30 2010 +0000 description: VMM/maillocation: MailLocation.__init__(): take a 'format' name, instead of a 'directory' name. - added function known_format() to the module. VMM/Account: Adjusted to above changes. diffstat: VirtualMailManager/Account.py | 10 +++----- VirtualMailManager/maillocation.py | 44 ++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 26 deletions(-) diffs (119 lines): diff -r 87db9f1f95ea -r a7b000ca4ac9 VirtualMailManager/Account.py --- a/VirtualMailManager/Account.py Tue Mar 02 19:24:36 2010 +0000 +++ b/VirtualMailManager/Account.py Wed Mar 03 14:32:30 2010 +0000 @@ -8,8 +8,7 @@ from VirtualMailManager.Domain import Domain from VirtualMailManager.EmailAddress import EmailAddress from VirtualMailManager.errors import AccountError as AccE -from VirtualMailManager.maillocation import MailLocation, MAILDIR_NAME, \ - MBOX_NAME, MDBOX_NAME, SDBOX_NAME +from VirtualMailManager.maillocation import MailLocation, known_format from VirtualMailManager.Transport import Transport @@ -76,12 +75,11 @@ dbc.close() def _prepare(self, maillocation): - if not maillocation.lower() in map(lambda x: x.lower(), (MAILDIR_NAME, - MBOX_NAME, MDBOX_NAME, SDBOX_NAME)): - raise AccE(_(u'Unknown mail_location directory name: %r') % + if not known_format(maillocation): + raise AccE(_(u'Unknown mail_location mailbox format: %r') % maillocation, ERR.UNKNOWN_MAILLOCATION_NAME) self._setID() - self._mid = MailLocation(type_=maillocation).mid + self._mid = MailLocation(format=maillocation).mid def _switchState(self, state, dcvers, service): if not isinstance(state, bool): diff -r 87db9f1f95ea -r a7b000ca4ac9 VirtualMailManager/maillocation.py --- a/VirtualMailManager/maillocation.py Tue Mar 02 19:24:36 2010 +0000 +++ b/VirtualMailManager/maillocation.py Wed Mar 03 14:32:30 2010 +0000 @@ -13,9 +13,8 @@ from VirtualMailManager.pycompat import any -__all__ = ('MailLocation', - 'MAILDIR_ID', 'MBOX_ID', 'MDBOX_ID', 'SDBOX_ID', - 'MAILDIR_NAME', 'MBOX_NAME', 'MDBOX_NAME', 'SDBOX_NAME') +__all__ = ('MailLocation', 'known_format', + 'MAILDIR_ID', 'MBOX_ID', 'MDBOX_ID', 'SDBOX_ID') MAILDIR_ID = 0x1 MBOX_ID = 0x2 @@ -28,20 +27,20 @@ _storage = { MAILDIR_ID: dict(dovecot_version=10, postfix=True, prefix='maildir:', - directory=MAILDIR_NAME), + directory=MAILDIR_NAME, mid=MAILDIR_ID), MBOX_ID: dict(dovecot_version=10, postfix=True, prefix='mbox:', - directory=MBOX_NAME), + directory=MBOX_NAME, mid=MBOX_ID), MDBOX_ID: dict(dovecot_version=20, postfix=False, prefix='mdbox:', - directory=MDBOX_NAME), + directory=MDBOX_NAME, mid=MDBOX_ID), SDBOX_ID: dict(dovecot_version=12, postfix=False, prefix='dbox:', - directory=SDBOX_NAME), + directory=SDBOX_NAME, mid=SDBOX_ID), } -_type_id = { +_format_id = { 'maildir': MAILDIR_ID, - MBOX_NAME: MBOX_ID, - MDBOX_NAME: MDBOX_ID, - SDBOX_NAME: SDBOX_ID, + 'mbox': MBOX_ID, + 'mdbox': MDBOX_ID, + 'dbox': SDBOX_ID, } @@ -49,26 +48,26 @@ """A small class for mail_location relevant information.""" __slots__ = ('_info') - def __init__(self, mid=None, type_=None): + def __init__(self, mid=None, format=None): """Creates a new MailLocation instance. - Either mid or type_ must be specified. + Either a mid or the format must be specified. Keyword arguments: mid -- the id of a mail_location (int) one of the maillocation constants: `MAILDIR_ID`, `MBOX_ID`, `MDBOX_ID` and `SDBOX_ID` - type_ -- the type/mailbox format of the mail_location (str) - one of the maillocation constants: `MAILDIR_NAME`, `MBOX_NAME`, - `MDBOX_NAME` and `SDBOX_NAME` + format -- the mailbox format of the mail_location. One out of: + ``maildir``, ``mbox``, ``dbox`` and ``mdbox``. """ - assert any((mid, type_)) + assert any((mid, format)) if mid: assert isinstance(mid, (int, long)) and mid in _storage self._info = _storage[mid] else: - assert isinstance(type_, basestring) and type_.lower() in _type_id - self._info = _storage[_type_id[type_.lower()]] + assert isinstance(format, basestring) and \ + format.lower() in _format_id + self._info = _storage[_format_id[format.lower()]] def __str__(self): return '%(prefix)s~/%(directory)s' % self._info @@ -102,4 +101,9 @@ @property def mid(self): """The mail_location's unique ID.""" - return _type_id[self._info['directory'].lower()] + return self._info['mid'] + + +def known_format(format): + """Checks if the mailbox *format* is known, returns bool.""" + return format.lower() in _format_id |
|
From: <nev...@us...> - 2010-03-02 19:24:51
|
details: http://hg.localdomain.org/vmm/rev/87db9f1f95ea changeset: 227:87db9f1f95ea user: Pascal Volk date: Tue Mar 02 19:24:36 2010 +0000 description: VMM/Account: Adjusted to changes in maillocation.MailLocation. VMM/maillocation: Class MailLocation added missing property `mid`. Added new error to VMM/constants/ERROR and doc/source/vmm_constants_error diffstat: VirtualMailManager/Account.py | 16 ++++++++++------ VirtualMailManager/constants/ERROR.py | 9 +++++---- VirtualMailManager/maillocation.py | 5 +++++ doc/source/vmm_constants_error.rst | 4 ++++ 4 files changed, 24 insertions(+), 10 deletions(-) diffs (90 lines): diff -r 311eee429f67 -r 87db9f1f95ea VirtualMailManager/Account.py --- a/VirtualMailManager/Account.py Tue Mar 02 17:40:58 2010 +0000 +++ b/VirtualMailManager/Account.py Tue Mar 02 19:24:36 2010 +0000 @@ -8,7 +8,8 @@ from VirtualMailManager.Domain import Domain from VirtualMailManager.EmailAddress import EmailAddress from VirtualMailManager.errors import AccountError as AccE -from VirtualMailManager.MailLocation import MailLocation +from VirtualMailManager.maillocation import MailLocation, MAILDIR_NAME, \ + MBOX_NAME, MDBOX_NAME, SDBOX_NAME from VirtualMailManager.Transport import Transport @@ -75,8 +76,12 @@ dbc.close() def _prepare(self, maillocation): + if not maillocation.lower() in map(lambda x: x.lower(), (MAILDIR_NAME, + MBOX_NAME, MDBOX_NAME, SDBOX_NAME)): + raise AccE(_(u'Unknown mail_location directory name: %r') % + maillocation, ERR.UNKNOWN_MAILLOCATION_NAME) self._setID() - self._mid = MailLocation(self._dbh, maillocation=maillocation).getID() + self._mid = MailLocation(type_=maillocation).mid def _switchState(self, state, dcvers, service): if not isinstance(state, bool): @@ -192,7 +197,7 @@ raise AccE(_(u"The account “%s” doesn't exist.") % self._addr, ERR.NO_SUCH_ACCOUNT) else: - keys = ['name', 'uid', 'gid', 'maildir', 'transport', 'smtp', + keys = ['name', 'uid', 'gid', 'mid', 'transport', 'smtp', 'pop3', 'imap', sieve_col] info = dict(zip(keys, info)) for service in ('smtp', 'pop3', 'imap', sieve_col): @@ -203,9 +208,8 @@ # TP: A service (pop3/imap) isn't enabled/usable for a user info[service] = _('disabled') info['address'] = self._addr - info['maildir'] = '%s/%s/%s' % (self._base, info['uid'], - MailLocation(self._dbh, - mid=info['maildir']).getMailLocation()) + info['home'] = '%s/%s' % (self._base, info['uid']) + info['mail_location'] = MailLocation(mid=info['mid']).mail_location info['transport'] = Transport(self._dbh, tid=info['transport']).transport return info diff -r 311eee429f67 -r 87db9f1f95ea VirtualMailManager/constants/ERROR.py --- a/VirtualMailManager/constants/ERROR.py Tue Mar 02 17:40:58 2010 +0000 +++ b/VirtualMailManager/constants/ERROR.py Tue Mar 02 19:24:36 2010 +0000 @@ -46,7 +46,8 @@ RELOCATED_MISSING_DEST = 61 TRANSPORT_INIT = 62 UNKNOWN_MAILLOCATION_ID = 63 -UNKNOWN_SERVICE = 64 -UNKNOWN_TRANSPORT_ID = 65 -VMM_ERROR = 66 -VMM_TOO_MANY_FAILURES = 67 +UNKNOWN_MAILLOCATION_NAME = 64 +UNKNOWN_SERVICE = 65 +UNKNOWN_TRANSPORT_ID = 66 +VMM_ERROR = 67 +VMM_TOO_MANY_FAILURES = 68 diff -r 311eee429f67 -r 87db9f1f95ea VirtualMailManager/maillocation.py --- a/VirtualMailManager/maillocation.py Tue Mar 02 17:40:58 2010 +0000 +++ b/VirtualMailManager/maillocation.py Tue Mar 02 19:24:36 2010 +0000 @@ -98,3 +98,8 @@ def mail_location(self): """The mail_location, e.g. ``maildir:~/Maildir``""" return self.__str__() + + @property + def mid(self): + """The mail_location's unique ID.""" + return _type_id[self._info['directory'].lower()] diff -r 311eee429f67 -r 87db9f1f95ea doc/source/vmm_constants_error.rst --- a/doc/source/vmm_constants_error.rst Tue Mar 02 17:40:58 2010 +0000 +++ b/doc/source/vmm_constants_error.rst Tue Mar 02 19:24:36 2010 +0000 @@ -214,6 +214,10 @@ There is no Transport entry with the given ID +.. data:: UNKNOWN_MAILLOCATION_NAME + + The given mail_location directory couldn't be accepted + .. data:: VMM_ERROR Internal error |
|
From: <nev...@us...> - 2010-03-02 18:06:54
|
details: http://hg.localdomain.org/vmm/rev/311eee429f67 changeset: 226:311eee429f67 user: Pascal Volk date: Tue Mar 02 17:40:58 2010 +0000 description: VMM/maillocation: rewrote MailLocation class. Renamed MailLocation.py to maillocation.py. diffstat: VirtualMailManager/MailLocation.py | 86 ------------------------------- VirtualMailManager/maillocation.py | 100 +++++++++++++++++++++++++++++++++++++ doc/source/vmm_constants_error.rst | 6 ++ 3 files changed, 106 insertions(+), 86 deletions(-) diffs (221 lines): diff -r a51809f7940b -r 311eee429f67 VirtualMailManager/MailLocation.py --- a/VirtualMailManager/MailLocation.py Mon Mar 01 05:31:43 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -# -*- coding: UTF-8 -*- -# Copyright (c) 2008 - 2010, Pascal Volk -# See COPYING for distribution information. - -"""Virtual Mail Manager's MailLocation class to manage the mail_location -for accounts.""" - -import re - -import VirtualMailManager.constants.ERROR as ERR -from VirtualMailManager.errors import MailLocationError as MLE - -RE_MAILLOCATION = """^\w{1,20}$""" - -class MailLocation(object): - """A wrapper class thats provide access to the maillocation table""" - __slots__ = ('__id', '__maillocation', '_dbh') - def __init__(self, dbh, mid=None, maillocation=None): - """Creates a new MailLocation instance. - - Either mid or maillocation must be specified. - - Keyword arguments: - dbh -- a pyPgSQL.PgSQL.connection - mid -- the id of a maillocation (long) - maillocation -- the value of the maillocation (str) - """ - self._dbh = dbh - if mid is None and maillocation is None: - raise MLE(_('Either mid or maillocation must be specified.'), - ERR.MAILLOCATION_INIT) - elif mid is not None: - try: - self.__id = long(mid) - except ValueError: - raise MLE(_('mid must be an int/long.'), ERR.MAILLOCATION_INIT) - self._loadByID() - else: - 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() - dbc.execute('SELECT maillocation FROM maillocation WHERE mid = %s', - self.__id) - result = dbc.fetchone() - dbc.close() - if result is not None: - self.__maillocation = result[0] - else: - raise MLE(_('Unknown mid specified.'), ERR.UNKNOWN_MAILLOCATION_ID) - - def _loadByName(self): - dbc = self._dbh.cursor() - dbc.execute('SELECT mid FROM maillocation WHERE maillocation = %s', - self.__maillocation) - result = dbc.fetchone() - dbc.close() - if result is not None: - self.__id = result[0] - else: - self._save() - - def _save(self): - dbc = self._dbh.cursor() - dbc.execute("SELECT nextval('maillocation_id')") - self.__id = dbc.fetchone()[0] - dbc.execute('INSERT INTO maillocation(mid,maillocation) VALUES(%s,%s)', - self.__id, self.__maillocation) - self._dbh.commit() - dbc.close() - - def getID(self): - """Returns the unique ID of the maillocation.""" - return self.__id - - def getMailLocation(self): - """Returns the value of maillocation, ex: 'Maildir'""" - return self.__maillocation - diff -r a51809f7940b -r 311eee429f67 VirtualMailManager/maillocation.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VirtualMailManager/maillocation.py Tue Mar 02 17:40:58 2010 +0000 @@ -0,0 +1,100 @@ +# -*- coding: UTF-8 -*- +# Copyright (c) 2008 - 2010, Pascal Volk +# See COPYING for distribution information. + +""" + VirtualMailManager.maillocation + + Virtual Mail Manager's maillocation module to handle Dovecot's + mail_location setting for accounts. + +""" + +from VirtualMailManager.pycompat import any + + +__all__ = ('MailLocation', + 'MAILDIR_ID', 'MBOX_ID', 'MDBOX_ID', 'SDBOX_ID', + 'MAILDIR_NAME', 'MBOX_NAME', 'MDBOX_NAME', 'SDBOX_NAME') + +MAILDIR_ID = 0x1 +MBOX_ID = 0x2 +MDBOX_ID = 0x3 +SDBOX_ID = 0x4 +MAILDIR_NAME = 'Maildir' +MBOX_NAME = 'mail' +MDBOX_NAME = 'mdbox' +SDBOX_NAME = 'dbox' + +_storage = { + MAILDIR_ID: dict(dovecot_version=10, postfix=True, prefix='maildir:', + directory=MAILDIR_NAME), + MBOX_ID: dict(dovecot_version=10, postfix=True, prefix='mbox:', + directory=MBOX_NAME), + MDBOX_ID: dict(dovecot_version=20, postfix=False, prefix='mdbox:', + directory=MDBOX_NAME), + SDBOX_ID: dict(dovecot_version=12, postfix=False, prefix='dbox:', + directory=SDBOX_NAME), +} + +_type_id = { + 'maildir': MAILDIR_ID, + MBOX_NAME: MBOX_ID, + MDBOX_NAME: MDBOX_ID, + SDBOX_NAME: SDBOX_ID, +} + + +class MailLocation(object): + """A small class for mail_location relevant information.""" + __slots__ = ('_info') + + def __init__(self, mid=None, type_=None): + """Creates a new MailLocation instance. + + Either mid or type_ must be specified. + + Keyword arguments: + mid -- the id of a mail_location (int) + one of the maillocation constants: `MAILDIR_ID`, `MBOX_ID`, + `MDBOX_ID` and `SDBOX_ID` + type_ -- the type/mailbox format of the mail_location (str) + one of the maillocation constants: `MAILDIR_NAME`, `MBOX_NAME`, + `MDBOX_NAME` and `SDBOX_NAME` + """ + assert any((mid, type_)) + if mid: + assert isinstance(mid, (int, long)) and mid in _storage + self._info = _storage[mid] + else: + assert isinstance(type_, basestring) and type_.lower() in _type_id + self._info = _storage[_type_id[type_.lower()]] + + def __str__(self): + return '%(prefix)s~/%(directory)s' % self._info + + @property + def directory(self): + """The mail_location's directory name.""" + return self._info['directory'] + + @property + def dovecot_version(self): + """The required Dovecot version (concatenated major and minor + parts) for this mailbox format.""" + return self._info['dovecot_version'] + + @property + def postfix(self): + """`True` if Postfix supports this mailbox format, else `False`.""" + return self._info['postfix'] + + @property + def prefix(self): + """The prefix of the mail_location.""" + return self._info['prefix'] + + @property + def mail_location(self): + """The mail_location, e.g. ``maildir:~/Maildir``""" + return self.__str__() diff -r a51809f7940b -r 311eee429f67 doc/source/vmm_constants_error.rst --- a/doc/source/vmm_constants_error.rst Mon Mar 01 05:31:43 2010 +0000 +++ b/doc/source/vmm_constants_error.rst Tue Mar 02 17:40:58 2010 +0000 @@ -147,6 +147,8 @@ Can't create a new MailLocation instance + obsolete? + .. data:: NOT_EXECUTABLE The binary is not executable @@ -196,10 +198,14 @@ Can't initialize a new Transport instance + obsolete? + .. data:: UNKNOWN_MAILLOCATION_ID There is no MailLocation entry with the given ID + obsolete? + .. data:: UNKNOWN_SERVICE The specified service is unknown |
|
From: <nev...@us...> - 2010-03-01 05:31:57
|
details: http://hg.localdomain.org/vmm/rev/a51809f7940b changeset: 225:a51809f7940b user: Pascal Volk date: Mon Mar 01 05:31:43 2010 +0000 description: VMM/Transport: reworked Transport class. Use assertions for argument checks. Removed methods getID() and getTransport(). This values are now accessible through the read-only attributes id and transport. VMM/{Account,Domain}: adjusted to modifications in Transport class. A few code cleanups. diffstat: VirtualMailManager/Account.py | 27 +++++++++---- VirtualMailManager/Domain.py | 28 +++++++++----- VirtualMailManager/Transport.py | 82 ++++++++++++++++++++++------------------- 3 files changed, 80 insertions(+), 57 deletions(-) diffs (truncated from 333 to 300 lines): diff -r 7e9874a50d92 -r a51809f7940b VirtualMailManager/Account.py --- a/VirtualMailManager/Account.py Mon Mar 01 04:46:46 2010 +0000 +++ b/VirtualMailManager/Account.py Mon Mar 01 05:31:43 2010 +0000 @@ -11,9 +11,14 @@ from VirtualMailManager.MailLocation import MailLocation from VirtualMailManager.Transport import Transport + +_ = lambda msg: msg + + class Account(object): """Class to manage e-mail accounts.""" - __slots__ = ('_addr','_base','_gid','_mid','_passwd','_tid','_uid','_dbh') + __slots__ = ('_addr', '_base', '_gid', '_mid', '_passwd', '_tid', '_uid', + '_dbh') def __init__(self, dbh, address, password=None): self._dbh = dbh @@ -45,7 +50,7 @@ dbc = self._dbh.cursor() dbc.execute( "SELECT uid, mid, tid FROM users WHERE gid=%s AND local_part=%s", - self._gid, self._addr._localpart) + self._gid, self._addr.localpart) result = dbc.fetchone() dbc.close() if result is not None: @@ -55,11 +60,11 @@ return False def _setAddr(self): - dom = Domain(self._dbh, self._addr._domainname) + dom = Domain(self._dbh, self._addr.domainname) self._gid = dom.getID() if self._gid == 0: raise AccE(_(u"The domain “%s” doesn't exist.") % - self._addr._domainname, ERR.NO_SUCH_DOMAIN) + self._addr.domainname, ERR.NO_SUCH_DOMAIN) self._base = dom.getDir() self._tid = dom.getTransportID() @@ -105,7 +110,7 @@ def __aliaseCount(self): dbc = self._dbh.cursor() q = "SELECT COUNT(destination) FROM alias WHERE destination = '%s'"\ - %self._addr + % self._addr dbc.execute(q) a_count = dbc.fetchone()[0] dbc.close() @@ -141,7 +146,7 @@ self._prepare(maillocation) sql = "INSERT INTO users (local_part, passwd, uid, gid, mid, tid,\ smtp, pop3, imap, %s) VALUES ('%s', '%s', %d, %d, %d, %d, %s, %s, %s, %s)" % ( - sieve_col, self._addr._localpart, self._passwd, self._uid, + sieve_col, self._addr.localpart, self._passwd, self._uid, self._gid, self._mid, self._tid, smtp, pop3, imap, sieve) dbc = self._dbh.cursor() dbc.execute(sql) @@ -162,7 +167,7 @@ dbc.execute('UPDATE users SET passwd = %s WHERE uid = %s', value, self._uid) elif what == 'transport': - self._tid = Transport(self._dbh, transport=value).getID() + self._tid = Transport(self._dbh, transport=value).id dbc.execute('UPDATE users SET tid = %s WHERE uid = %s', self._tid, self._uid) else: @@ -202,7 +207,7 @@ MailLocation(self._dbh, mid=info['maildir']).getMailLocation()) info['transport'] = Transport(self._dbh, - tid=info['transport']).getTransport() + tid=info['transport']).transport return info def getAliases(self): @@ -241,9 +246,11 @@ dbc.close() raise AccE( _(u"There are %(count)d aliases with the destination address\ - “%(address)s”.") %{'count': a_count, 'address': self._addr}, ERR.ALIAS_PRESENT) + “%(address)s”.") % {'count': a_count, 'address': self._addr}, + ERR.ALIAS_PRESENT) dbc.close() + def getAccountByID(uid, dbh): try: uid = long(uid) @@ -264,3 +271,5 @@ info = dict(zip(keys, info)) return info + +del _ diff -r 7e9874a50d92 -r a51809f7940b VirtualMailManager/Domain.py --- a/VirtualMailManager/Domain.py Mon Mar 01 04:46:46 2010 +0000 +++ b/VirtualMailManager/Domain.py Mon Mar 01 05:31:43 2010 +0000 @@ -15,11 +15,14 @@ MAILDIR_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz' +_ = lambda x: x class Domain(object): """Class to manage e-mail domains.""" - __slots__ = ('_basedir','_domaindir','_id','_name','_transport','_dbh') + __slots__ = ('_basedir', '_domaindir', '_id', '_name', '_transport', + '_dbh') + def __init__(self, dbh, domainname, basedir=None, transport=None): """Creates a new Domain instance. @@ -136,7 +139,7 @@ self._prepare() dbc = self._dbh.cursor() dbc.execute("INSERT INTO domain_data (gid, tid, domaindir)\ - VALUES (%s, %s, %s)", self._id, self._transport.getID(), self._domaindir) + VALUES (%s, %s, %s)", self._id, self._transport.id, self._domaindir) dbc.execute("INSERT INTO domain_name (domainname, gid, is_primary)\ VALUES (%s, %s, %s)", self._name, self._id, True) self._dbh.commit() @@ -155,8 +158,9 @@ if self._id > 0: self._chkDelete(delUser, delAlias) dbc = self._dbh.cursor() - for t in ('alias','users','relocated','domain_name','domain_data'): - dbc.execute("DELETE FROM %s WHERE gid = %d" % (t, self._id)) + for tbl in ('alias', 'users', 'relocated', 'domain_name', + 'domain_data'): + dbc.execute("DELETE FROM %s WHERE gid = %d" % (tbl, self._id)) self._dbh.commit() dbc.close() else: @@ -171,17 +175,17 @@ force -- True/False force new transport for all accounts (bool) """ if self._id > 0: - if transport == self._transport.getTransport(): + if transport == self._transport.transport: return trsp = Transport(self._dbh, transport=transport) dbc = self._dbh.cursor() dbc.execute("UPDATE domain_data SET tid = %s WHERE gid = %s", - trsp.getID(), self._id) + trsp.id, self._id) if dbc.rowcount > 0: self._dbh.commit() if force: dbc.execute("UPDATE users SET tid = %s WHERE gid = %s", - trsp.getID(), self._id) + trsp.id, self._id) if dbc.rowcount > 0: self._dbh.commit() dbc.close() @@ -199,11 +203,11 @@ def getTransport(self): """Returns domain's transport.""" - return self._transport.getTransport() + return self._transport.transport def getTransportID(self): """Returns the ID from the domain's transport.""" - return self._transport.getID() + return self._transport.id def getInfo(self): """Returns a dictionary with information about the domain.""" @@ -242,7 +246,7 @@ """Returns a list with all aliases from the domain.""" dbc = self._dbh.cursor() dbc.execute("SELECT DISTINCT address FROM alias WHERE gid = %s\ - ORDER BY address", self._id) + ORDER BY address", self._id) addresses = dbc.fetchall() dbc.close() aliases = [] @@ -312,6 +316,7 @@ del doms return order, domdict + def get_gid(dbh, domainname): """Returns the group id of the domain *domainname*. @@ -326,3 +331,6 @@ if gid: return gid[0] return 0 + + +del _ diff -r 7e9874a50d92 -r a51809f7940b VirtualMailManager/Transport.py --- a/VirtualMailManager/Transport.py Mon Mar 01 04:46:46 2010 +0000 +++ b/VirtualMailManager/Transport.py Mon Mar 01 05:31:43 2010 +0000 @@ -2,89 +2,95 @@ # Copyright (c) 2008 - 2010, Pascal Volk # See COPYING for distribution information. -"""Virtual Mail Manager's Transport class to manage the transport for -domains and accounts.""" +""" + VirtualMailManager.Transport -import VirtualMailManager.constants.ERROR as ERR + Virtual Mail Manager's Transport class to manage the transport for + domains and accounts. +""" + +from VirtualMailManager.constants.ERROR import UNKNOWN_TRANSPORT_ID from VirtualMailManager.errors import TransportError +from VirtualMailManager.pycompat import any + class Transport(object): """A wrapper class that provides access to the transport table""" - __slots__ = ('__id', '__transport', '_dbh') + __slots__ = ('_id', '_transport', '_dbh') + def __init__(self, dbh, tid=None, transport=None): """Creates a new Transport instance. - Either tid or transport must be specified. + Either tid or transport must be specified. When both arguments + are given, tid will be used. Keyword arguments: dbh -- a pyPgSQL.PgSQL.connection - tid -- the id of a transport (long) + tid -- the id of a transport (int/long) transport -- the value of the transport (str) + """ self._dbh = dbh - if tid is None and transport is None: - raise TransportError( - _('Either tid or transport must be specified.'), - ERR.TRANSPORT_INIT) - elif tid is not None: - try: - self.__id = long(tid) - except ValueError: - raise TransportError(_('tid must be an int/long.'), - ERR.TRANSPORT_INIT) + assert any((tid, transport)) + if tid: + assert not isinstance(tid, bool) and isinstance(tid, (int, long)) + self._id = tid self._loadByID() else: - self.__transport = transport + assert isinstance(transport, basestring) + self._transport = transport self._loadByName() + @property + def id(self): + """The transport's unique ID.""" + return self._id + + @property + def transport(self): + """The transport's value, ex: 'dovecot:'""" + return self._transport + def __eq__(self, other): if isinstance(other, self.__class__): - return self.__id == other.getID() + return self._id == other.id return NotImplemented def __ne__(self, other): if isinstance(other, self.__class__): - return self.__id != other.getID() + return self._id != other.id return NotImplemented def __str__(self): - return self.__transport + return self._transport def _loadByID(self): dbc = self._dbh.cursor() - dbc.execute('SELECT transport FROM transport WHERE tid = %s', self.__id) + dbc.execute('SELECT transport FROM transport WHERE tid = %s', self._id) result = dbc.fetchone() dbc.close() - if result is not None: - self.__transport = result[0] + if result: + self._transport = result[0] else: raise TransportError(_('Unknown tid specified.'), - ERR.UNKNOWN_TRANSPORT_ID) + UNKNOWN_TRANSPORT_ID) |
|
From: <nev...@us...> - 2010-03-01 04:47:05
|
details: http://hg.localdomain.org/vmm/rev/7e9874a50d92 changeset: 224:7e9874a50d92 user: Pascal Volk date: Mon Mar 01 04:46:46 2010 +0000 description: VMM/pycompat: added function any() for Python 2.4 diffstat: VirtualMailManager/pycompat.py | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diffs (22 lines): diff -r 5c7b7cbb01cd -r 7e9874a50d92 VirtualMailManager/pycompat.py --- a/VirtualMailManager/pycompat.py Mon Mar 01 02:31:03 2010 +0000 +++ b/VirtualMailManager/pycompat.py Mon Mar 01 04:46:46 2010 +0000 @@ -21,3 +21,18 @@ if not element: return False return True + + +# http://docs.python.org/library/functions.html#any +try: + any = any +except NameError: + def any(iterable): + """Return True if any element of the *iterable* is true. If the + iterable is empty, return False. + + """ + for element in iterable: + if element: + return True + return False |
|
From: <nev...@us...> - 2010-03-01 02:31:23
|
details: http://hg.localdomain.org/vmm/rev/5c7b7cbb01cd changeset: 223:5c7b7cbb01cd user: Pascal Volk date: Mon Mar 01 02:31:03 2010 +0000 description: replaced some "for x in list …" diffstat: VirtualMailManager/Alias.py | 4 +--- VirtualMailManager/Handler.py | 4 ++-- VirtualMailManager/ext/Postconf.py | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diffs (41 lines): diff -r d0c16e70a9fb -r 5c7b7cbb01cd VirtualMailManager/Alias.py --- a/VirtualMailManager/Alias.py Sun Feb 28 20:51:34 2010 +0000 +++ b/VirtualMailManager/Alias.py Mon Mar 01 02:31:03 2010 +0000 @@ -43,9 +43,7 @@ self._gid, self._addr.localpart) dests = iter(dbc.fetchall()) if dbc.rowcount > 0: - dest_add = self._dests.append - for dest in dests: - dest_add(EmailAddress(dest[0])) + self._dests.extend(EmailAddress(dest[0]) for dest in dests) dbc.close() def __check_expansion(self, count_new, limit): diff -r d0c16e70a9fb -r 5c7b7cbb01cd VirtualMailManager/Handler.py --- a/VirtualMailManager/Handler.py Sun Feb 28 20:51:34 2010 +0000 +++ b/VirtualMailManager/Handler.py Mon Mar 01 02:31:03 2010 +0000 @@ -246,8 +246,8 @@ """Creates a subscriptions file with the mailboxes from `folderlist`""" fname = os.path.join(self._Cfg.dget('maildir.name'), 'subscriptions') sf = open(fname, 'w') - for f in folderlist: - sf.write('%s\n' % f) + sf.write('\n'.join(folderlist)) + sf.write('\n') sf.flush() sf.close() os.chown(fname, uid, gid) diff -r d0c16e70a9fb -r 5c7b7cbb01cd VirtualMailManager/ext/Postconf.py --- a/VirtualMailManager/ext/Postconf.py Sun Feb 28 20:51:34 2010 +0000 +++ b/VirtualMailManager/ext/Postconf.py Mon Mar 01 02:31:03 2010 +0000 @@ -71,8 +71,7 @@ def __readMulti(self, parameters): cmd = [self.__bin] - for parameter in parameters: - cmd.append(parameter[1:]) + cmd.extend(parameter[1:] for parameter in parameters) out, err = Popen(cmd, stdout=PIPE, stderr=PIPE).communicate() if len(err): raise VMMError(err.strip(), ERR.VMM_ERROR) |