Package caldavclientlibrary :: Package client :: Module calendar
[hide private]
[frames] | no frames]

Source Code for Module caldavclientlibrary.client.calendar

 1  ## 
 2  # Copyright (c) 2006-2016 Apple Inc. All rights reserved. 
 3  # 
 4  # Licensed under the Apache License, Version 2.0 (the "License"); 
 5  # you may not use this file except in compliance with the License. 
 6  # You may obtain a copy of the License at 
 7  # 
 8  # http://www.apache.org/licenses/LICENSE-2.0 
 9  # 
10  # Unless required by applicable law or agreed to in writing, software 
11  # distributed under the License is distributed on an "AS IS" BASIS, 
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13  # See the License for the specific language governing permissions and 
14  # limitations under the License. 
15  ## 
16   
17  from caldavclientlibrary.protocol.webdav.definitions import davxml 
18  from caldavclientlibrary.protocol.url import URL 
19  from caldavclientlibrary.protocol.caldav.definitions import caldavxml 
20   
21 -class Calendar(object):
22
23 - def __init__(self, path=None, session=None):
24 self.path = path 25 if not path.endswith("/"): 26 self.path += "/" 27 self.session = session 28 self.displayname = None 29 self.description = None 30 self.timezone = None
31
32 - def __str__(self):
33 return "Calendar: %s" % (self.path,)
34
35 - def __repr__(self):
36 return "Calendar: %s" % (self.path,)
37
38 - def exists(self):
39 return self.session.testResource(URL(url=self.path))
40
41 - def readCalendar(self):
42 pass
43 - def writeCalendar(self, calendar):
44 pass
45
46 - def readComponent(self, name=None, uid=None):
47 pass
48 - def writeComponent(self, component, name=None):
49 pass
50
51 - def getDisplayName(self):
52 if self.displayname is None and self.session: 53 self._getProperties() 54 return self.displayname
55
56 - def getDescription(self):
57 if self.description is None and self.session: 58 self._getProperties() 59 return self.description
60
61 - def _getProperties(self):
68