VirtualMailManager/Account.py
changeset 128 cf8116625866
parent 121 7ccc05774118
child 133 2d5c4745efec
equal deleted inserted replaced
127:97a9f6dd954b 128:cf8116625866
   142             self._dbh.commit()
   142             self._dbh.commit()
   143             dbc.close()
   143             dbc.close()
   144         else:
   144         else:
   145             raise AccE(_(u'The account »%s« already exists.') % self._addr,
   145             raise AccE(_(u'The account »%s« already exists.') % self._addr,
   146                     ERR.ACCOUNT_EXISTS)
   146                     ERR.ACCOUNT_EXISTS)
   147        
   147 
   148     def modify(self, what, value):
   148     def modify(self, what, value):
   149         if self._uid == 0:
   149         if self._uid == 0:
   150             raise AccE(_(u"The account »%s« doesn't exists.") % self._addr,
   150             raise AccE(_(u"The account »%s« doesn't exists.") % self._addr,
   151                     ERR.NO_SUCH_ACCOUNT)
   151                     ERR.NO_SUCH_ACCOUNT)
   152         if what not in ['name', 'password', 'transport']:
   152         if what not in ['name', 'password', 'transport']:
   246  uid, users.gid FROM users LEFT JOIN domain_name ON (domain_name.gid \
   246  uid, users.gid FROM users LEFT JOIN domain_name ON (domain_name.gid \
   247  = users.gid AND is_primary) WHERE uid = %s;", uid)
   247  = users.gid AND is_primary) WHERE uid = %s;", uid)
   248     info = dbc.fetchone()
   248     info = dbc.fetchone()
   249     dbc.close()
   249     dbc.close()
   250     if info is None:
   250     if info is None:
   251         raise AccE(_(u"There is no account with the UID »%d«.") % uid, 
   251         raise AccE(_(u"There is no account with the UID »%d«.") % uid,
   252                 ERR.NO_SUCH_ACCOUNT)
   252                 ERR.NO_SUCH_ACCOUNT)
   253     keys = ['address', 'uid', 'gid']
   253     keys = ['address', 'uid', 'gid']
   254     info = dict(zip(keys, info))
   254     info = dict(zip(keys, info))
   255     return info
   255     return info
   256 
   256