Home | Trees | Index | Help |
---|
Package vobject :: Module icalendar :: Class 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)
| |
For convenience, make self.contents directly accessible. | |
Get an rruleset created from self. | |
setrruleset(self,
rruleset)
| |
Inherited from Component | |
For convenience, make self.contents directly accessible. | |
| |
| |
Add objOrName to contents, set behavior if it can be inferred. | |
Return an iterable of all Component children. | |
Return an iterable of all children. | |
| |
Return an iterable of all ContentLine children. | |
| |
Set behavior if one matches name, versionLine.value. | |
Assign a PROFILE to this unnamed component. | |
| |
Recursively transform native children to vanilla representations. | |
Recursively replace children with their native representation. | |
Inherited from VBase | |
Set behavior if name is in self.parentBehavior.knownChildren. | |
Set behavior to None. | |
Serialize to buf if it exists, otherwise return a string. | |
Set behavior. | |
Return self transformed into a ContentLine or Component if needed. | |
Transform this object into a custom VBase subclass. | |
Call the behavior's validate method, or return True. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
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.
|
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
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Fri Dec 14 17:25:15 2007 | http://epydoc.sf.net |