PageRenderTime 34ms CodeModel.GetById 11ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 0ms

/gdata/calendar/data.py

http://radioappz.googlecode.com/
Python | 300 lines | 259 code | 20 blank | 21 comment | 0 complexity | 4f56084ff94e31dbbf633773e349e239 MD5 | raw file
  1#!/usr/bin/python
  2#
  3# Copyright (C) 2009 Google Inc.
  4#
  5# Licensed under the Apache License, Version 2.0 (the "License");
  6# you may not use this file except in compliance with the License.
  7# You may obtain a copy of the License at
  8#
  9#      http://www.apache.org/licenses/LICENSE-2.0
 10#
 11# Unless required by applicable law or agreed to in writing, software
 12# distributed under the License is distributed on an "AS IS" BASIS,
 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14# See the License for the specific language governing permissions and
 15# limitations under the License.
 16
 17
 18"""Contains the data classes of the Google Calendar Data API"""
 19
 20
 21__author__ = 'j.s@google.com (Jeff Scudder)'
 22
 23
 24import atom.core
 25import atom.data
 26import gdata.acl.data
 27import gdata.data
 28import gdata.geo.data
 29import gdata.opensearch.data
 30
 31
 32GCAL_TEMPLATE = '{http://schemas.google.com/gCal/2005/}%s'
 33
 34
 35class AccessLevelProperty(atom.core.XmlElement):
 36  """Describes how much a given user may do with an event or calendar"""
 37  _qname = GCAL_TEMPLATE % 'accesslevel'
 38  value = 'value'
 39
 40
 41class AllowGSync2Property(atom.core.XmlElement):
 42  """Whether the user is permitted to run Google Apps Sync"""
 43  _qname = GCAL_TEMPLATE % 'allowGSync2'
 44  value = 'value'
 45
 46
 47class AllowGSyncProperty(atom.core.XmlElement):
 48  """Whether the user is permitted to run Google Apps Sync"""
 49  _qname = GCAL_TEMPLATE % 'allowGSync'
 50  value = 'value'
 51
 52
 53class AnyoneCanAddSelfProperty(atom.core.XmlElement):
 54  """Whether anyone can add self as attendee"""
 55  _qname = GCAL_TEMPLATE % 'anyoneCanAddSelf'
 56  value = 'value'
 57
 58
 59class CalendarAclRole(gdata.acl.data.AclRole):
 60  """Describes the Calendar roles of an entry in the Calendar access control list"""
 61  _qname = gdata.acl.data.GACL_TEMPLATE % 'role'
 62
 63
 64class CalendarCommentEntry(gdata.data.GDEntry):
 65  """Describes an entry in a feed of a Calendar event's comments"""
 66
 67
 68class CalendarCommentFeed(gdata.data.GDFeed):
 69  """Describes feed of a Calendar event's comments"""
 70  entry = [CalendarCommentEntry]
 71
 72
 73class CalendarComments(gdata.data.Comments):
 74  """Describes a container of a feed link for Calendar comment entries"""
 75  _qname = gdata.data.GD_TEMPLATE % 'comments'
 76
 77
 78class CalendarExtendedProperty(gdata.data.ExtendedProperty):
 79  """Defines a value for the realm attribute that is used only in the calendar API"""
 80  _qname = gdata.data.GD_TEMPLATE % 'extendedProperty'
 81
 82
 83class CalendarWhere(gdata.data.Where):
 84  """Extends the base Where class with Calendar extensions"""
 85  _qname = gdata.data.GD_TEMPLATE % 'where'
 86
 87
 88class ColorProperty(atom.core.XmlElement):
 89  """Describes the color of a calendar"""
 90  _qname = GCAL_TEMPLATE % 'color'
 91  value = 'value'
 92
 93
 94class GuestsCanInviteOthersProperty(atom.core.XmlElement):
 95  """Whether guests can invite others to the event"""
 96  _qname = GCAL_TEMPLATE % 'guestsCanInviteOthers'
 97  value = 'value'
 98
 99
