* Removed gettext import and setup in VirtualMailManager/:
- 'Account.py'
- 'Alias.py'
- 'Config.py'
- 'Domain.py'
- 'MailLocation.py'
- 'Transport.py'
- 'VirtualMailManager.py'
* 'VirtualMailManager/VirtualMailManager.py'
- Renamed methods in class VirtualMailManager:
+ __chkLocalpart() -> chkLocalpart()
+ __chkDomainname() -> chkDomainname()
+ __chkEmailAddress() -> chkEmailAddress()
- VirtualMailManager.chkLocalpart() check also for len() < 1 *Oops*
- VirtualMailManager.user_delete() explains why the home directory
couldn't be deleted, if it wasn't deleted.
* 'VirtualMailManager/Account.py'
- Account.__init__() checks address with
VirtualMailManager.chkEmailAddress()
* 'VirtualMailManager/Exceptions.py'
- Added class VMMDomainAliasException
* 'vmm'
- Implemented: w_err(), w_std()
- Uses gettexts install()
- Converts all args from sys.argv to unicode - available via global argv
- Replaced many sys.argv by argv
* 'po/de.po'
* 'po/vmm.pot'
- updated
--- a/VirtualMailManager/Account.py Sat Aug 16 02:48:36 2008 +0000
+++ b/VirtualMailManager/Account.py Mon Aug 18 01:56:31 2008 +0000
@@ -13,24 +13,19 @@
__revision__ = 'rev '+'$Rev$'.split()[1]
__date__ = '$Date$'.split()[1]
-import gettext
-
from Exceptions import VMMAccountException
from Domain import Domain
from Transport import Transport
from MailLocation import MailLocation
+import VirtualMailManager as VMM
import constants.ERROR as ERR
-gettext.bindtextdomain('vmm', '/usr/local/share/locale')
-gettext.textdomain('vmm')
-_ = gettext.gettext
-
class Account:
"""Class to manage e-mail accounts."""
def __init__(self, dbh, address, password=None):
self._dbh = dbh
self._base = None
- self._addr = address
+ self._addr = VMM.VirtualMailManager.chkEmailAddress(address)
self._localpart = None
self._name = None
self._uid = 0
@@ -42,7 +37,7 @@
self._exists()
if self._isAlias():
raise VMMAccountException(
- (_(u"There is already an alias with address '%s'") % address,
+ (_(u"There is already an alias with the address »%s«.") % address,
ERR.ALIAS_EXISTS))
def _exists(self):
@@ -74,7 +69,7 @@
dom = Domain(self._dbh, d)
self._gid = dom.getID()
if self._gid == 0:
- raise VMMAccountException((_(u"Domain '%s' doesn't exist.") % d,
+ raise VMMAccountException((_(u"Domain »%s« doesn't exist.") % d,
ERR.NO_SUCH_DOMAIN))
self._base = dom.getDir()
self._tid = dom.getTransportID()
@@ -93,11 +88,11 @@
if not isinstance(state, bool):
return False
if not service in ['smtp', 'pop3', 'imap', 'managesieve', 'all', None]:
- raise VMMAccountException((_(u"Unknown service '%s'") % service,
+ raise VMMAccountException((_(u"Unknown service »%s«.") % service,
ERR.UNKNOWN_SERVICE))
if self._uid < 1:
- raise VMMAccountException((_("Account doesn't exists"),
- ERR.NO_SUCH_ACCOUNT))
+ raise VMMAccountException((_(u"The account »%s« doesn't exists.") %
+ self._addr, ERR.NO_SUCH_ACCOUNT))
dbc = self._dbh.cursor()
if service in ['smtp', 'pop3', 'imap', 'managesieve']:
dbc.execute(
@@ -148,13 +143,13 @@
self._dbh.commit()
dbc.close()
else:
- raise VMMAccountException((_('Account already exists.'),
- ERR.ACCOUNT_EXISTS))
+ raise VMMAccountException((_(u'The account »%s« already exists.') %
+ self._addr, ERR.ACCOUNT_EXISTS))
def modify(self, what, value):
if self._uid == 0:
- raise VMMAccountException((_("Account doesn't exists"),
- ERR.NO_SUCH_ACCOUNT))
+ raise VMMAccountException((_(u"The account »%s« doesn't exists.") %
+ self._addr, ERR.NO_SUCH_ACCOUNT))
if what not in ['name', 'password', 'transport']:
return False
dbc = self._dbh.cursor()
@@ -180,8 +175,8 @@
info = dbc.fetchone()
dbc.close()
if info is None:
- raise VMMAccountException((_("Account doesn't exists"),
- ERR.NO_SUCH_ACCOUNT))
+ raise VMMAccountException((_(u"The account »%s« doesn't exists.") %
+ self._addr, ERR.NO_SUCH_ACCOUNT))
else:
keys = ['name', 'uid', 'gid', 'maildir', 'transport', 'smtp',
'pop3', 'imap', 'managesieve']
@@ -208,18 +203,18 @@
self._dbh.commit()
dbc.close()
else:
- raise VMMAccountException((_("Account doesn't exists"),
- ERR.NO_SUCH_ACCOUNT))
+ raise VMMAccountException((_(u"The account »%s« doesn't exists.") %
+ self._addr, ERR.NO_SUCH_ACCOUNT))
def getAccountByID(uid, dbh):
try:
uid = long(uid)
except ValueError:
- raise VMMAccountException((_('uid must be an int/long.'),
+ raise VMMAccountException((_(u'uid must be an int/long.'),
ERR.INVALID_AGUMENT))
if uid < 1:
- raise VMMAccountException((_('uid must be greater than 0.'),
+ raise VMMAccountException((_(u'uid must be greater than 0.'),
ERR.INVALID_AGUMENT))
dbc = dbh.cursor()
dbc.execute("SELECT local_part||'@'|| domain_name.domainname AS address,\
@@ -228,7 +223,8 @@
info = dbc.fetchone()
dbc.close()
if info is None:
- raise VMMAccountException((_("Account doesn't exists"),
+ raise VMMAccountException((
+ _(u"There is no account with the UID »%d«.") % uid,
ERR.NO_SUCH_ACCOUNT))
keys = ['address', 'uid', 'gid']
info = dict(zip(keys, info))
--- a/VirtualMailManager/Alias.py Sat Aug 16 02:48:36 2008 +0000
+++ b/VirtualMailManager/Alias.py Mon Aug 18 01:56:31 2008 +0000
@@ -13,16 +13,10 @@
__revision__ = 'rev '+'$Rev$'.split()[1]
__date__ = '$Date$'.split()[1]
-import gettext
-
from Exceptions import VMMAliasException
from Domain import Domain
import constants.ERROR as ERR
-gettext.bindtextdomain('vmm', '/usr/local/share/locale')
-gettext.textdomain('vmm')
-_ = gettext.gettext
-
class Alias:
"""Class to manage e-mail accounts."""
def __init__(self, dbh, address, destination=None):
--- a/VirtualMailManager/Config.py Sat Aug 16 02:48:36 2008 +0000
+++ b/VirtualMailManager/Config.py Mon Aug 18 01:56:31 2008 +0000
@@ -16,8 +16,8 @@
__revision__ = 'rev '+'$Rev$'.split()[1]
__date__ = '$Date$'.split()[1]
+import locale
import sys
-import gettext
from shutil import copy2
from ConfigParser import ConfigParser
from cStringIO import StringIO
@@ -25,9 +25,8 @@
from Exceptions import VMMConfigException
import constants.ERROR as ERR
-gettext.bindtextdomain('vmm', '/usr/local/share/locale')
-gettext.textdomain('vmm')
-_ = gettext.gettext
+locale.setlocale(locale.LC_ALL, '')
+ENCODING = locale.nl_langinfo(locale.CODESET)
class VMMConfig(ConfigParser):
"""This class is for configure the Virtual Mail Manager.
@@ -98,9 +97,9 @@
errmsg = StringIO()
for k,v in self.__missing.items():
if v[0] is True:
- errmsg.write(_("missing section: %s\n") % k)
+ errmsg.write(_(u"missing section: %s\n") % k)
else:
- errmsg.write(_("missing options in section %s:\n") % k)
+ errmsg.write(_(u"missing options in section %s:\n") % k)
for o in v:
errmsg.write(" * %s\n" % o)
raise VMMConfigException((errmsg.getvalue(), ERR.CONF_ERROR))
@@ -116,7 +115,7 @@
sections -- list of strings
"""
if not isinstance(sections, list):
- raise TypeError(_("Argument 'sections' is not a list."))
+ raise TypeError(_(u"Argument 'sections' is not a list."))
# if [config] done = false (default at 1st run),
# then set changes true
try:
@@ -129,10 +128,11 @@
if s == 'config':
pass
else:
- print _('* Config section: %s') % s
+ print _(u'* Config section: »%s«') % s
for opt, val in self.items(s):
- newval = raw_input(_('Enter new value for %s [%s]: ')
- %(opt, val))
+ newval = raw_input(
+ _('Enter new value for option %s [%s]: ').encode(
+ ENCODING, 'replace') % (opt, val))
if newval and newval != val:
self.set(s, opt, newval)
self.__changes = True
--- a/VirtualMailManager/Domain.py Sat Aug 16 02:48:36 2008 +0000
+++ b/VirtualMailManager/Domain.py Mon Aug 18 01:56:31 2008 +0000
@@ -13,7 +13,6 @@
__revision__ = 'rev '+'$Rev$'.split()[1]
__date__ = '$Date$'.split()[1]
-import gettext
from random import choice
from Exceptions import VMMDomainException
@@ -22,10 +21,6 @@
MAILDIR_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz'
-gettext.bindtextdomain('vmm', '/usr/local/share/locale')
-gettext.textdomain('vmm')
-_ = gettext.gettext
-
class Domain:
"""Class to manage e-mail domains."""
def __init__(self, dbh, domainname, basedir=None, transport=None):
--- a/VirtualMailManager/Exceptions.py Sat Aug 16 02:48:36 2008 +0000
+++ b/VirtualMailManager/Exceptions.py Mon Aug 18 01:56:31 2008 +0000
@@ -37,6 +37,11 @@
def __init__(self, msg):
VMMException.__init__(self, msg)
+class VMMDomainAliasException(VMMException):
+ """Exception class for DomainAlias exceptions"""
+ def __init__(self, msg):
+ VMMException.__init__(self, msg)
+
class VMMAccountException(VMMException):
"""Exception class for Account exceptions"""
def __init__(self, msg):
--- a/VirtualMailManager/MailLocation.py Sat Aug 16 02:48:36 2008 +0000
+++ b/VirtualMailManager/MailLocation.py Mon Aug 18 01:56:31 2008 +0000
@@ -14,15 +14,9 @@
__revision__ = 'rev '+'$Rev$'.split()[1]
__date__ = '$Date$'.split()[1]
-import gettext
-
from Exceptions import VMMMailLocationException as MLE
import constants.ERROR as ERR
-gettext.bindtextdomain('vmm', '/usr/local/share/locale')
-gettext.textdomain('vmm')
-_ = gettext.gettext
-
class MailLocation:
"""A wrapper class thats provide access to the maillocation table"""
def __init__(self, dbh, mid=None, maillocation=None):
--- a/VirtualMailManager/Transport.py Sat Aug 16 02:48:36 2008 +0000
+++ b/VirtualMailManager/Transport.py Mon Aug 18 01:56:31 2008 +0000
@@ -14,15 +14,9 @@
__revision__ = 'rev '+'$Rev$'.split()[1]
__date__ = '$Date$'.split()[1]
-import gettext
-
from Exceptions import VMMTransportException
import constants.ERROR as ERR
-gettext.bindtextdomain('vmm', '/usr/local/share/locale')
-gettext.textdomain('vmm')
-_ = gettext.gettext
-
class Transport:
"""A wrapper class thats provide access to the transport table"""
def __init__(self, dbh, tid=None, transport=None):
--- a/VirtualMailManager/VirtualMailManager.py Sat Aug 16 02:48:36 2008 +0000
+++ b/VirtualMailManager/VirtualMailManager.py Mon Aug 18 01:56:31 2008 +0000
@@ -16,7 +16,6 @@
import os
import re
import sys
-import gettext
from encodings.idna import ToASCII, ToUnicode
from getpass import getpass
from shutil import rmtree
@@ -38,13 +37,6 @@
RE_LOCALPART = """[^\w!#$%&'\*\+-\.\/=?^_`{\|}~]"""
RE_MAILLOCATION = """^[\w]{1,20}$"""
-ENCODING_IN = sys.getfilesystemencoding()
-ENCODING_OUT = sys.stdout.encoding or sys.getfilesystemencoding()
-
-gettext.bindtextdomain('vmm', '/usr/local/share/locale')
-gettext.textdomain('vmm')
-_ = gettext.gettext
-
class VirtualMailManager:
"""The main class for vmm"""
def __init__(self):
@@ -52,14 +44,14 @@
Throws a VMMNotRootException if your uid is greater 0.
"""
self.__cfgFileName = '/usr/local/etc/vmm.cfg'
- self.__permWarnMsg = _("fix permissions for '%s'\n`chmod 0600 %s` would\
- be great.") % (self.__cfgFileName, self.__cfgFileName)
+ self.__permWarnMsg = _(u"fix permissions for »%s«\n`chmod 0600 %s`\
+ would be great.") % (self.__cfgFileName, self.__cfgFileName)
self.__warnings = []
self.__Cfg = None
self.__dbh = None
if os.geteuid():
- raise VMMNotRootException((_("You are not root.\n\tGood bye!\n"),
+ raise VMMNotRootException((_(u"You are not root.\n\tGood bye!\n"),
ERR.CONF_NOPERM))
if self.__chkCfgFile():
self.__Cfg = Cfg(self.__cfgFileName)
@@ -73,7 +65,7 @@
def __chkCfgFile(self):
"""Checks the configuration file, returns bool"""
if not os.path.isfile(self.__cfgFileName):
- raise VMMException((_(u"The file '%s' does not exists.") %
+ raise VMMException((_(u"The file »%s« does not exists.") %
self.__cfgFileName, ERR.CONF_NOFILE))
fstat = os.stat(self.__cfgFileName)
try:
@@ -95,15 +87,16 @@
self.__Cfg.getint('misc', 'gid_mail'))
os.umask(old_umask)
elif not os.path.isdir(self.__Cfg.get('domdir', 'base')):
- raise VMMException((_('%s is not a directory') %
+ raise VMMException((_(u'»%s« is not a directory.\n\
+(vmm.cfg: section "domdir", option "base")') %
self.__Cfg.get('domdir', 'base'), ERR.NO_SUCH_DIRECTORY))
for opt, val in self.__Cfg.items('bin'):
if not os.path.exists(val):
- raise VMMException((_("%s doesn't exists.") % val,
- ERR.NO_SUCH_BINARY))
+ raise VMMException((_(u'»%s« doesn\'t exists.\n\
+(vmm.cfg: section "bin", option "%s")') % (val, opt), ERR.NO_SUCH_BINARY))
elif not os.access(val, os.X_OK):
- raise VMMException((_("%s is not executable.") % val,
- ERR.NOT_EXECUTABLE))
+ raise VMMException((_(u'»%s« is not executable.\n\
+(vmm.cfg: section "bin", option "%s")') % (val, opt), ERR.NOT_EXECUTABLE))
def __getFileMode(self):
"""Determines the file access mode from file __cfgFileName,
@@ -129,22 +122,30 @@
except PgSQL.libpq.DatabaseError, e:
raise VMMException((str(e), ERR.DATABASE_ERROR))
- def __chkLocalpart(self, localpart):
+ def chkLocalpart(localpart):
"""Validates the local part of an e-mail address.
Keyword arguments:
localpart -- the e-mail address that should be validated (str)
"""
+ if len(localpart) < 1:
+ raise VMMException((_(u'No localpart specified.'),
+ ERR.LOCALPART_INVALID))
if len(localpart) > 64:
- raise VMMException((_('The local part is too long'),
- ERR.LOCALPART_TOO_LONG))
- if re.compile(RE_LOCALPART).search(localpart):
+ raise VMMException((_(u'The local part »%s« is too long') %
+ localpart, ERR.LOCALPART_TOO_LONG))
+ ic = re.compile(RE_LOCALPART).findall(localpart)
+ if len(ic):
+ ichrs = ''
+ for c in set(ic):
+ ichrs += u"»%s« " % c
raise VMMException((
- _(u"The local part '%s' contains invalid characters.") %
- localpart, ERR.LOCALPART_INVALID))
+ _(u"The local part »%s« contains invalid characters: %s") %
+ (localpart, ichrs), ERR.LOCALPART_INVALID))
return localpart
+ chkLocalpart = staticmethod(chkLocalpart)
- def idn2ascii(self, domainname):
+ def idn2ascii(domainname):
"""Converts an idn domainname in punycode.
Keyword arguments:
@@ -154,10 +155,12 @@
for label in domainname.split('.'):
if len(label) == 0:
continue
- tmp.append(ToASCII(unicode(label, ENCODING_IN)))
+ #tmp.append(ToASCII(unicode(label, ENCODING_IN)))
+ tmp.append(ToASCII(label))
return '.'.join(tmp)
+ idn2ascii = staticmethod(idn2ascii)
- def ace2idna(self, domainname):
+ def ace2idna(domainname):
"""Convertis a domainname from ACE according to IDNA
Keyword arguments:
@@ -169,8 +172,9 @@
continue
tmp.append(ToUnicode(label))
return '.'.join(tmp)
+ ace2idna = staticmethod(ace2idna)
- def __chkDomainname(self, domainname):
+ def chkDomainname(domainname):
"""Validates the domain name of an e-mail address.
Keyword arguments:
@@ -178,31 +182,32 @@
"""
re.compile(RE_ASCII_CHARS)
if not re.match(RE_ASCII_CHARS, domainname):
- domainname = self.idn2ascii(domainname)
+ domainname = VirtualMailManager.idn2ascii(domainname)
if len(domainname) > 255:
- raise VMMException((_('The domain name is too long.'),
+ raise VMMException((_(u'The domain name is too long.'),
ERR.DOMAIN_TOO_LONG))
re.compile(RE_DOMAIN)
if not re.match(RE_DOMAIN, domainname):
- raise VMMException((_('The domain name is invalid.'),
+ raise VMMException((_(u'The domain name is invalid.'),
ERR.DOMAIN_INVALID))
return domainname
+ chkDomainname = staticmethod(chkDomainname)
- def __chkEmailAddress(self, address):
+ def chkEmailAddress(address):
try:
localpart, domain = address.split('@')
except ValueError:
- raise VMMException((_(u"Missing '@' sign in e-mail address '%s'.") %
+ raise VMMException((_(u"Missing '@' sign in e-mail address »%s«.") %
address, ERR.INVALID_ADDRESS))
except AttributeError:
- raise VMMException((_(u"'%s' looks not like an e-mail address.") %
+ raise VMMException((_(u"»%s« looks not like an e-mail address.") %
address, ERR.INVALID_ADDRESS))
- domain = self.__chkDomainname(domain)
- localpart = self.__chkLocalpart(localpart)
+ domain = VirtualMailManager.chkDomainname(domain)
+ localpart = VirtualMailManager.chkLocalpart(localpart)
return '%s@%s' % (localpart, domain)
+ chkEmailAddress = staticmethod(chkEmailAddress)
def __getAccount(self, address, password=None):
- address = self.__chkEmailAddress(address)
self.__dbConnect()
if not password is None:
password = self.__pwhash(password)
@@ -224,17 +229,17 @@
return clear0
def __getAlias(self, address, destination=None):
- address = self.__chkEmailAddress(address)
+ address = VirtualMailManager.chkEmailAddress(address)
if not destination is None:
if destination.count('@'):
- destination = self.__chkEmailAddress(destination)
+ destination = VirtualMailManager.chkEmailAddress(destination)
else:
- destination = self.__chkLocalpart(destination)
+ destination = VirtualMailManager.chkLocalpart(destination)
self.__dbConnect()
return Alias(self.__dbh, address, destination)
def __getDomain(self, domainname, transport=None):
- domainname = self.__chkDomainname(domainname)
+ domainname = VirtualMailManager.chkDomainname(domainname)
if transport is None:
transport = self.__Cfg.get('misc', 'transport')
self.__dbConnect()
@@ -314,7 +319,7 @@
if uid > 0 and gid > 0:
maildir = '%s' % uid
if maildir.count('..') or domdir.count('..'):
- raise VMMException((_('FATAL: ".." in maildir path detected.'),
+ raise VMMException((_(u'Found ".." in maildir path.'),
ERR.FOUND_DOTS_IN_PATH))
if os.path.isdir(domdir):
os.chdir(domdir)
@@ -322,12 +327,12 @@
mdstat = os.stat(maildir)
if (mdstat.st_uid, mdstat.st_gid) != (uid, gid):
raise VMMException((
- _('FATAL: owner/group mismatch in maildir detected'),
- ERR.MAILDIR_PERM_MISMATCH))
+ _(u'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))
+ raise VMMException((_(u"No such directory: %s/%s") %
+ (domdir, uid), ERR.NO_SUCH_DIRECTORY))
def __domdirdelete(self, domdir, gid):
if gid > 0:
@@ -337,13 +342,13 @@
domdirdirs = domdir.replace(basedir+'/', '').split('/')
if basedir.count('..') or domdir.count('..'):
raise VMMException(
- (_('FATAL: ".." in domain directory path detected.'),
+ (_(u'FATAL: ".." in domain directory path detected.'),
ERR.FOUND_DOTS_IN_PATH))
if os.path.isdir('%s/%s' % (basedir, domdirdirs[0])):
os.chdir('%s/%s' % (basedir, domdirdirs[0]))
if os.lstat(domdirdirs[1]).st_gid != gid:
raise VMMException(
- (_('FATAL: group mismatch in domain directory detected'),
+ (_(u'FATAL: group mismatch in domain directory detected'),
ERR.DOMAINDIR_GROUP_MISMATCH))
rmtree(domdirdirs[1], ignore_errors=True)
@@ -430,9 +435,9 @@
try:
return self.__Cfg.getboolean('config', 'done')
except ValueError, e:
- raise VMMConfigException(_("""Configurtion error: "%s"
-(in section "connfig", option "done")'
-see also: vmm.cfg(5)\n""") % str(e))
+ raise VMMConfigException(_(u"""Configurtion error: "%s"
+(in section "connfig", option "done") see also: vmm.cfg(5)\n""") %
+ str(e))
def configure(self, section=None):
"""Starts interactive configuration.
@@ -473,7 +478,7 @@
def domain_delete(self, domainname, force=None):
if not force is None and force not in ['deluser','delalias','delall']:
- raise VMMDomainException((_(u"Invalid argument: '%s'") % force,
+ raise VMMDomainException((_(u"Invalid argument: »%s«") % force,
ERR.INVALID_OPTION))
dom = self.__getDomain(domainname)
gid = dom.getID()
@@ -494,7 +499,7 @@
dominfo = dom.getInfo()
if dominfo['domainname'].startswith('xn--'):
dominfo['domainname'] += ' (%s)'\
- % self.ace2idna(dominfo['domainname'])
+ % VirtualMailManager.ace2idna(dominfo['domainname'])
if dominfo['aliases'] is None:
dominfo['aliases'] = 0
if detailed is None:
@@ -503,8 +508,8 @@
return (dominfo, dom.getAliaseNames(), dom.getAccounts(),
dom.getAliases())
else:
- raise VMMDomainException(("%s: '%s'" % (_('Invalid argument'),
- detailed), ERR.INVALID_OPTION))
+ raise VMMDomainException((_(u'Invalid argument: »%s«') % detailed,
+ ERR.INVALID_OPTION))
def domain_alias_add(self, aliasname, domainname):
"""Adds an alias name to the domain.
@@ -514,7 +519,8 @@
domainname -- name of the target domain (str)
"""
dom = self.__getDomain(domainname)
- aliasname = self.__chkDomainname(aliasname)
+ # XXX chk by DomainAlias!!!
+ aliasname = VirtualMailManager.chkDomainname(aliasname)
dom.saveAlias(aliasname)
def domain_alias_delete(self, aliasname):
@@ -524,7 +530,8 @@
aliasname -- the alias name of the domain (str)
"""
from Domain import deleteAlias
- aliasname = self.__chkDomainname(aliasname)
+ aliasname = VirtualMailManager.chkDomainname(aliasname)
+ # XXX chk by DomainAlias!!!
self.__dbConnect()
deleteAlias(self.__dbh, aliasname)
@@ -546,7 +553,8 @@
_(u"The pattern '%s' contains invalid characters.") %
pattern, ERR.DOMAIN_INVALID))
else:
- pattern = self.__chkDomainname(pattern)
+ pattern = VirtualMailManager.chkDomainname(pattern)
+ # XXX chk by domain if not like
self.__dbConnect()
return search(self.__dbh, pattern=pattern, like=like)
@@ -572,7 +580,19 @@
gid = acc.getGID()
acc.delete()
if self.__Cfg.getboolean('maildir', 'delete'):
- self.__maildirdelete(acc.getDir('domain'), uid, gid)
+ try:
+ self.__maildirdelete(acc.getDir('domain'), uid, gid)
+ except (VMMException), e:
+ if e[0][1] in [ERR.FOUND_DOTS_IN_PATH,
+ ERR.MAILDIR_PERM_MISMATCH, ERR.NO_SUCH_DIRECTORY]:
+ warning = _(u"""\
+The account has been successfully deleted from the database.
+ But an error occurred while deleting the following directory:
+ »%s«
+ Reason: %s""") % (acc.getDir('home'), e[0][0])
+ self.__warnings.append(warning)
+ else:
+ raise e
def alias_info(self, aliasaddress):
alias = self.__getAlias(aliasaddress)
@@ -597,7 +617,8 @@
def user_password(self, emailaddress, password):
acc = self.__getAccount(emailaddress)
if acc.getUID() == 0:
- raise VMMException((_("Account doesn't exists"),ERR.NO_SUCH_ACCOUNT))
+ raise VMMException((_(u"Account doesn't exists"),
+ ERR.NO_SUCH_ACCOUNT))
if password is None:
password = self._readpass()
acc.modify('password', self.__pwhash(password))
--- a/VirtualMailManager/constants/VERSION.py Sat Aug 16 02:48:36 2008 +0000
+++ b/VirtualMailManager/constants/VERSION.py Mon Aug 18 01:56:31 2008 +0000
@@ -4,4 +4,4 @@
# See COPYING for distribution information.
# $Id$
-VERSION = '0.5'
+VERSION = '0.5-dev'
--- a/po/de.po Sat Aug 16 02:48:36 2008 +0000
+++ b/po/de.po Mon Aug 18 01:56:31 2008 +0000
@@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: vmm 0.5\n"
-"POT-Creation-Date: 2008-08-16 04:27+CEST\n"
-"PO-Revision-Date: 2008-08-16 04:44+0200\n"
+"POT-Creation-Date: 2008-08-18 02:56+CEST\n"
+"PO-Revision-Date: 2008-08-18 03:48+0200\n"
"Last-Translator: Pascal Volk <p.volk@veb-it.de>\n"
"Language-Team: German\n"
"MIME-Version: 1.0\n"
@@ -15,258 +15,294 @@
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-#: VirtualMailManager/Account.py:45
-msgid "There is already an alias with address '%s'"
-msgstr "Es gibt bereits einen Alias mit der Adresse '%s'"
+#: VirtualMailManager/Account.py:40
+msgid "There is already an alias with the address »%s«."
+msgstr "Es existiert bereits ein Alias mit der Adresse »%s«."
-#: VirtualMailManager/Account.py:77 VirtualMailManager/Alias.py:74
-msgid "Domain '%s' doesn't exist."
-msgstr "Die Domain '%s' existiert nicht."
-
-#: VirtualMailManager/Account.py:96
-msgid "Unknown service '%s'"
-msgstr "Unbekannter Service '%s'"
+#: VirtualMailManager/Account.py:72
+msgid "Domain »%s« doesn't exist."
+msgstr "Die Domain »%s« existiert nicht."
-#: VirtualMailManager/Account.py:99 VirtualMailManager/Account.py:156
-#: VirtualMailManager/Account.py:183 VirtualMailManager/Account.py:211
-#: VirtualMailManager/Account.py:231
-#: VirtualMailManager/VirtualMailManager.py:600
-msgid "Account doesn't exists"
-msgstr "Der Account existiert nicht"
+#: VirtualMailManager/Account.py:91
+msgid "Unknown service »%s«."
+msgstr "Unbekannter Service »%s«."
-#: VirtualMailManager/Account.py:151
-msgid "Account already exists."
-msgstr "Der Account existiert bereits."
+#: VirtualMailManager/Account.py:94 VirtualMailManager/Account.py:151
+#: VirtualMailManager/Account.py:178 VirtualMailManager/Account.py:206
+msgid "The account »%s« doesn't exists."
+msgstr "Der Account »%s« existiert nicht."
-#: VirtualMailManager/Account.py:191
+#: VirtualMailManager/Account.py:146
+msgid "The account »%s« already exists."
+msgstr "Der Account »%s« existiert bereits."
+
+#: VirtualMailManager/Account.py:186
msgid "enabled"
msgstr "aktiviert"
-#: VirtualMailManager/Account.py:193
+#: VirtualMailManager/Account.py:188
msgid "disabled"
msgstr "deaktiviert"
-#: VirtualMailManager/Account.py:219
+#: VirtualMailManager/Account.py:214
msgid "uid must be an int/long."
msgstr "Die UID muss eine Ganzzahl sein."
-#: VirtualMailManager/Account.py:222
+#: VirtualMailManager/Account.py:217
msgid "uid must be greater than 0."
msgstr "Die UID muss größer als 0 sein."
-#: VirtualMailManager/Alias.py:31
+#: VirtualMailManager/Account.py:227
+msgid "There is no account with the UID »%d«."
+msgstr "Es existiert kein Account mit der UID »%d«."
+
+#: VirtualMailManager/Alias.py:25
msgid "Address and destination are identical."
msgstr "Alias- und Ziel-Adresse sind identisch."
-#: VirtualMailManager/Alias.py:44
+#: VirtualMailManager/Alias.py:38
msgid "There is already an account with address '%s'"
msgstr "Es gibt bereits einen Accounts mit der Adresse '%s'"
-#: VirtualMailManager/Alias.py:80
+#: VirtualMailManager/Alias.py:68
+msgid "Domain '%s' doesn't exist."
+msgstr "Die Domain '%s' existiert nicht."
+
+#: VirtualMailManager/Alias.py:74
msgid "No destination address for alias denoted."
msgstr "Keine Ziel-Adresse für den Alias angegeben."
-#: VirtualMailManager/Alias.py:89
+#: VirtualMailManager/Alias.py:83
msgid "Alias already exists."
msgstr "Der Alias existiert bereits."
-#: VirtualMailManager/Alias.py:104 VirtualMailManager/Alias.py:120
+#: VirtualMailManager/Alias.py:98 VirtualMailManager/Alias.py:114
msgid "Alias doesn't exists"
msgstr "Der Alias existiert nicht."
-#: VirtualMailManager/Config.py:101
+#: VirtualMailManager/Config.py:100
msgid "missing section: %s\n"
msgstr "Fehlender Abschnitt: %s\n"
-#: VirtualMailManager/Config.py:103
+#: VirtualMailManager/Config.py:102
msgid "missing options in section %s:\n"
msgstr "Fehlende Optionen im Abschnitt %s:\n"
-#: VirtualMailManager/Config.py:119
+#: VirtualMailManager/Config.py:118
msgid "Argument 'sections' is not a list."
msgstr "Argument 'section' ist nicht vom Typ List."
-#: VirtualMailManager/Config.py:132
-msgid "* Config section: %s"
-msgstr "* Konfigurations Abschnitt: %s"
+#: VirtualMailManager/Config.py:131
+msgid "* Config section: »%s«"
+msgstr "* Konfigurations Abschnitt: »%s«"
#: VirtualMailManager/Config.py:134
-msgid "Enter new value for %s [%s]: "
-msgstr "Neuer Wert für %s [%s]: "
+msgid "Enter new value for option %s [%s]: "
+msgstr "Neuer Wert für Option %s [%s]: "
-#: VirtualMailManager/Domain.py:78 VirtualMailManager/Domain.py:156
+#: VirtualMailManager/Domain.py:73 VirtualMailManager/Domain.py:151
msgid "Domain already exists."
msgstr "Die Domain existiert bereits."
-#: VirtualMailManager/Domain.py:81
+#: VirtualMailManager/Domain.py:76
msgid "Domain alias already exists."
msgstr "Der Domain-Alias existiert bereits."
-#: VirtualMailManager/Domain.py:135
+#: VirtualMailManager/Domain.py:130
msgid "There are accounts and aliases."
msgstr "Es sind noch Accounts und Aliase vorhanden."
-#: VirtualMailManager/Domain.py:138
+#: VirtualMailManager/Domain.py:133
msgid "There are accounts."
msgstr "Es sind noch Accounts vorhanden."
-#: VirtualMailManager/Domain.py:141
+#: VirtualMailManager/Domain.py:136
msgid "There are aliases."
msgstr "Es sind noch Aliase vorhanden."
-#: VirtualMailManager/Domain.py:174 VirtualMailManager/Domain.py:198
-#: VirtualMailManager/Domain.py:215 VirtualMailManager/Domain.py:245
+#: VirtualMailManager/Domain.py:169 VirtualMailManager/Domain.py:193
+#: VirtualMailManager/Domain.py:210 VirtualMailManager/Domain.py:240
msgid "Domain doesn't exist yet."
msgstr "Die Domain existiert noch nicht."
-#: VirtualMailManager/MailLocation.py:40
+#: VirtualMailManager/MailLocation.py:34
msgid "Either mid or maillocation must be specified."
msgstr "Entweder mid oder maillocation muss angegeben werden."
-#: VirtualMailManager/MailLocation.py:46
+#: VirtualMailManager/MailLocation.py:40
msgid "mid must be an int/long."
msgstr "Die MID muss eine Ganzzahl sein."
-#: VirtualMailManager/MailLocation.py:61
+#: VirtualMailManager/MailLocation.py:55
msgid "Unknown mid specified."
msgstr "Unbekannte MID angegeben."
-#: VirtualMailManager/Transport.py:41
+#: VirtualMailManager/Transport.py:35
msgid "Either tid or transport must be specified."
msgstr "Entweder tid oder transport muss angegeben werden."
-#: VirtualMailManager/Transport.py:47
+#: VirtualMailManager/Transport.py:41
msgid "tid must be an int/long."
msgstr "Die tid muss eine Ganzzahl sein."
-#: VirtualMailManager/Transport.py:62
+#: VirtualMailManager/Transport.py:56
msgid "Unknown tid specified."
msgstr "Unbekannte tid angegeben."
-#: VirtualMailManager/VirtualMailManager.py:55
+#: VirtualMailManager/VirtualMailManager.py:51
msgid ""
-"fix permissions for '%s'\n"
+"fix permissions for »%s«\n"
"`chmod 0600 %s` would be great."
msgstr ""
-"Bitte Zugriffsrechte für '%s' anpassen\n"
-"`chmod 0600 %s` wäre großartig"
+"Bitte Zugriffsrechte für »%s« anpassen\n"
+"`chmod 0600 %s` wäre großartig."
-#: VirtualMailManager/VirtualMailManager.py:62
+#: VirtualMailManager/VirtualMailManager.py:58
msgid ""
"You are not root.\n"
"\tGood bye!\n"
msgstr ""
-"Sie sind nicht root\n"
-"\tAuf Wiedersehen\n"
+"Sie sind nicht root.\n"
+"\tAuf Wiedersehen.\n"
+
+#: VirtualMailManager/VirtualMailManager.py:72
+msgid "The file »%s« does not exists."
+msgstr "Die Datei »%s« existiert nicht."
-#: VirtualMailManager/VirtualMailManager.py:76
-msgid "The file '%s' does not exists."
-msgstr "Die Datei '%s' existiert nicht."
+#: VirtualMailManager/VirtualMailManager.py:94
+msgid ""
+"»%s« is not a directory.\n"
+"(vmm.cfg: section \"domdir\", option \"base\")"
+msgstr ""
+"»%s« ist kein Verzeichnis.\n"
+"(vmm.cfg: Abschnitt \"domdir\", Option \"base\")"
-#: VirtualMailManager/VirtualMailManager.py:98
-msgid "%s is not a directory"
-msgstr "%s ist kein Verzeichnis"
+#: VirtualMailManager/VirtualMailManager.py:99
+msgid ""
+"»%s« doesn't exists.\n"
+"(vmm.cfg: section \"bin\", option \"%s\")"
+msgstr ""
+"»%s« existiert nicht.\n"
+"(vmm.cfg: Abschnitt \"bin\", Option \"%s\")"
#: VirtualMailManager/VirtualMailManager.py:102
-msgid "%s doesn't exists."
-msgstr "%s existiert nicht."
+msgid ""
+"»%s« is not executable.\n"
+"(vmm.cfg: section \"bin\", option \"%s\")"
+msgstr ""
+"»%s« ist nicht ausführbar.\n"
+"(vmm.cfg: Abschnitt \"bin\", Option \"%s\")"
-#: VirtualMailManager/VirtualMailManager.py:105
-msgid "%s is not executable."
-msgstr "%s ist nicht ausführbar."
+#: VirtualMailManager/VirtualMailManager.py:136
+msgid "No localpart specified."
+msgstr "Kein local-part angegeben."
#: VirtualMailManager/VirtualMailManager.py:139
-msgid "The local part is too long"
-msgstr "Der local-part ist zu lang"
+msgid "The local part »%s« is too long"
+msgstr "Der local-part »%s« ist zu lang"
-#: VirtualMailManager/VirtualMailManager.py:143
-msgid "The local part '%s' contains invalid characters."
-msgstr "Der local-part '%s' enthält ungültige Zeichen."
+#: VirtualMailManager/VirtualMailManager.py:147
+msgid "The local part »%s« contains invalid characters: %s"
+msgstr "Der local-part »%s« enthält ungültige Zeichen: %s"
-#: VirtualMailManager/VirtualMailManager.py:183
+#: VirtualMailManager/VirtualMailManager.py:191
msgid "The domain name is too long."
msgstr "Der Domain-Name ist zu lang."
-#: VirtualMailManager/VirtualMailManager.py:187
+#: VirtualMailManager/VirtualMailManager.py:195
msgid "The domain name is invalid."
msgstr "Der Domain-Name ist ungültig."
-#: VirtualMailManager/VirtualMailManager.py:195
-msgid "Missing '@' sign in e-mail address '%s'."
-msgstr "In der E-Mail-Adresse '%s' fehlt das '@'-Zeichen."
+#: VirtualMailManager/VirtualMailManager.py:204
+msgid "Missing '@' sign in e-mail address »%s«."
+msgstr "In der E-Mail-Adresse »%s« fehlt das '@'-Zeichen."
-#: VirtualMailManager/VirtualMailManager.py:198
-msgid "'%s' looks not like an e-mail address."
-msgstr "'%s' sieht nicht wie eine E-Mail-Adresse aus."
+#: VirtualMailManager/VirtualMailManager.py:207
+msgid "»%s« looks not like an e-mail address."
+msgstr "»%s« sieht nicht wie eine E-Mail-Adresse aus."
-#: VirtualMailManager/VirtualMailManager.py:216
+#: VirtualMailManager/VirtualMailManager.py:225
msgid "Enter new password: "
msgstr "Neues Passwort eingeben: "
-#: VirtualMailManager/VirtualMailManager.py:219
+#: VirtualMailManager/VirtualMailManager.py:228
msgid "Sorry, empty passwords are not permitted"
msgstr "Entschuldigung, leere Passwörter sind nicht zulässig"
-#: VirtualMailManager/VirtualMailManager.py:220
+#: VirtualMailManager/VirtualMailManager.py:229
msgid "Retype new password: "
msgstr "Neues Passwort wiederholen: "
-#: VirtualMailManager/VirtualMailManager.py:223
+#: VirtualMailManager/VirtualMailManager.py:232
msgid "Sorry, passwords do not match"
msgstr "Entschuldigung, die Passwörter stimmen nicht überein"
-#: VirtualMailManager/VirtualMailManager.py:259
+#: VirtualMailManager/VirtualMailManager.py:268
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:326
+msgid "Found \"..\" in maildir path."
+msgstr "\"..\" im Pfad zum Maildir entdeckt."
-#: 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:334
+msgid "Owner/group mismatch in maildir detected."
+msgstr "Maildir gehört dem/der falschen Benutzer/Gruppe."
-#: VirtualMailManager/VirtualMailManager.py:329
+#: VirtualMailManager/VirtualMailManager.py:338
msgid "No such directory: %s/%s"
msgstr "Verzeichnis nicht gefunden: %s/%s"
-#: VirtualMailManager/VirtualMailManager.py:340
+#: VirtualMailManager/VirtualMailManager.py:349
msgid "FATAL: \"..\" in domain directory path detected."
msgstr "FATAL: \"..\" im Pfad zum Domain-Verzeichnis entdeckt."
-#: VirtualMailManager/VirtualMailManager.py:346
+#: VirtualMailManager/VirtualMailManager.py:355
msgid "FATAL: group mismatch in domain directory detected"
msgstr "FATAL: Domain-Verzeichnis gehört der falschen Gruppe"
-#: VirtualMailManager/VirtualMailManager.py:433
+#: VirtualMailManager/VirtualMailManager.py:442
msgid ""
"Configurtion error: \"%s\"\n"
-"(in section \"connfig\", option \"done\")'\n"
-"see also: vmm.cfg(5)\n"
+"(in section \"connfig\", option \"done\") see also: vmm.cfg(5)\n"
msgstr ""
"Konfigurations Fehler: \"%s\"\n"
-"(im Abschnitt \"connfig\", Option \"done\")'\n"
-"Siehe auch: vmm.cfg(5)\n"
+"(im Abschnitt \"connfig\", Option \"done\") Siehe auch: vmm.cfg(5)\n"
-#: VirtualMailManager/VirtualMailManager.py:452
+#: VirtualMailManager/VirtualMailManager.py:461
msgid "Invalid section: '%s'"
msgstr "Ungültiger Abschnitt: '%s'"
-#: VirtualMailManager/VirtualMailManager.py:466
-#: VirtualMailManager/VirtualMailManager.py:476
+#: VirtualMailManager/VirtualMailManager.py:475
msgid "Invalid argument: '%s'"
msgstr "Ungültiges Argument: '%s'"
-#: VirtualMailManager/VirtualMailManager.py:506
-msgid "Invalid argument"
-msgstr "Ungültiges Argument"
+#: VirtualMailManager/VirtualMailManager.py:485
+#: VirtualMailManager/VirtualMailManager.py:515
+msgid "Invalid argument: »%s«"
+msgstr "Ungültiges Argument: »%s«"
-#: VirtualMailManager/VirtualMailManager.py:546
+#: VirtualMailManager/VirtualMailManager.py:557
msgid "The pattern '%s' contains invalid characters."
msgstr "Das Muster '%s' enthält ungültige Zeichen."
-#: vmm:33
+#: VirtualMailManager/VirtualMailManager.py:592
+msgid ""
+"The account has been successfully deleted from the database.\n"
+" But an error occurred while deleting the following directory:\n"
+" »%s«\n"
+" Reason: %s"
+msgstr ""
+"Der Account wurde erfolgreich aus der Datenbank gelöscht.\n"
+" Aber es trat ein Fehler auf beim Löschen des folgenden Verzeichnisses:\n"
+" »%s«\n"
+" Grund: %s"
+
+#: VirtualMailManager/VirtualMailManager.py:624
+msgid "Account doesn't exists"
+msgstr "Der Account existiert nicht"
+
+#: vmm:45
msgid ""
"Usage: %s SUBCOMMAND OBJECT ARGS*\n"
" short long\n"
@@ -278,122 +314,118 @@
" Unterbefehl Objekt args (* = optional)\n"
"\n"
-#: vmm:64 vmm:73 vmm:341 vmm:395
+#: vmm:76 vmm:85 vmm:362 vmm:414
msgid "Error"
msgstr "Fehler"
-#: vmm:83 vmm:392
+#: vmm:96 vmm:412
msgid "Ouch"
msgstr "Autsch"
-#: vmm:110
+#: vmm:123
msgid "information"
msgstr "Informationen"
-#: vmm:120
+#: vmm:137
msgid "Available"
msgstr "Verfügbare"
-#: vmm:123 vmm:196
+#: vmm:140 vmm:213
msgid "alias domains"
msgstr "Alias-Domains"
-#: vmm:133 vmm:144 vmm:162
+#: vmm:150 vmm:161 vmm:179
msgid "\tNone"
msgstr "\tKeine"
-#: vmm:137
+#: vmm:154
msgid "Alias information"
msgstr "Alias Informationen"
-#: vmm:139
+#: vmm:156
msgid "\tMail for %s goes to:"
msgstr "\tE-Mails für %s gehen an:"
-#: vmm:157
+#: vmm:174
msgid "Available domains"
msgstr "Verfügbare Domains"
-#: vmm:159
+#: vmm:176
msgid "Matching domains"
msgstr "Übereinstimmende Domains"
-#: vmm:174 vmm:182 vmm:190
+#: vmm:191 vmm:199 vmm:207
msgid "Missing domain name."
msgstr "Kein Domain-Name angegeben."
-#: vmm:192 vmm:195
+#: vmm:209 vmm:212
msgid "Domain"
msgstr "Domain"
-#: vmm:197
+#: vmm:214
msgid "accounts"
msgstr "Accounts"
-#: vmm:198
+#: vmm:215
msgid "aliases"
msgstr "Aliase"
-#: vmm:202
+#: vmm:219
msgid "Missing domain name and new transport."
msgstr "Domain-Name und neuer Transport fehlen."
-#: vmm:204
+#: vmm:221
msgid "Missing new transport."
msgstr "Neuer Transport fehlt."
-#: vmm:213
+#: vmm:230
msgid "Missing alias domain name and target domain name."
msgstr "Domain-Namen für Alias- und Ziel-Domain fehlen."
-#: vmm:215
+#: vmm:232
msgid "Missing target domain name."
msgstr "Keine Ziel-Domain angegeben."
-#: vmm:221
+#: vmm:238
msgid "Missing alias domain name."
msgstr "Keine Alias-Domain angegeben."
-#: vmm:227 vmm:236 vmm:242 vmm:266 vmm:274 vmm:282
+#: vmm:244 vmm:253 vmm:259 vmm:283 vmm:291 vmm:299
msgid "Missing e-mail address."
msgstr "E-Mail-Adresse fehlt."
-#: vmm:250
+#: vmm:267
msgid "Missing e-mail address and users name."
msgstr "E-Mail-Adresse und der Name des Benutzers fehlen."
-#: vmm:252
+#: vmm:269
msgid "Missing users name."
msgstr "Name des Benutzers fehlt."
-#: vmm:258
+#: vmm:275
msgid "Missing e-mail address and transport."
msgstr "E-Mail-Adresse und Transport fehlen."
-#: vmm:260
+#: vmm:277
msgid "Missing transport."
msgstr "Transport fehlt."
-#: vmm:291
+#: vmm:308
msgid "Missing alias address and destination."
msgstr "Alias- und Ziel-Adresse fehlen."
-#: vmm:297 vmm:303
+#: vmm:314 vmm:320
msgid "Missing alias address"
msgstr "Alias-Adresse fehlt."
-#: vmm:311
+#: vmm:328
msgid "Missing userid"
msgstr "Keine UID angegeben."
-#: vmm:324
-msgid ""
-"\n"
-"Warnings:"
-msgstr ""
-"\n"
-"Warnungen:"
+#: vmm:341
+msgid "Warnings:"
+msgstr "Warnungen:"
-#: vmm:389
+#: vmm:409
msgid "Unknown subcommand"
msgstr "Unbekannter Unterbefehl"
--- a/po/vmm.pot Sat Aug 16 02:48:36 2008 +0000
+++ b/po/vmm.pot Mon Aug 18 01:56:31 2008 +0000
@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: vmm 0.5\n"
-"POT-Creation-Date: 2008-08-16 04:27+CEST\n"
+"POT-Creation-Date: 2008-08-18 03:08+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"
@@ -15,253 +15,280 @@
"Generated-By: pygettext.py 1.5\n"
-#: VirtualMailManager/Account.py:45
-msgid "There is already an alias with address '%s'"
+#: VirtualMailManager/Account.py:40
+msgid "There is already an alias with the address \302\273%s\302\253."
msgstr ""
-#: VirtualMailManager/Account.py:77 VirtualMailManager/Alias.py:74
-msgid "Domain '%s' doesn't exist."
-msgstr ""
-
-#: VirtualMailManager/Account.py:96
-msgid "Unknown service '%s'"
+#: VirtualMailManager/Account.py:72
+msgid "Domain \302\273%s\302\253 doesn't exist."
msgstr ""
-#: VirtualMailManager/Account.py:99 VirtualMailManager/Account.py:156
-#: VirtualMailManager/Account.py:183 VirtualMailManager/Account.py:211
-#: VirtualMailManager/Account.py:231
-#: VirtualMailManager/VirtualMailManager.py:600
-msgid "Account doesn't exists"
+#: VirtualMailManager/Account.py:91
+msgid "Unknown service \302\273%s\302\253."
msgstr ""
-#: VirtualMailManager/Account.py:151
-msgid "Account already exists."
+#: VirtualMailManager/Account.py:94 VirtualMailManager/Account.py:151
+#: VirtualMailManager/Account.py:178 VirtualMailManager/Account.py:206
+msgid "The account \302\273%s\302\253 doesn't exists."
msgstr ""
-#: VirtualMailManager/Account.py:191
+#: VirtualMailManager/Account.py:146
+msgid "The account \302\273%s\302\253 already exists."
+msgstr ""
+
+#: VirtualMailManager/Account.py:186
msgid "enabled"
msgstr ""
-#: VirtualMailManager/Account.py:193
+#: VirtualMailManager/Account.py:188
msgid "disabled"
msgstr ""
-#: VirtualMailManager/Account.py:219
+#: VirtualMailManager/Account.py:214
msgid "uid must be an int/long."
msgstr ""
-#: VirtualMailManager/Account.py:222
+#: VirtualMailManager/Account.py:217
msgid "uid must be greater than 0."
msgstr ""
-#: VirtualMailManager/Alias.py:31
+#: VirtualMailManager/Account.py:227
+msgid "There is no account with the UID \302\273%d\302\253."
+msgstr ""
+
+#: VirtualMailManager/Alias.py:25
msgid "Address and destination are identical."
msgstr ""
-#: VirtualMailManager/Alias.py:44
+#: VirtualMailManager/Alias.py:38
msgid "There is already an account with address '%s'"
msgstr ""
-#: VirtualMailManager/Alias.py:80
+#: VirtualMailManager/Alias.py:68
+msgid "Domain '%s' doesn't exist."
+msgstr ""
+
+#: VirtualMailManager/Alias.py:74
msgid "No destination address for alias denoted."
msgstr ""
-#: VirtualMailManager/Alias.py:89
+#: VirtualMailManager/Alias.py:83
msgid "Alias already exists."
msgstr ""
-#: VirtualMailManager/Alias.py:104 VirtualMailManager/Alias.py:120
+#: VirtualMailManager/Alias.py:98 VirtualMailManager/Alias.py:114
msgid "Alias doesn't exists"
msgstr ""
-#: VirtualMailManager/Config.py:101
+#: VirtualMailManager/Config.py:100
msgid ""
"missing section: %s\n"
msgstr ""
-#: VirtualMailManager/Config.py:103
+#: VirtualMailManager/Config.py:102
msgid ""
"missing options in section %s:\n"
msgstr ""
-#: VirtualMailManager/Config.py:119
+#: VirtualMailManager/Config.py:118
msgid "Argument 'sections' is not a list."
msgstr ""
-#: VirtualMailManager/Config.py:132
-msgid "* Config section: %s"
+#: VirtualMailManager/Config.py:131
+msgid "* Config section: \302\273%s\302\253"
msgstr ""
#: VirtualMailManager/Config.py:134
-msgid "Enter new value for %s [%s]: "
+msgid "Enter new value for option %s [%s]: "
msgstr ""
-#: VirtualMailManager/Domain.py:78 VirtualMailManager/Domain.py:156
+#: VirtualMailManager/Domain.py:73 VirtualMailManager/Domain.py:151
msgid "Domain already exists."
msgstr ""
-#: VirtualMailManager/Domain.py:81
+#: VirtualMailManager/Domain.py:76
msgid "Domain alias already exists."
msgstr ""
-#: VirtualMailManager/Domain.py:135
+#: VirtualMailManager/Domain.py:130
msgid "There are accounts and aliases."
msgstr ""
-#: VirtualMailManager/Domain.py:138
+#: VirtualMailManager/Domain.py:133
msgid "There are accounts."
msgstr ""
-#: VirtualMailManager/Domain.py:141
+#: VirtualMailManager/Domain.py:136
msgid "There are aliases."
msgstr ""
-#: VirtualMailManager/Domain.py:174 VirtualMailManager/Domain.py:198
-#: VirtualMailManager/Domain.py:215 VirtualMailManager/Domain.py:245
+#: VirtualMailManager/Domain.py:169 VirtualMailManager/Domain.py:193
+#: VirtualMailManager/Domain.py:210 VirtualMailManager/Domain.py:240
msgid "Domain doesn't exist yet."
msgstr ""
+#: VirtualMailManager/MailLocation.py:34
+msgid "Either mid or maillocation must be specified."
+msgstr ""
+
#: VirtualMailManager/MailLocation.py:40
-msgid "Either mid or maillocation must be specified."
-msgstr ""
-
-#: VirtualMailManager/MailLocation.py:46
msgid "mid must be an int/long."
msgstr ""
-#: VirtualMailManager/MailLocation.py:61
+#: VirtualMailManager/MailLocation.py:55
msgid "Unknown mid specified."
msgstr ""
+#: VirtualMailManager/Transport.py:35
+msgid "Either tid or transport must be specified."
+msgstr ""
+
#: VirtualMailManager/Transport.py:41
-msgid "Either tid or transport must be specified."
-msgstr ""
-
-#: VirtualMailManager/Transport.py:47
msgid "tid must be an int/long."
msgstr ""
-#: VirtualMailManager/Transport.py:62
+#: VirtualMailManager/Transport.py:56
msgid "Unknown tid specified."
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:55
+#: VirtualMailManager/VirtualMailManager.py:51
msgid ""
-"fix permissions for '%s'\n"
+"fix permissions for \302\273%s\302\253\n"
"`chmod 0600 %s` would be great."
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:62
+#: VirtualMailManager/VirtualMailManager.py:58
msgid ""
"You are not root.\n"
"\tGood bye!\n"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:76
-msgid "The file '%s' does not exists."
+#: VirtualMailManager/VirtualMailManager.py:72
+msgid "The file \302\273%s\302\253 does not exists."
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:98
-msgid "%s is not a directory"
+#: VirtualMailManager/VirtualMailManager.py:94
+msgid ""
+"\302\273%s\302\253 is not a directory.\n"
+"(vmm.cfg: section \"domdir\", option \"base\")"
+msgstr ""
+
+#: VirtualMailManager/VirtualMailManager.py:99
+msgid ""
+"\302\273%s\302\253 doesn't exists.\n"
+"(vmm.cfg: section \"bin\", option \"%s\")"
msgstr ""
#: VirtualMailManager/VirtualMailManager.py:102
-msgid "%s doesn't exists."
+msgid ""
+"\302\273%s\302\253 is not executable.\n"
+"(vmm.cfg: section \"bin\", option \"%s\")"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:105
-msgid "%s is not executable."
+#: VirtualMailManager/VirtualMailManager.py:136
+msgid "No localpart specified."
msgstr ""
#: VirtualMailManager/VirtualMailManager.py:139
-msgid "The local part is too long"
-msgstr ""
-
-#: VirtualMailManager/VirtualMailManager.py:143
-msgid "The local part '%s' contains invalid characters."
+msgid "The local part \302\273%s\302\253 is too long"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:183
-msgid "The domain name is too long."
+#: VirtualMailManager/VirtualMailManager.py:147
+msgid "The local part \302\273%s\302\253 contains invalid characters: %s"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:187
-msgid "The domain name is invalid."
+#: VirtualMailManager/VirtualMailManager.py:191
+msgid "The domain name is too long."
msgstr ""
#: VirtualMailManager/VirtualMailManager.py:195
-msgid "Missing '@' sign in e-mail address '%s'."
+msgid "The domain name is invalid."
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:198
-msgid "'%s' looks not like an e-mail address."
+#: VirtualMailManager/VirtualMailManager.py:204
+msgid "Missing '@' sign in e-mail address \302\273%s\302\253."
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:216
+#: VirtualMailManager/VirtualMailManager.py:207
+msgid "\302\273%s\302\253 looks not like an e-mail address."
+msgstr ""
+
+#: VirtualMailManager/VirtualMailManager.py:225
msgid "Enter new password: "
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:219
+#: VirtualMailManager/VirtualMailManager.py:228
msgid "Sorry, empty passwords are not permitted"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:220
+#: VirtualMailManager/VirtualMailManager.py:229
msgid "Retype new password: "
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:223
+#: VirtualMailManager/VirtualMailManager.py:232
msgid "Sorry, passwords do not match"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:259
+#: VirtualMailManager/VirtualMailManager.py:268
msgid "No such directory: %s"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:317
-msgid "FATAL: \"..\" in maildir path detected."
+#: VirtualMailManager/VirtualMailManager.py:326
+msgid "Found \"..\" in maildir path."
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:325
-msgid "FATAL: owner/group mismatch in maildir detected"
+#: VirtualMailManager/VirtualMailManager.py:334
+msgid "Owner/group mismatch in maildir detected."
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:329
+#: VirtualMailManager/VirtualMailManager.py:338
msgid "No such directory: %s/%s"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:340
+#: VirtualMailManager/VirtualMailManager.py:349
msgid "FATAL: \"..\" in domain directory path detected."
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:346
+#: VirtualMailManager/VirtualMailManager.py:355
msgid "FATAL: group mismatch in domain directory detected"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:433
+#: VirtualMailManager/VirtualMailManager.py:442
msgid ""
"Configurtion error: \"%s\"\n"
-"(in section \"connfig\", option \"done\")'\n"
-"see also: vmm.cfg(5)\n"
+"(in section \"connfig\", option \"done\") see also: vmm.cfg(5)\n"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:452
+#: VirtualMailManager/VirtualMailManager.py:461
msgid "Invalid section: '%s'"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:466
-#: VirtualMailManager/VirtualMailManager.py:476
+#: VirtualMailManager/VirtualMailManager.py:475
msgid "Invalid argument: '%s'"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:506
-msgid "Invalid argument"
+#: VirtualMailManager/VirtualMailManager.py:485
+#: VirtualMailManager/VirtualMailManager.py:515
+msgid "Invalid argument: \302\273%s\302\253"
msgstr ""
-#: VirtualMailManager/VirtualMailManager.py:546
+#: VirtualMailManager/VirtualMailManager.py:557
msgid "The pattern '%s' contains invalid characters."
msgstr ""
-#: vmm:33
+#: VirtualMailManager/VirtualMailManager.py:592
+msgid ""
+"The account has been successfully deleted from the database.\n"
+" But an error occurred while deleting the following directory:\n"
+" \302\273%s\302\253\n"
+" Reason: %s"
+msgstr ""
+
+#: VirtualMailManager/VirtualMailManager.py:624
+msgid "Account doesn't exists"
+msgstr ""
+
+#: vmm:45
msgid ""
"Usage: %s SUBCOMMAND OBJECT ARGS*\n"
" short long\n"
@@ -269,121 +296,119 @@
"\n"
msgstr ""
-#: vmm:64 vmm:73 vmm:341 vmm:395
+#: vmm:76 vmm:85 vmm:362 vmm:414
msgid "Error"
msgstr ""
-#: vmm:83 vmm:392
+#: vmm:96 vmm:412
msgid "Ouch"
msgstr ""
-#: vmm:110
+#: vmm:123
msgid "information"
msgstr ""
-#: vmm:120
-msgid "Available"
-msgstr ""
-
-#: vmm:123 vmm:196
-msgid "alias domains"
-msgstr ""
-
-#: vmm:133 vmm:144 vmm:162
-msgid "\tNone"
-msgstr ""
-
#: vmm:137
+msgid "Available"
+msgstr ""
+
+#: vmm:140 vmm:213
+msgid "alias domains"
+msgstr ""
+
+#: vmm:150 vmm:161 vmm:179
+msgid "\tNone"
+msgstr ""
+
+#: vmm:154
msgid "Alias information"
msgstr ""
-#: vmm:139
+#: vmm:156
msgid "\tMail for %s goes to:"
msgstr ""
-#: vmm:157
+#: vmm:174
msgid "Available domains"
msgstr ""
-#: vmm:159
+#: vmm:176
msgid "Matching domains"
msgstr ""
-#: vmm:174 vmm:182 vmm:190
+#: vmm:191 vmm:199 vmm:207
msgid "Missing domain name."
msgstr ""
-#: vmm:192 vmm:195
+#: vmm:209 vmm:212
msgid "Domain"
msgstr ""
-#: vmm:197
+#: vmm:214
msgid "accounts"
msgstr ""
-#: vmm:198
+#: vmm:215
msgid "aliases"
msgstr ""
-#: vmm:202
+#: vmm:219
msgid "Missing domain name and new transport."
msgstr ""
-#: vmm:204
+#: vmm:221
msgid "Missing new transport."
msgstr ""
-#: vmm:213
+#: vmm:230
msgid "Missing alias domain name and target domain name."
msgstr ""
-#: vmm:215
+#: vmm:232
msgid "Missing target domain name."
msgstr ""
-#: vmm:221
+#: vmm:238
msgid "Missing alias domain name."
msgstr ""
-#: vmm:227 vmm:236 vmm:242 vmm:266 vmm:274 vmm:282
+#: vmm:244 vmm:253 vmm:259 vmm:283 vmm:291 vmm:299
msgid "Missing e-mail address."
msgstr ""
-#: vmm:250
+#: vmm:267
msgid "Missing e-mail address and users name."
msgstr ""
-#: vmm:252
+#: vmm:269
msgid "Missing users name."
msgstr ""
-#: vmm:258
+#: vmm:275
msgid "Missing e-mail address and transport."
msgstr ""
-#: vmm:260
+#: vmm:277
msgid "Missing transport."
msgstr ""
-#: vmm:291
+#: vmm:308
msgid "Missing alias address and destination."
msgstr ""
-#: vmm:297 vmm:303
+#: vmm:314 vmm:320
msgid "Missing alias address"
msgstr ""
-#: vmm:311
+#: vmm:328
msgid "Missing userid"
msgstr ""
-#: vmm:324
-msgid ""
-"\n"
-"Warnings:"
+#: vmm:341
+msgid "Warnings:"
msgstr ""
-#: vmm:389
+#: vmm:409
msgid "Unknown subcommand"
msgstr ""
--- a/vmm Sat Aug 16 02:48:36 2008 +0000
+++ b/vmm Mon Aug 18 01:56:31 2008 +0000
@@ -13,6 +13,7 @@
__revision__ = 'rev '+'$Rev$'.split()[1]
__date__ = '$Date$'.split()[1]
+import locale
import os
import sys
import gettext
@@ -23,11 +24,22 @@
import VirtualMailManager.constants.EXIT as EXIT
import VirtualMailManager.constants.ERROR as ERR
+locale.setlocale(locale.LC_ALL, '')
+ENCODING = locale.nl_langinfo(locale.CODESET)
__prog__ = os.path.basename(sys.argv[0])
-gettext.bindtextdomain(__prog__, '/usr/local/share/locale')
-gettext.textdomain(__prog__)
-_ = gettext.gettext
+gettext.install(__prog__, '/usr/local/share/locale', unicode=1)
+
+def w_err(code, *args):
+ for arg in args:
+ sys.stderr.write(arg.encode(ENCODING, 'replace'))
+ sys.stderr.write('\n')
+ sys.exit(code)
+
+def w_std(*args):
+ for arg in args:
+ sys.stdout.write(arg.encode(ENCODING, 'replace'))
+ sys.stdout.write('\n')
def usage(excode=0, errMsg=None):
sys.stderr.write(_("""\
@@ -70,30 +82,31 @@
return vmm
except (VMME.VMMException, VMME.VMMNotRootException, VMME.VMMPermException,
VMME.VMMConfigException), e:
- sys.stderr.write("%s: %s\n" % (_('Error'),e[0][0]))
- sys.exit(e[0][1])
+ w_err(e[0][1], "%s: %s\n" % (_('Error'),e[0][0]))
def configure():
try:
- if len(sys.argv) < 3:
+ if len(argv) < 3:
vmm.configure()
else:
- vmm.configure(sys.argv[2])
+ vmm.configure(argv[2])
except (EOFError, KeyboardInterrupt):
- sys.stderr.write('\n%s!\n' % _('Ouch'))
- sys.exit(EXIT.USER_INTERRUPT)
+ #sys.stderr.write('\n%s!\n' % _('Ouch'))
+ #sys.exit(EXIT.USER_INTERRUPT)
+ w_err(EXIT.USER_INTERRUPT, '\n%s!\n' % _('Ouch'))
except VMME.VMMConfigException, e:
- sys.stderr.write(str(e))
- sys.exit(ERR.CONF_ERROR)
+ #sys.stderr.write(str(e))
+ #sys.exit(ERR.CONF_ERROR)
+ w_err(ERR.CONF_ERROR, str(e))
sys.exit(0)
def _getOrder():
order = ()
- if sys.argv[1] in ['di', 'domaininfo']:
+ if argv[1] in ['di', 'domaininfo']:
order = (('domainname', 0), ('gid', 1), ('transport', 0),
('domaindir', 0), ('aliasdomains', 0), ('accounts', 0),
('aliases', 0))
- elif sys.argv[1] in ['ui', 'userinfo']:
+ elif argv[1] in ['ui', 'userinfo']:
if argc == 4 or vmm.cfgGetBoolean('maildir', 'diskusage'):
order = (('address', 0), ('name', 0), ('uid', 1), ('gid', 1),
('transport', 0), ('maildir', 0), ('disk usage', 0),
@@ -102,18 +115,21 @@
order = (('address', 0), ('name', 0), ('uid', 1), ('gid', 1),
('transport', 0), ('maildir', 0), ('smtp', 1), ('pop3', 1),
('imap', 1), ('managesieve', 1))
- elif sys.argv[1] in ['gu', 'getuser']:
+ elif argv[1] in ['gu', 'getuser']:
order = (('uid', 1), ('gid', 1), ('address', 0))
return order
def _printInfo(info, title):
msg = '%s %s' % (title, _('information'))
- print '%s\n%s' % (msg, '-'*len(msg))
+ #print '%s\n%s' % (msg, '-'*len(msg))
+ w_std ('%s\n%s' % (msg, '-'*len(msg)))
for k,u in _getOrder():
if u:
- print '\t%s: %s' % (k.upper().ljust(15, '.'), info[k])
+ #print '\t%s: %s' % (k.upper().ljust(15, '.'), info[k])
+ w_std('\t%s: %s' % (k.upper().ljust(15, '.'), info[k]))
else:
- print '\t%s: %s' % (k.title().ljust(15, '.'), info[k])
+ #print '\t%s: %s' % (k.title().ljust(15, '.'), info[k])
+ w_std('\t%s: %s' % (k.title().ljust(15, '.'), info[k]))
print
def _printList(alist, title):
@@ -173,25 +189,25 @@
if argc < 3:
usage(EXIT.MISSING_ARGS, _('Missing domain name.'))
elif argc < 4:
- vmm.domain_add(sys.argv[2].lower())
+ vmm.domain_add(argv[2].lower())
else:
- vmm.domain_add(sys.argv[2].lower(), sys.argv[3])
+ vmm.domain_add(argv[2].lower(), argv[3])
def domain_delete():
if argc < 3:
usage(EXIT.MISSING_ARGS, _('Missing domain name.'))
elif argc < 4:
- vmm.domain_delete(sys.argv[2].lower())
+ vmm.domain_delete(argv[2].lower())
else:
- vmm.domain_delete(sys.argv[2].lower(), sys.argv[3])
+ vmm.domain_delete(argv[2].lower(), argv[3])
def domain_info():
if argc < 3:
usage(EXIT.MISSING_ARGS, _('Missing domain name.'))
elif argc < 4:
- _printInfo(vmm.domain_info(sys.argv[2].lower()), _('Domain'))
+ _printInfo(vmm.domain_info(argv[2].lower()), _('Domain'))
else:
- infos = vmm.domain_info(sys.argv[2].lower(), sys.argv[3])
+ infos = vmm.domain_info(argv[2].lower(), argv[3])
_printInfo(infos[0], _('Domain'))
_printList(infos[1], _('alias domains'))
_printList(infos[2], _('accounts'))
@@ -203,9 +219,9 @@
if argc < 4:
usage(EXIT.MISSING_ARGS, _('Missing new transport.'))
elif argc < 5:
- vmm.domain_transport(sys.argv[2].lower(), sys.argv[3])
+ vmm.domain_transport(argv[2].lower(), argv[3])
else:
- vmm.domain_transport(sys.argv[2].lower(), sys.argv[3], sys.argv[4])
+ vmm.domain_transport(argv[2].lower(), argv[3], argv[4])
def domain_alias_add():
if argc < 3:
@@ -214,13 +230,13 @@
elif argc < 4:
usage(EXIT.MISSING_ARGS, _('Missing target domain name.'))
else:
- vmm.domain_alias_add(sys.argv[2].lower(), sys.argv[3].lower())
+ vmm.domain_alias_add(argv[2].lower(), argv[3].lower())
def domain_alias_delete():
if argc < 3:
usage(EXIT.MISSING_ARGS, _('Missing alias domain name.'))
else:
- vmm.domain_alias_delete(sys.argv[2].lower())
+ vmm.domain_alias_delete(argv[2].lower())
def user_add():
if argc < 3:
@@ -228,22 +244,22 @@
elif argc < 4:
password = None
else:
- password = sys.argv[3]
- vmm.user_add(sys.argv[2].lower(), password)
+ password = argv[3]
+ vmm.user_add(argv[2].lower(), password)
def user_delete():
if argc < 3:
usage(EXIT.MISSING_ARGS, _('Missing e-mail address.'))
else:
- vmm.user_delete(sys.argv[2].lower())
+ vmm.user_delete(argv[2].lower())
def user_info():
if argc < 3:
usage(EXIT.MISSING_ARGS, _('Missing e-mail address.'))
elif argc < 4:
- _printInfo(vmm.user_info(sys.argv[2].lower()), 'Account')
+ _printInfo(vmm.user_info(argv[2].lower()), 'Account')
else:
- _printInfo(vmm.user_info(sys.argv[2].lower(), True), 'Account')
+ _printInfo(vmm.user_info(argv[2].lower(), True), 'Account')
def user_name():
if argc < 3:
@@ -251,7 +267,7 @@
if argc < 4:
usage(EXIT.MISSING_ARGS, _('Missing users name.'))
else:
- vmm.user_name(sys.argv[2].lower(), sys.argv[3])
+ vmm.user_name(argv[2].lower(), argv[3])
def user_transport():
if argc < 3:
@@ -259,23 +275,23 @@
if argc <4:
usage(EXIT.MISSING_ARGS, _('Missing transport.'))
else:
- vmm.user_transport(sys.argv[2].lower(), sys.argv[3])
+ vmm.user_transport(argv[2].lower(), argv[3])
def user_enable():
if argc < 3:
usage(EXIT.MISSING_ARGS, _('Missing e-mail address.'))
elif argc < 4:
- vmm.user_enable(sys.argv[2].lower())
+ vmm.user_enable(argv[2].lower())
else:
- vmm.user_enable(sys.argv[2].lower(), sys.argv[3].lower())
+ vmm.user_enable(argv[2].lower(), argv[3].lower())
def user_disable():
if argc < 3:
usage(EXIT.MISSING_ARGS, _('Missing e-mail address.'))
elif argc < 4:
- vmm.user_disable(sys.argv[2].lower())
+ vmm.user_disable(argv[2].lower())
else:
- vmm.user_disable(sys.argv[2].lower(), sys.argv[3].lower())
+ vmm.user_disable(argv[2].lower(), argv[3].lower())
def user_password():
if argc < 3:
@@ -283,114 +299,115 @@
elif argc < 4:
password = None
else:
- password = sys.argv[3]
- vmm.user_password(sys.argv[2].lower(), password)
+ password = argv[3]
+ vmm.user_password(argv[2].lower(), password)
def alias_add():
if argc < 4:
usage(EXIT.MISSING_ARGS, _('Missing alias address and destination.'))
else:
- vmm.alias_add(sys.argv[2].lower(), sys.argv[3])
+ vmm.alias_add(argv[2].lower(), argv[3])
def alias_info():
if argc < 3:
usage(EXIT.MISSING_ARGS, _('Missing alias address'))
else:
- _printAliases(sys.argv[2], vmm.alias_info(sys.argv[2].lower()))
+ _printAliases(argv[2], vmm.alias_info(argv[2].lower()))
def alias_delete():
if argc < 3:
usage(EXIT.MISSING_ARGS, _('Missing alias address'))
elif argc < 4:
- vmm.alias_delete(sys.argv[2].lower())
+ vmm.alias_delete(argv[2].lower())
else:
- vmm.alias_delete(sys.argv[2].lower(), sys.argv[3].lower())
+ vmm.alias_delete(argv[2].lower(), argv[3].lower())
def user_byID():
if argc < 3:
usage(EXIT.MISSING_ARGS, _('Missing userid'))
else:
- _printInfo(vmm.user_byID(sys.argv[2]), 'Account')
+ _printInfo(vmm.user_byID(argv[2]), 'Account')
def domain_list():
if argc < 3:
order, doms = vmm.domain_list()
else:
- order, doms = vmm.domain_list(sys.argv[2].lower())
+ order, doms = vmm.domain_list(argv[2].lower())
_printDomList(order, doms)
def showWarnings():
if vmm.hasWarnings():
- print _('\nWarnings:')
+ print _(u'Warnings:')
for w in vmm.getWarnings():
print " * ",w
#def main():
if __name__ == '__main__':
argc = len(sys.argv)
+ argv = [unicode(arg, ENCODING) for arg in sys.argv]
if argc < 2:
usage(EXIT.MISSING_ARGS)
vmm = getVMM()
try:
- if sys.argv[1] in ['cf', 'configure'] or not vmm.setupIsDone():
+ if argv[1] in ['cf', 'configure'] or not vmm.setupIsDone():
configure()
except VMME.VMMConfigException, e:
- sys.stderr.write(str(e))
- sys.exit(ERR.CONF_ERROR)
+ #sys.stderr.write(str(e))
+ #sys.exit(ERR.CONF_ERROR)
+ w_err(ERR.CONF_ERROR, str(e))
except VMME.VMMException, e:
- sys.stderr.write("%s: %s\n" % (_('Error'), e[0][0]))
- sys.exit(e[0][1])
+ #sys.stderr.write("%s: %s\n" % (_('Error'), e[0][0]))
+ #sys.exit(e[0][1])
+ w_err(e[0][1], "%s: %s\n" % (_('Error'), e[0][0]))
try:
- if sys.argv[1] in ['da', 'domainadd']:
+ if argv[1] in ['da', 'domainadd']:
domain_add()
- elif sys.argv[1] in ['di', 'domaininfo']:
+ elif argv[1] in ['di', 'domaininfo']:
domain_info()
- elif sys.argv[1] in ['dt', 'domaintransport']:
+ elif argv[1] in ['dt', 'domaintransport']:
domain_transport()
- elif sys.argv[1] in ['dd', 'domaindelete']:
+ elif argv[1] in ['dd', 'domaindelete']:
domain_delete()
- elif sys.argv[1] in ['daa', 'domainaliasadd']:
+ elif argv[1] in ['daa', 'domainaliasadd']:
domain_alias_add()
- elif sys.argv[1] in ['dad', 'domainaliasdelete']:
+ elif argv[1] in ['dad', 'domainaliasdelete']:
domain_alias_delete()
- elif sys.argv[1] in ['ua', 'useradd']:
+ elif argv[1] in ['ua', 'useradd']:
user_add()
- elif sys.argv[1] in ['ui', 'userinfo']:
+ elif argv[1] in ['ui', 'userinfo']:
user_info()
- elif sys.argv[1] in ['un', 'username']:
+ elif argv[1] in ['un', 'username']:
user_name()
- elif sys.argv[1] in ['up', 'userpassword']:
+ elif argv[1] in ['up', 'userpassword']:
user_password()
- elif sys.argv[1] in ['ut', 'usertransport']:
+ elif argv[1] in ['ut', 'usertransport']:
user_transport()
- elif sys.argv[1] in ['u0', 'userdisable']:
+ elif argv[1] in ['u0', 'userdisable']:
user_disable()
- elif sys.argv[1] in ['u1', 'userenable']:
+ elif argv[1] in ['u1', 'userenable']:
user_enable()
- elif sys.argv[1] in ['ud', 'userdelete']:
+ elif argv[1] in ['ud', 'userdelete']:
user_delete()
- elif sys.argv[1] in ['aa', 'aliasadd']:
+ elif argv[1] in ['aa', 'aliasadd']:
alias_add()
- elif sys.argv[1] in ['ai', 'aliasinfo']:
+ elif argv[1] in ['ai', 'aliasinfo']:
alias_info()
- elif sys.argv[1] in ['ad', 'aliasdelete']:
+ elif argv[1] in ['ad', 'aliasdelete']:
alias_delete()
- elif sys.argv[1] in ['gu', 'getuser']:
+ elif argv[1] in ['gu', 'getuser']:
user_byID()
- elif sys.argv[1] in ['ld', 'listdomains']:
+ elif argv[1] in ['ld', 'listdomains']:
domain_list()
- elif sys.argv[1] in ['h', 'help']:
+ elif argv[1] in ['h', 'help']:
usage()
- elif sys.argv[1] in ['v', 'version']:
+ elif argv[1] in ['v', 'version']:
print "%s, version %s (%s from %s)\n" % (__prog__, __version__,
__revision__, __date__)
else:
usage(EXIT.UNKNOWN_COMMAND,
- "%s: '%s'" % (_('Unknown subcommand'), sys.argv[1]))
+ "%s: '%s'" % (_(u'Unknown subcommand'), argv[1]))
showWarnings()
except (EOFError, KeyboardInterrupt):
- sys.stderr.write('\n%s!\n' % _('Ouch'))
- sys.exit(EXIT.USER_INTERRUPT)
+ w_err(EXIT.USER_INTERRUPT, '\n%s!\n' % _('Ouch'))
except VMME.VMMException, e:
- sys.stderr.write("%s: %s\n" % (_('Error'), e[0][0]))
- sys.exit(e[0][1])
+ w_err(e[0][1], "%s: %s" % (_('Error'), e[0][0]))