- Timestamp:
- 1 Oct 2012, 21:18:48 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py
r9263 r9265 81 81 grok.implements(IAccessCode) 82 82 83 def __init__(self, batch_serial , random_num):83 def __init__(self, batch_serial=None, random_num=None): 84 84 super(AccessCode, self).__init__() 85 85 self.batch_serial = batch_serial … … 154 154 155 155 def __init__(self, creation_date=None, creator=None, batch_prefix=None, 156 cost=None, entry_num= None, num=None):156 cost=None, entry_num=0, num=None): 157 157 super(AccessCodeBatch, self).__init__() 158 158 self.creation_date = creation_date … … 317 317 318 318 def addBatchByImport(self, batch, batch_id): 319 """Add an already created `batch` by import 320 with defined id. 321 """ 319 """Add an already created `batch` by import with defined id. 320 321 We want to create a batch without access codes. Since num_entry 322 access codes are automatically added by handle_batch_added when 323 the batch is added to the ZODB, we have to temporarily set entry_num 324 to zero when adding the batch persistently. 325 """ 326 orig_entry_num = batch.entry_num 327 batch.entry_num = 0 322 328 self[batch_id] = batch 329 self._p_changed = True 330 batch.entry_num = orig_entry_num 323 331 return 324 332 … … 480 488 481 489 def __call__(self, *args, **kw): 482 return AccessCodeBatch( *args, **kw)490 return AccessCodeBatch() 483 491 484 492 def getInterfaces(self): 485 493 return implementedBy(AccessCodeBatch) 494 495 class AccessCodeFactory(grok.GlobalUtility): 496 """A factory for accesscodes. 497 498 We need this factory for the accesscodeprocessor. 499 """ 500 grok.implements(IFactory) 501 grok.name(u'waeup.AccessCode') 502 title = u"Create a new accesscode.", 503 description = u"This factory instantiates new accesscode instances." 504 505 def __call__(self, *args, **kw): 506 return AccessCode(*args, **kw) 507 508 def getInterfaces(self): 509 return implementedBy(AccessCode) 486 510 487 511 def get_access_code(access_code):
Note: See TracChangeset for help on using the changeset viewer.