Ignore:
Timestamp:
20 Jun 2011, 00:30:10 (13 years ago)
Author:
uli
Message:

Start to make the whole accesscode story work again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/accesscodes.py

    r6408 r6413  
    66from BTrees.OIBTree import OIBTree
    77from datetime import datetime
    8 from hurry.workflow.interfaces import IWorkflowInfo, InvalidTransitionError
     8from hurry.workflow.interfaces import (
     9    IWorkflowInfo, InvalidTransitionError, IWorkflowState)
    910from random import SystemRandom as random
    1011from waeup.sirp.interfaces import IWAeUPSIRPPluggable
     
    1213    IAccessCode, IAccessCodeBatch, IAccessCodeBatchContainer
    1314    )
    14 from waeup.sirp.accesscodes.workflow import DISABLED
     15from waeup.sirp.accesscodes.workflow import DISABLED, USED
    1516
    1617class ManageACBatches(grok.Permission):
     
    5152            return None
    5253        return self.batch.cost
     54
     55    @property
     56    def disabled(self):
     57        return IWorkflowState(self).getState() == DISABLED
     58
     59    @property
     60    def used(self):
     61        return IWorkflowState(self).getState() == USED
    5362
    5463class AccessCodeBatch(grok.Model):
     
    454463    meanings.
    455464    """
    456     ac = get_access_code(access_code)
    457     if ac:
    458         info = IWorkflowInfo(ac)
    459         return _fire_transition(info, 'use')
    460     else:
    461         False
     465    return fire_transition(access_code, 'use')
    462466
    463467def disable_accesscode(access_code):
Note: See TracChangeset for help on using the changeset viewer.