- Timestamp:
- 1 Oct 2012, 06:55:04 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py
r9260 r9263 32 32 from random import SystemRandom as random 33 33 from zope.component import getUtility 34 from zope.component.interfaces import IFactory 34 35 from waeup.kofa.interfaces import IKofaUtils, IKofaPluggable, IObjectHistory 35 36 from waeup.kofa.utils.helpers import now … … 152 153 grok.implements(IAccessCodeBatch) 153 154 154 def __init__(self, creation_date , creator, batch_prefix, cost,155 entry_num, num=None):155 def __init__(self, creation_date=None, creator=None, batch_prefix=None, 156 cost=None, entry_num=None, num=None): 156 157 super(AccessCodeBatch, self).__init__() 157 158 self.creation_date = creation_date 158 159 self.creator = creator 159 self.prefix = batch_prefix.upper() 160 try: 161 self.prefix = batch_prefix.upper() 162 except AttributeError: 163 self.prefix = None 160 164 self.cost = cost 161 165 self.entry_num = entry_num … … 310 314 self[key] = batch 311 315 self._p_changed = True 316 return 317 318 def addBatchByImport(self, batch, batch_id): 319 """Add an already created `batch` by import 320 with defined id. 321 """ 322 self[batch_id] = batch 323 return 312 324 313 325 def createBatch(self, creation_date, creator, prefix, cost, … … 457 469 return 458 470 471 class AccessCodeBatchFactory(grok.GlobalUtility): 472 """A factory for accesscodebatches. 473 474 We need this factory for the accesscodebatchprocessor. 475 """ 476 grok.implements(IFactory) 477 grok.name(u'waeup.AccessCodeBatch') 478 title = u"Create a new accesscode batch.", 479 description = u"This factory instantiates new accesscode batch instances." 480 481 def __call__(self, *args, **kw): 482 return AccessCodeBatch(*args, **kw) 483 484 def getInterfaces(self): 485 return implementedBy(AccessCodeBatch) 486 459 487 def get_access_code(access_code): 460 488 """Get an access code instance.
Note: See TracChangeset for help on using the changeset viewer.