summaryrefslogtreecommitdiff
path: root/src/python/Period.py
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2013-05-04 21:39:27 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2013-05-04 21:39:27 +0000
commitfec6336699f34758d3e6cb41b2edf902fedb9035 (patch)
tree8256c1dbf3ca7c9e58a3dbecf07cf826fb2e0ce2 /src/python/Period.py
parent7dbffd7e2b0067e834801617c5c486e3177f6709 (diff)
downloadlibical-master.tar.gz
Diffstat (limited to 'src/python/Period.py')
-rw-r--r--src/python/Period.py34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/python/Period.py b/src/python/Period.py
index a9a4777..fb99816 100644
--- a/src/python/Period.py
+++ b/src/python/Period.py
@@ -76,13 +76,13 @@ class Period(Property):
raise Property.ConstructorFailedError("Failed to construct Period")
def _end_is_duration(self):
- dur = icalperiodtype_duration_get(self.pt)
+ dur = self.pt.duration
if not icaldurationtype_is_null_duration(dur):
return 1
return 0
def _end_is_time(self):
- end = icalperiodtype_end_get(self.pt)
+ end = self.pt.end
if not icaltime_is_null_time(end):
return 1
return 0
@@ -112,12 +112,12 @@ class Period(Property):
else:
raise TypeError
- icalperiodtype_start_set(self.pt,t.tt)
+ self.pt.start = t.tt
self._update_value()
- return Time(icaltime_as_timet(icalperiodtype_start_get(self.pt)),
+ return Time(self.pt.start.as_timet(),
"DTSTART")
def end(self,v=None):
@@ -139,23 +139,22 @@ class Period(Property):
raise TypeError
if(self._end_is_duration()):
- start = icaltime_as_timet(icalperiodtype_start_get(self.pt))
+ start = self.pt.start.as_timet()
dur = t.utc_seconds()-start;
- icalperiodtype_duration_set(self.pt,
- icaldurationtype_from_int(dur))
+ self.pt.duration = icaldurationtype_from_int(dur)
else:
- icalperiodtype_end_set(self.pt,t.tt)
+ self.pt.end = t.tt
self._update_value()
if(self._end_is_time()):
- rt = Time(icaltime_as_timet(icalperiodtype_end_get(self.pt)),
+ rt = Time(self.pt.end.as_timet(),
'DTEND')
rt.timezone(self.timezone())
return rt
elif(self._end_is_duration()):
- start = icaltime_as_timet(icalperiodtype_start_get(self.pt))
- dur = icaldurationtype_as_int(icalperiodtype_duration_get(self.pt))
+ start = self.pt.start.as_timet()
+ dur = icaldurationtype_as_int(self.pt.duration)
rt = Time(start+dur,'DTEND')
rt.timezone(self.timezone())
return rt
@@ -183,24 +182,23 @@ class Period(Property):
raise TypeError
if(self._end_is_time()):
- start = icaltime_as_timet(icalperiodtype_start_get(self.pt))
+ start = self.pt.start.as_timet()
end = start + d.seconds()
- icalperiodtype_end_set(self.pt,icaltime_from_timet(end,0))
+ self.pt.end = icaltimetype.from_timet(end)
else:
- icalperiodtype_duration_set(self.pt,d.dur)
+ self.pt.duration = d.dur
if(self._end_is_time()):
- start =icaltime_as_timet(icalperiodtype_start_get(self.pt))
- end = icaltime_as_timet(icalperiodtype_end_get(self.pt))
+ start = self.pt.start.as_timet()
+ end = self.pt.end.as_timet()
print "End is time " + str(end-start)
return Duration(end-start,"DURATION")
elif(self._end_is_duration()):
- dur = icaldurationtype_as_int(
- icalperiodtype_duration_get(self.pt))
+ dur = icaldurationtype_as_int(self.pt.duration)
return Duration(dur,"DURATION")
else: