Package vobject :: Module icalendar :: Class RecurringComponent
[show private | hide private]
[frames | no frames]

Type RecurringComponent

object --+        
         |        
     VBase --+    
             |    
     Component --+
                 |
                RecurringComponent


A vCalendar component like VEVENT or VTODO which may recur.

Any recurring component can have one or multiple RRULE, RDATE, EXRULE, or EXDATE lines, and one or zero DTSTART lines. It can also have a variety of children that don't have any recurrence information.

In the example below, note that dtstart is included in the rruleset. This is not the default behavior for dateutil's rrule implementation unless dtstart would already have been a member of the recurrence rule, and as a result, COUNT is wrong. This can be worked around when getting rruleset by adjusting count down by one if an rrule has a count and dtstart isn't in its result set, but by default, the rruleset property doesn't do this work around, to access it getrruleset must be called with addRDate set True.
>>> import dateutil.rrule, datetime
>>> vevent = RecurringComponent(name='VEVENT')
>>> vevent.add('rrule').value =u"FREQ=WEEKLY;COUNT=2;INTERVAL=2;BYDAY=TU,TH"
>>> vevent.add('dtstart').value = datetime.datetime(2005, 1, 19, 9)
When creating rrule's programmatically it should be kept in mind that count doesn't necessarily mean what rfc2445 says.
>>> list(vevent.rruleset)
[datetime.datetime(2005, 1, 20, 9, 0), datetime.datetime(2005, 2, 1, 9, 0)]

>>> list(vevent.getrruleset(addRDate=True))
[datetime.datetime(2005, 1, 19, 9, 0), datetime.datetime(2005, 1, 20, 9, 0)]
Also note that dateutil will expand all-day events (datetime.date values) to datetime.datetime value with time 0 and no timezone.
>>> vevent.dtstart[0].value = datetime.date(2005,3,18)
>>> list(vevent.rruleset)
[datetime.datetime(2005, 3, 29, 0, 0), datetime.datetime(2005, 3, 31, 0, 0)]

>>> list(vevent.getrruleset(True))
[datetime.datetime(2005, 3, 18, 0, 0), datetime.datetime(2005, 3, 29, 0, 0)]

Method Summary
  __init__(self, *args, **kwds)
  __setattr__(self, name, value)
For convenience, make self.contents directly accessible.
  getrruleset(self, addRDate)
Get an rruleset created from self.
  setrruleset(self, rruleset)
    Inherited from Component
  __getattr__(self, name)
For convenience, make self.contents directly accessible.
  __repr__(self)
  __str__(self)
  add(self, objOrName, group)
Add objOrName to contents, set behavior if it can be inferred.
  components(self)
Return an iterable of all Component children.
  getChildren(self)
Return an iterable of all children.
  getSortedChildren(self)
  lines(self)
Return an iterable of all ContentLine children.
  prettyPrint(self, level, tabwidth)
  setBehaviorFromVersionLine(self, versionLine)
Set behavior if one matches name, versionLine.value.
  setProfile(self, name)
Assign a PROFILE to this unnamed component.
  sortChildKeys(self)
  transformChildrenFromNative(self, clearBehavior)
Recursively transform native children to vanilla representations.
  transformChildrenToNative(self)
Recursively replace children with their native representation.
    Inherited from VBase
  autoBehavior(self, cascade)
Set behavior if name is in self.parentBehavior.knownChildren.
  clearBehavior(self, cascade)
Set behavior to None.
  serialize(self, buf, lineLength, validate)
Serialize to buf if it exists, otherwise return a string.
  setBehavior(self, behavior, cascade)
Set behavior.
  transformFromNative(self)
Return self transformed into a ContentLine or Component if needed.
  transformToNative(self)
Transform this object into a custom VBase subclass.
  validate(self, *args, **kwds)
Call the behavior's validate method, or return True.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle

Property Summary
  rruleset

Instance Variable Summary
  rruleset = vobject.icalendar.RecurringComponent.rruleset
    Inherited from Component
  contents: A dictionary of lists of Component or ContentLine instances.
  name: Uppercase string used to represent this Component, i.e VCARD if the serialized object starts with BEGIN:VCARD.
  useBegin: A boolean flag determining whether BEGIN: and END: lines should be serialized.
    Inherited from VBase
  behavior: The Behavior class associated with this object, which controls validation, transformations, and encoding.
  group: An optional group prefix, should be used only to indicate sort order in vCards, according to RFC2426
  isNative: Boolean describing whether this component is a Native instance.
  parentBehavior: The object's parent's behavior, or None if no behaviored parent exists.

Method Details

__setattr__(self, name, value)

For convenience, make self.contents directly accessible.
Overrides:
vobject.vobject.Component.__setattr__

getrruleset(self, addRDate=False)

Get an rruleset created from self.

If addRDate is True, add an RDATE for dtstart if it's not included in an RRULE, and count is decremented if it exists.

Note that for rules which don't match DTSTART, DTSTART may not appear in list(rruleset), although it should. By default, an RDATE is not created in these cases, and count isn't updated, so dateutil may list a spurious occurrence.

Property Details

rruleset

Get Method:
getrruleset(self, addRDate)
Set Method:
setrruleset(self, rruleset)

Generated by Epydoc 2.1 on Fri Dec 14 17:25:15 2007 http://epydoc.sf.net