signoffs.core.signing_order.signing_order#

Signoff sequence ordering automation, based on pattern matching Signoff instances to expected Types.

Module Contents#

Classes#

SigningOrder

A descriptor used to “inject” a SigningOrder Strategy object into its owner’s instances. The strategy_class provides a strategy for sequencing the owner’s signoffs (signet_set).

SigningOrderStrategyProtocol

Protocol for defining the API required to define a strategy for ordering a sequence of signoffs

SigningOrderPatternMatcher

Ordering Strategy: match a pattern of Signoff Types defining a “signing order” against a signets queryset.

API#

class signoffs.core.signing_order.signing_order.SigningOrder(*pattern, signet_set_accessor='signatories', strategy_class=None)[source]#

A descriptor used to “inject” a SigningOrder Strategy object into its owner’s instances. The strategy_class provides a strategy for sequencing the owner’s signoffs (signet_set).

Initialization

This descriptor injects a SigningOrderStrategyProtocol object to manage the signing order for the owner’s signet_set

pattern is a sequence of SigningOrderPattern objects (or Signoff Types, which are also legal Pattern tokens) defining the signing order, typically for an Approval, but any kind of owner object. pattern is passed directly through to the strategy_class constructor, so could, in theory, be anything. signet_set_accessor is string with name of callable or attribute for a Signet manager on that owner instance. strategy_class allows this descriptor to be re-used with other ordering strategies

default_strategy_class#

None

get_service_instance(owner_instance)[source]#

Return an instance of the strategy_class for the given owner instance

__get__(instance, owner=None)[source]#

Instantiate and return a strategy_class instance to provide SigningOrder services for the owning instance

class signoffs.core.signing_order.signing_order.SigningOrderStrategyProtocol[source]#

Bases: typing.Protocol

Protocol for defining the API required to define a strategy for ordering a sequence of signoffs

next_signoffs() list[source]#

Return a list of the next Signoff Type(s) available for signing in this signing order

is_complete() bool[source]#

Return True iff this signing order is complete (all required signoffs have been signed)

class signoffs.core.signing_order.signing_order.SigningOrderPatternMatcher(pattern: signoffs.core.signing_order.signoff_pattern.SigningOrderPattern, signets_queryset)[source]#

Ordering Strategy: match a pattern of Signoff Types defining a “signing order” against a signets queryset.

Implements SigningOrderStrategyProtocol match result object can answer questions like: - does the sequence of signoffs satisfy the pattern defined; and - what SignoffType(s) could be added to the sequence next?

Initialization

Match the signets queryset against the Singing Order pattern signet_set must be ordered chronologically (by timestamp), which is default ordering for Signet

property match#

Return a pm.MatchResult object for matching pattern against queryset (lazy evaluation)

next_signoffs() list[source]#

Return a list of the next Signoff Type(s) available for signing in this signing order

is_complete() bool[source]#

Return True iff this signing order is complete (all required signoffs have been signed)