VirtualMailManager/quotalimit.py
branchv0.7.x
changeset 643 df1e3b67882a
parent 638 0de0b9e75c9f
child 670 f374ef062c94
equal deleted inserted replaced
642:4cd9d0a9f42f 643:df1e3b67882a
    40         self._dbh = dbh
    40         self._dbh = dbh
    41         self._qid = 0
    41         self._qid = 0
    42         self._bytes = 0
    42         self._bytes = 0
    43         self._messages = 0
    43         self._messages = 0
    44 
    44 
    45         for key in kwargs.iterkeys():
    45         for key in kwargs.keys():
    46             if key not in self.__class__._kwargs:
    46             if key not in self.__class__._kwargs:
    47                 raise ValueError('unrecognized keyword: %r' % key)
    47                 raise ValueError('unrecognized keyword: %r' % key)
    48         qid = kwargs.get('qid')
    48         qid = kwargs.get('qid')
    49         if qid is not None:
    49         if qid is not None:
    50             assert isinstance(qid, (int, long))
    50             assert isinstance(qid, int)
    51             self._load_by_qid(qid)
    51             self._load_by_qid(qid)
    52         else:
    52         else:
    53             bytes_, msgs = kwargs.get('bytes'), kwargs.get('messages')
    53             bytes_, msgs = kwargs.get('bytes'), kwargs.get('messages')
    54             assert all(isinstance(i, (int, long)) for i in (bytes_, msgs))
    54             assert all(isinstance(i, int) for i in (bytes_, msgs))
    55             self._bytes = -bytes_ if bytes_ < 0 else bytes_
    55             self._bytes = -bytes_ if bytes_ < 0 else bytes_
    56             self._messages = -msgs if msgs < 0 else msgs
    56             self._messages = -msgs if msgs < 0 else msgs
    57             self._load_by_limit()
    57             self._load_by_limit()
    58 
    58 
    59     @property
    59     @property