# HG changeset patch # User Paul Boddie # Date 1438019438 -7200 # Node ID 73a72890d46ac3d1dbca7088b028edc379932984 # Parent 214e7492b3d8c09047d0e186fe44e0c659735580 Moved various methods dependent on a current object to the appropriate class. diff -r 214e7492b3d8 -r 73a72890d46a imiptools/client.py --- a/imiptools/client.py Mon Jul 27 17:05:49 2015 +0200 +++ b/imiptools/client.py Mon Jul 27 19:50:38 2015 +0200 @@ -126,32 +126,6 @@ # Common operations on calendar data. - def is_participating(self, user, as_organiser=False): - - """ - Return whether, subject to the 'user' indicating an identity and the - 'as_organiser' status of that identity, the user concerned is actually - participating in the current object event. - """ - - attr = self.get_attendance(user) - return as_organiser or not attr or attr.get("PARTSTAT") != "DECLINED" - - def get_overriding_transparency(self, user, as_organiser=False): - - """ - Return the overriding transparency to be associated with the free/busy - records for an event, subject to the 'user' indicating an identity and - the 'as_organiser' status of that identity. - - Where an identity is only an organiser and not attending, "ORG" is - returned. Otherwise, no overriding transparency is defined and None is - returned. - """ - - attr = self.get_attendance(user) - return as_organiser and not (attr and attr.get("PARTSTAT")) and "ORG" or None - def update_participation(self, obj, partstat=None): """ @@ -311,6 +285,32 @@ attendees = uri_dict(self.obj.get_value_map("ATTENDEE")) return attendees.get(user or self.user) or {} + def is_participating(self, user, as_organiser=False): + + """ + Return whether, subject to the 'user' indicating an identity and the + 'as_organiser' status of that identity, the user concerned is actually + participating in the current object event. + """ + + attr = self.get_attendance(user) + return as_organiser or not attr or attr.get("PARTSTAT") != "DECLINED" + + def get_overriding_transparency(self, user, as_organiser=False): + + """ + Return the overriding transparency to be associated with the free/busy + records for an event, subject to the 'user' indicating an identity and + the 'as_organiser' status of that identity. + + Where an identity is only an organiser and not attending, "ORG" is + returned. Otherwise, no overriding transparency is defined and None is + returned. + """ + + attr = self.get_attendance(user) + return as_organiser and not (attr and attr.get("PARTSTAT")) and "ORG" or None + def is_attendee(self, identity, obj=None): """