Logo Search packages:      
Sourcecode: calendarserver version File versions  Download package

def twistedcaldav::ical::Component::expandComponent (   self,
  instance,
  first 
)

Create an expanded component based on the instance provided.
NB Expansion also requires UTC conversions.
@param instance: an L{Instance} for the instance being expanded.
@return: a new L{Component} for the expanded instance.

Definition at line 701 of file ical.py.

00701                                               :
        """
        Create an expanded component based on the instance provided.
        NB Expansion also requires UTC conversions.
        @param instance: an L{Instance} for the instance being expanded.
        @return: a new L{Component} for the expanded instance.
        """
        
        # Duplicate the component from the instance
        newcomp = instance.component.duplicate()
 
        # Strip out unwanted recurrence properties
        for property in newcomp.properties():
            if property.name() in ["RRULE", "RDATE", "EXRULE", "EXDATE", "RECURRENCE-ID"]:
                newcomp.removeProperty(property)
        
        # Convert all datetime properties to UTC unless they are floating
        for property in newcomp.properties():
            if isinstance(property.value(), datetime.datetime) and property.value().tzinfo is not None:
                property.setValue(property.value().astimezone(utc))
        
        # Now reset DTSTART, DTEND/DURATION
        for property in newcomp.properties("DTSTART"):
            property.setValue(instance.start)
        for property in newcomp.properties("DTEND"):
            property.setValue(instance.end)
        for property in newcomp.properties("DURATION"):
            property.setValue(instance.end - instance.start)
        
        # Add RECURRENCE-ID if not first instance
        if not first:
            newcomp.addProperty(Property("RECURRENCE-ID", instance.rid))
            newcomp.transformAllToNative()

        return newcomp

    def expandTimeRanges(self, limit):


Generated by  Doxygen 1.6.0   Back to index