1.1 --- a/imiptools/data.py Thu May 12 23:15:18 2016 +0200
1.2 +++ b/imiptools/data.py Fri May 13 00:22:56 2016 +0200
1.3 @@ -973,22 +973,35 @@
1.4 """
1.5 Using the 'attendee_map', check the attributes for the given 'attendee'
1.6 provided as 'attendee_attr', following the delegation chain back to the
1.7 - delegator and forward again to yield the delegate identity. Return
1.8 - whether this identity is the given 'attendee', providing the delegator
1.9 - identity; otherwise return None.
1.10 + delegators and forward again to yield the delegate identities in each
1.11 + case. Pictorially...
1.12 +
1.13 + attendee -> DELEGATED-FROM -> delegator
1.14 + ? <- DELEGATED-TO <---
1.15 +
1.16 + Return whether 'attendee' was identified as a delegate by providing the
1.17 + identity of any delegators referencing the attendee.
1.18 """
1.19
1.20 + delegators = []
1.21 +
1.22 # The recipient should have a reference to the delegator.
1.23
1.24 delegated_from = attendee_attr and attendee_attr.get("DELEGATED-FROM")
1.25 - delegated_from = delegated_from and delegated_from[0]
1.26 - delegator = delegated_from and attendee_map.get(delegated_from)
1.27 + if delegated_from:
1.28 +
1.29 + # Examine all delegators.
1.30 +
1.31 + for delegator in delegated_from:
1.32 + delegator_attr = attendee_map.get(delegator)
1.33
1.34 - # The delegator should have a reference to the recipient.
1.35 + # The delegator should have a reference to the recipient.
1.36
1.37 - delegated_to = delegator and delegator.get("DELEGATED-TO")
1.38 - delegated_to = delegated_to and delegated_to[0]
1.39 - return delegated_to == attendee and delegated_from or None
1.40 + delegated_to = delegator_attr and delegator_attr.get("DELEGATED-TO")
1.41 + if delegated_to and attendee in delegated_to:
1.42 + delegators.append(delegator)
1.43 +
1.44 + return delegators
1.45
1.46 def get_periods(obj, tzid, end=None, inclusive=False):
1.47