imip-agent

Change of imiptools/content.py

381:f5fe45d84ecc
imiptools/content.py recurring-events
     1.1 --- a/imiptools/content.py	Thu Mar 05 15:26:50 2015 +0100
     1.2 +++ b/imiptools/content.py	Thu Mar 05 16:30:13 2015 +0100
     1.3 @@ -28,7 +28,8 @@
     1.4                             is_new_object, uri_dict, uri_item, uri_values
     1.5  from imiptools.dates import format_datetime, get_default_timezone, to_timezone
     1.6  from imiptools.period import can_schedule, insert_period, remove_period, \
     1.7 -                             remove_affected_period, update_freebusy
     1.8 +                             remove_additional_periods, remove_affected_period, \
     1.9 +                             update_freebusy
    1.10  from imiptools.profile import Preferences
    1.11  from socket import gethostname
    1.12  import imip_store
    1.13 @@ -172,15 +173,19 @@
    1.14  
    1.15          remove_period(freebusy, self.uid, self.recurrenceid)
    1.16  
    1.17 -    def remove_freebusy_for_original_recurrence(self, freebusy):
    1.18 +    def remove_freebusy_for_recurrences(self, freebusy):
    1.19  
    1.20          """
    1.21 -        Remove from 'freebusy' any specific recurrence from parent free/busy
    1.22 -        details for the current object.
    1.23 +        Remove from 'freebusy' any original recurrence from parent free/busy
    1.24 +        details for the current object, if the current object is a specific
    1.25 +        additional recurrence. Otherwise, remove all additional recurrence
    1.26 +        information.
    1.27          """
    1.28  
    1.29          if self.recurrenceid:
    1.30              remove_affected_period(freebusy, self.uid, self.recurrenceid)
    1.31 +        else:
    1.32 +            remove_additional_periods(freebusy, self.uid)
    1.33  
    1.34      def _update_freebusy(self, freebusy, periods, recurrenceid, transp=None):
    1.35  
    1.36 @@ -242,12 +247,7 @@
    1.37          self.update_freebusy_for_participant(freebusy, periods, participant_attr,
    1.38              for_organiser and self.is_not_attendee(participant, self.obj))
    1.39  
    1.40 -        # Subtract any recurrences from the free/busy details of a parent
    1.41 -        # object.
    1.42 -
    1.43 -        for recurrenceid in self.store.get_recurrences(user, self.uid):
    1.44 -            remove_affected_period(freebusy, self.uid, recurrenceid)
    1.45 -
    1.46 +        self.remove_freebusy_for_recurrences(freebusy)
    1.47          self.store.set_freebusy_for_other(user, freebusy, participant)
    1.48  
    1.49      def update_freebusy_from_organiser(self, attendee, organiser_item):