imip-agent

Changeset

827:6ac2399abfca
2015-10-13 Paul Boddie raw files shortlog changelog graph Handle publishing of events to oneself.
imiptools/handlers/person.py (file)
     1.1 --- a/imiptools/handlers/person.py	Tue Oct 13 23:32:45 2015 +0200
     1.2 +++ b/imiptools/handlers/person.py	Tue Oct 13 23:33:25 2015 +0200
     1.3 @@ -119,6 +119,21 @@
     1.4  
     1.5          return True
     1.6  
     1.7 +    def _publish(self):
     1.8 +
     1.9 +        "Record details of a published event."
    1.10 +
    1.11 +        # Handle an event being published by the sender to themself.
    1.12 +
    1.13 +        organiser_item = self.require_organiser()
    1.14 +        if organiser_item:
    1.15 +            organiser, organiser_attr = organiser_item
    1.16 +            if self.user == organiser:
    1.17 +                self.store.set_event(self.user, self.uid, self.recurrenceid, self.obj.to_node())
    1.18 +                return True
    1.19 +
    1.20 +        return self._record(from_organiser=True, queue=False)
    1.21 +
    1.22      def _record(self, from_organiser=True, queue=False, cancel=False):
    1.23  
    1.24          """
    1.25 @@ -291,7 +306,7 @@
    1.26  
    1.27          "Register details of any relevant event."
    1.28  
    1.29 -        if self._record(from_organiser=True, queue=False):
    1.30 +        if self._publish():
    1.31              return self.wrap("Details of an event have been received.")
    1.32  
    1.33      def refresh(self):