equal
deleted
inserted
replaced
7 |
7 |
8 Virtual Mail Manager's QuotaLimit class to manage quota limits |
8 Virtual Mail Manager's QuotaLimit class to manage quota limits |
9 for domains and accounts. |
9 for domains and accounts. |
10 """ |
10 """ |
11 |
11 |
12 from VirtualMailManager.constants import VMM_ERROR |
|
13 from VirtualMailManager.errors import VMMError |
|
14 from VirtualMailManager.pycompat import all |
12 from VirtualMailManager.pycompat import all |
15 |
13 |
16 _ = lambda msg: msg |
14 _ = lambda msg: msg |
17 |
15 |
18 |
16 |
109 dbc.execute('SELECT bytes, messages FROM quotalimit WHERE qid = %s', |
107 dbc.execute('SELECT bytes, messages FROM quotalimit WHERE qid = %s', |
110 (qid,)) |
108 (qid,)) |
111 res = dbc.fetchone() |
109 res = dbc.fetchone() |
112 dbc.close() |
110 dbc.close() |
113 if not res: |
111 if not res: |
114 raise VMMError(_(u'Unknown quota limit id specified.'), VMM_ERROR) |
112 raise ValueError('Unknown quota limit id specified: %r' % qid) |
115 self._qid = qid |
113 self._qid = qid |
116 self._bytes, self._messages = res |
114 self._bytes, self._messages = res |
117 |
115 |
118 def _save(self): |
116 def _save(self): |
119 """Store a new quota limit in the database.""" |
117 """Store a new quota limit in the database.""" |