100class GuestsCanModifyProperty(atom.core.XmlElement):
101  """Whether guests can modify event"""
102  _qname = GCAL_TEMPLATE % 'guestsCanModify'
103  value = 'value'
104
105
106class GuestsCanSeeGuestsProperty(atom.core.XmlElement):
107  """Whether guests can see other attendees"""
108  _qname = GCAL_TEMPLATE % 'guestsCanSeeGuests'
109  value = 'value'
110
111
112class HiddenProperty(atom.core.XmlElement):
113  """Describes whether a calendar is hidden"""
114  _qname = GCAL_TEMPLATE % 'hidden'
115  value = 'value'
116
117
118class IcalUIDProperty(atom.core.XmlElement):
119  """Describes the UID in the ical export of the event"""
120  _qname = GCAL_TEMPLATE % 'uid'
121  value = 'value'
122
123
124class OverrideNameProperty(atom.core.XmlElement):
125  """Describes the override name property of a calendar"""
126  _qname = GCAL_TEMPLATE % 'overridename'
127  value = 'value'
128
129
130class PrivateCopyProperty(atom.core.XmlElement):
131  """Indicates whether this is a private copy of the event, changes to which should not be sent to other calendars"""
132  _qname = GCAL_TEMPLATE % 'privateCopy'
133  value = 'value'
134
135
136class QuickAddProperty(atom.core.XmlElement):
137  """Describes whether gd:content is for quick-add processing"""
138  _qname = GCAL_TEMPLATE % 'quickadd'
139  value = 'value'
140
141
142class ResourceProperty(atom.core.XmlElement):
143  """Describes whether gd:who is a resource such as a conference room"""
144  _qname = GCAL_TEMPLATE % 'resource'
145  value = 'value'
146  id = 'id'
147
148
149class EventWho(gdata.data.Who):
150  """Extends the base Who class with Calendar extensions"""
151  _qname = gdata.data.GD_TEMPLATE % 'who'
152  resource = ResourceProperty
153
154
155class SelectedProperty(atom.core.XmlElement):
156  """Describes whether a calendar is selected"""
157  _qname = GCAL_TEMPLATE % 'selected'
158  value = 'value'
159
160
161class SendAclNotificationsProperty(atom.core.XmlElement):
162  """Describes whether to send ACL notifications to grantees"""
163  _qname = GCAL_TEMPLATE % 'sendAclNotifications'
164  value = 'value'
165
166
167class CalendarAclEntry(gdata.data.GDEntry):
168  """Describes an entry in a feed of a Calendar access control list (ACL)"""
169  send_acl_notifications = SendAclNotificationsProperty
170
171
172class CalendarAclFeed(gdata.data.GDFeed):
173  """Describes a Calendar access contorl list (ACL) feed"""
174  entry = [CalendarAclEntry]
175
176
177class SendEventNotificationsProperty(atom.core.XmlElement):
178  """Describes whether to send event notifications to other participants of the event"""
179  _qname = GCAL_TEMPLATE % 'sendEventNotifications'
180  value = 'value'
181
182
183class SequenceNumberProperty(atom.core.XmlElement):
184  """Describes sequence number of an event"""
185  _qname = GCAL_TEMPLATE % 'sequence'
186  value = 'value'
187
188
189class CalendarRecurrenceExceptionEntry(gdata.data.GDEntry):
190  """Describes an entry used by a Calendar recurrence exception entry link"""
191  uid = IcalUIDProperty
192  sequence = SequenceNumberProperty
193
194
195class CalendarRecurrenceException(gdata.data.RecurrenceException):
196  """Describes an exception to a recurring Calendar event"""
197  _qname = gdata.data.GD_TEMPLATE % 'recurrenceException'
198
199
200class SettingsProperty(atom.core.XmlElement):
201  """User preference name-value pair"""
202  _qname = GCAL_TEMPLATE % 'settingsProperty'
203  name = 'name'
204  value = 'value'
205
206
207class SettingsEntry(gdata.data.GDEntry):
208  """Describes a Calendar Settings property entry"""
209  settings_property = SettingsProperty
210
211
212class CalendarSettingsFeed(gdata.data.GDFeed):
213  """Personal settings for Calendar application"""
214  entry = [SettingsEntry]
215
216
217class SuppressReplyNotificationsProperty(atom.core.XmlElement):
218  """Lists notification methods to be suppressed for this reply"""
219  _qname = GCAL_TEMPLATE % 'suppressReplyNotifications'
220  methods = 'methods'
221
222
223class SyncEventProperty(atom.core.XmlElement):
224  """Describes whether this is a sync scenario where the Ical UID and Sequence number are honored during inserts and updates"""
225  _qname = GCAL_TEMPLATE % 'syncEvent'
226  value = 'value'
227
228
229class CalendarEventEntry(gdata.data.BatchEntry):
230  """Describes a Calendar event entry"""
231  quickadd = QuickAddProperty
232  send_event_notifications = SendEventNotificationsProperty
233  sync_event = SyncEventProperty
234  anyone_can_add_self = AnyoneCanAddSelfProperty
235  extended_property = [CalendarExtendedProperty]
236  sequence = SequenceNumberProperty
237  guests_can_invite_others = GuestsCanInviteOthersProperty
238  guests_can_modify = GuestsCanModifyProperty
239  guests_can_see_guests = GuestsCanSeeGuestsProperty
240  georss_where = gdata.geo.data.GeoRssWhere
241  private_copy = PrivateCopyProperty
242  suppress_reply_notifications = SuppressReplyNotificationsProperty
243  uid = IcalUIDProperty
244
245
246class TimeZoneProperty(atom.core.XmlElement):
247  """Describes the time zone of a calendar"""
248  _qname = GCAL_TEMPLATE % 'timezone'
249  value = 'value'
250
251
252class TimesCleanedProperty(atom.core.XmlElement):
253  """Describes how many times calendar was cleaned via Manage Calendars"""
254  _qname = GCAL_TEMPLATE % 'timesCleaned'
255  value = 'value'
256
257
258class CalendarEntry(gdata.data.GDEntry):
259  """Describes a Calendar entry in the feed of a user's calendars"""
260  timezone = TimeZoneProperty
261  overridename = OverrideNameProperty
262  hidden = HiddenProperty
263  selected = SelectedProperty
264  times_cleaned = TimesCleanedProperty
265  color = ColorProperty
266  where = [CalendarWhere]
267  accesslevel = AccessLevelProperty
268
269
270class CalendarEventFeed(gdata.data.BatchFeed):
271  """Describes a Calendar event feed"""
272  allow_g_sync2 = AllowGSync2Property
273  timezone = TimeZoneProperty
274  entry = [CalendarEventEntry]
275  times_cleaned = TimesCleanedProperty
276  allow_g_sync = AllowGSyncProperty
277
278
279class CalendarFeed(gdata.data.GDFeed):
280  """Describes a feed of Calendars"""
281  entry = [CalendarEntry]
282
283
284class WebContentGadgetPref(atom.core.XmlElement):
285  """Describes a single web content gadget preference"""
286  _qname = GCAL_TEMPLATE % 'webContentGadgetPref'
287  name = 'name'
288  value = 'value'
289
290
291class WebContent(atom.core.XmlElement):
292  """Describes a "web content" extension"""
293  _qname = GCAL_TEMPLATE % 'webContent'
294  height = 'height'
295  width = 'width'
296  web_content_gadget_pref = [WebContentGadgetPref]
297  url = 'url'
298  display = 'display'
299
300