Ignore:
Timestamp:
19 Jun 2011, 13:30:15 (14 years ago)
Author:
Henrik Bettermann
Message:

Add access code attributes 'state' and 'history'.

Location:
main/waeup.sirp/branches/accesscodes-with-workflow/src/waeup/sirp/accesscodes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/branches/accesscodes-with-workflow/src/waeup/sirp/accesscodes/accesscodes.py

    r6403 r6406  
    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
     10    )
    911from random import SystemRandom as random
    10 from waeup.sirp.interfaces import IWAeUPSIRPPluggable
     12from waeup.sirp.interfaces import IWAeUPSIRPPluggable, IObjectHistory
    1113from waeup.sirp.accesscodes.interfaces import (
    1214    IAccessCode, IAccessCodeBatch, IAccessCodeBatchContainer
     
    5153            return None
    5254        return self.batch.cost
     55
     56    @property
     57    def state(self):
     58        state = IWorkflowState(self).getState()
     59        return state
     60
     61    @property
     62    def history(self):
     63        history = IObjectHistory(self)
     64        return history
    5365
    5466class AccessCodeBatch(grok.Model):
  • main/waeup.sirp/branches/accesscodes-with-workflow/src/waeup/sirp/accesscodes/interfaces.py

    r6403 r6406  
    22"""
    33from zope import schema
    4 from zope.interface import Interface
     4from zope.interface import Interface, Attribute
    55from waeup.sirp.interfaces import IWAeUPObject
    66
     
    88    """An access code.
    99    """
     10    history = Attribute('Object history, a list of messages.')
     11    state = Attribute('Returns the workflow state of an accesscode')
     12
    1013    batch_serial = schema.Int(
    1114        title = u'Serial number inside batch',
Note: See TracChangeset for help on using the changeset viewer.