Ignore:
Timestamp:
20 Jun 2011, 16:04:14 (13 years ago)
Author:
uli
Message:

Support batch-local counters for used/disabled pins. This time we only set a simple attribute and remove the enable(), disable(), ... methods that have no purpose any more.

File:
1 edited

Legend:

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

    r6421 r6425  
    3939    if batch is None:
    4040        return
    41     pin = context.representation
    42     batch.invalidate(pin)
     41    batch.used_num += 1
    4342    return
    4443
    45 def disable_action(wf, context):
    46     #batch = getattr(context, '__parent__', None)
    47     #if batch is None:
    48     #    return
    49     #pin = context.representation
    50     #batch.disable(pin)
     44def disable_used_action(wf, context):
     45    batch = getattr(context, '__parent__', None)
     46    if batch is None:
     47        return
     48    batch.used_num -= 1
     49    batch.disabled_num += 1
     50
     51def disable_unused_action(wf, context):
     52    batch = getattr(context, '__parent__', None)
     53    if batch is None:
     54        return
     55    batch.disabled_num += 1
    5156    return
    5257
     
    5560    if batch is None:
    5661        return
    57     pin = context.representation
    58     batch.enable(pin)
     62    batch.disabled_num -= 1
    5963    return
    6064
     
    7983        source = INITIALIZED,
    8084        destination = DISABLED,
    81         action = disable_action),
     85        action = disable_unused_action),
    8286
    8387    Transition(
     
    8690        source = USED,
    8791        destination = DISABLED,
    88         action = disable_action),
     92        action = disable_used_action),
    8993
    9094    Transition(
Note: See TracChangeset for help on using the changeset viewer.