Changeset 8847 for main/waeup.kofa/trunk/src/waeup/kofa/mandates/mandate.py
- Timestamp:
- 29 Jun 2012, 10:21:03 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/mandates/mandate.py
r8846 r8847 20 20 """ 21 21 import grok 22 import hashlib 22 23 from datetime import datetime, timedelta 24 from time import time 23 25 from grok import index 24 26 from waeup.kofa.interfaces import IUserAccount … … 32 34 grok.provides(IMandate) 33 35 34 def __init__(self, days=1 ):36 def __init__(self, days=1, category=None, mandate_id=None): 35 37 super(Mandate, self).__init__() 36 38 self.creation_date = datetime.utcnow() # offset-naive datetime 37 39 delta = timedelta(days=days) 38 40 self.expires = datetime.utcnow() + delta 39 self.mandate_id = None 40 self.category = None 41 if mandate_id is None: 42 timestamp = "%d" % int(time()*1000) 43 mandate_id = hashlib.md5(timestamp).hexdigest() 44 self.mandate_id = mandate_id 45 self.category = category 41 46 self.params = {} 42 47 return
Note: See TracChangeset for help on using the changeset viewer.