/gdata/calendar/data.py

http://radioappz.googlecode.com/ · Python · 300 lines · 274 code · 10 blank · 16 comment · 9 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. """Contains the data classes of the Google Calendar Data API"""
  17. __author__ = 'j.s@google.com (Jeff Scudder)'
  18. import atom.core
  19. import atom.data
  20. import gdata.acl.data
  21. import gdata.data
  22. import gdata.geo.data
  23. import gdata.opensearch.data
  24. GCAL_TEMPLATE = '{http://schemas.google.com/gCal/2005/}%s'
  25. class AccessLevelProperty(atom.core.XmlElement):
  26. """Describes how much a given user may do with an event or calendar"""
  27. _qname = GCAL_TEMPLATE % 'accesslevel'
  28. value = 'value'
  29. class AllowGSync2Property(atom.core.XmlElement):
  30. """Whether the user is permitted to run Google Apps Sync"""
  31. _qname = GCAL_TEMPLATE % 'allowGSync2'
  32. value = 'value'
  33. class AllowGSyncProperty(atom.core.XmlElement):
  34. """Whether the user is permitted to run Google Apps Sync"""
  35. _qname = GCAL_TEMPLATE % 'allowGSync'
  36. value = 'value'
  37. class AnyoneCanAddSelfProperty(atom.core.XmlElement):
  38. """Whether anyone can add self as attendee"""
  39. _qname = GCAL_TEMPLATE % 'anyoneCanAddSelf'
  40. value = 'value'
  41. class CalendarAclRole(gdata.acl.data.AclRole):
  42. """Describes the Calendar roles of an entry in the Calendar access control list"""
  43. _qname = gdata.acl.data.GACL_TEMPLATE % 'role'
  44. class CalendarCommentEntry(gdata.data.GDEntry):
  45. """Describes an entry in a feed of a Calendar event's comments"""
  46. class CalendarCommentFeed(gdata.data.GDFeed):
  47. """Describes feed of a Calendar event's comments"""
  48. entry = [CalendarCommentEntry]
  49. class CalendarComments(gdata.data.Comments):
  50. """Describes a container of a feed link for Calendar comment entries"""
  51. _qname = gdata.data.GD_TEMPLATE % 'comments'
  52. class CalendarExtendedProperty(gdata.data.ExtendedProperty):
  53. """Defines a value for the realm attribute that is used only in the calendar API"""
  54. _qname = gdata.data.GD_TEMPLATE % 'extendedProperty'
  55. class CalendarWhere(gdata.data.Where):
  56. """Extends the base Where class with Calendar extensions"""
  57. _qname = gdata.data.GD_TEMPLATE % 'where'
  58. class ColorProperty(atom.core.XmlElement):
  59. """Describes the color of a calendar"""
  60. _qname = GCAL_TEMPLATE % 'color'
  61. value = 'value'
  62. class GuestsCanInviteOthersProperty(atom.core.XmlElement):
  63. """Whether guests can invite others to the event"""
  64. _qname = GCAL_TEMPLATE % 'guestsCanInviteOthers'
  65. value = 'value'
  66. class GuestsCanModifyProperty(atom.core.XmlElement):
  67. """Whether guests can modify event"""
  68. _qname = GCAL_TEMPLATE % 'guestsCanModify'
  69. value = 'value'
  70. class GuestsCanSeeGuestsProperty(atom.core.XmlElement):
  71. """Whether guests can see other attendees"""
  72. _qname = GCAL_TEMPLATE % 'guestsCanSeeGuests'
  73. value = 'value'
  74. class HiddenProperty(atom.core.XmlElement):
  75. """Describes whether a calendar is hidden"""
  76. _qname = GCAL_TEMPLATE % 'hidden'
  77. value = 'value'
  78. class IcalUIDProperty(atom.core.XmlElement):
  79. """Describes the UID in the ical export of the event"""
  80. _qname = GCAL_TEMPLATE % 'uid'
  81. value = 'value'
  82. class OverrideNameProperty(atom.core.XmlElement):
  83. """Describes the override name property of a calendar"""
  84. _qname = GCAL_TEMPLATE % 'overridename'
  85. value = 'value'
  86. class PrivateCopyProperty(atom.core.XmlElement):
  87. """Indicates whether this is a private copy of the event, changes to which should not be sent to other calendars"""
  88. _qname = GCAL_TEMPLATE % 'privateCopy'
  89. value = 'value'
  90. class QuickAddProperty(atom.core.XmlElement):
  91. """Describes whether gd:content is for quick-add processing"""
  92. _qname = GCAL_TEMPLATE % 'quickadd'
  93. value = 'value'
  94. class ResourceProperty(atom.core.XmlElement):
  95. """Describes whether gd:who is a resource such as a conference room"""
  96. _qname = GCAL_TEMPLATE % 'resource'
  97. value = 'value'
  98. id = 'id'
  99. class EventWho(gdata.data.Who):
  100. """Extends the base Who class with Calendar extensions"""
  101. _qname = gdata.data.GD_TEMPLATE % 'who'
  102. resource = ResourceProperty
  103. class SelectedProperty(atom.core.XmlElement):
  104. """Describes whether a calendar is selected"""
  105. _qname = GCAL_TEMPLATE % 'selected'
  106. value = 'value'
  107. class SendAclNotificationsProperty(atom.core.XmlElement):
  108. """Describes whether to send ACL notifications to grantees"""
  109. _qname = GCAL_TEMPLATE % 'sendAclNotifications'
  110. value = 'value'
  111. class CalendarAclEntry(gdata.data.GDEntry):
  112. """Describes an entry in a feed of a Calendar access control list (ACL)"""
  113. send_acl_notifications = SendAclNotificationsProperty
  114. class CalendarAclFeed(gdata.data.GDFeed):
  115. """Describes a Calendar access contorl list (ACL) feed"""
  116. entry = [CalendarAclEntry]
  117. class SendEventNotificationsProperty(atom.core.XmlElement):
  118. """Describes whether to send event notifications to other participants of the event"""
  119. _qname = GCAL_TEMPLATE % 'sendEventNotifications'
  120. value = 'value'
  121. class SequenceNumberProperty(atom.core.XmlElement):
  122. """Describes sequence number of an event"""
  123. _qname = GCAL_TEMPLATE % 'sequence'
  124. value = 'value'
  125. class CalendarRecurrenceExceptionEntry(gdata.data.GDEntry):
  126. """Describes an entry used by a Calendar recurrence exception entry link"""
  127. uid = IcalUIDProperty
  128. sequence = SequenceNumberProperty
  129. class CalendarRecurrenceException(gdata.data.RecurrenceException):
  130. """Describes an exception to a recurring Calendar event"""
  131. _qname = gdata.data.GD_TEMPLATE % 'recurrenceException'
  132. class SettingsProperty(atom.core.XmlElement):
  133. """User preference name-value pair"""
  134. _qname = GCAL_TEMPLATE % 'settingsProperty'
  135. name = 'name'
  136. value = 'value'
  137. class SettingsEntry(gdata.data.GDEntry):
  138. """Describes a Calendar Settings property entry"""
  139. settings_property = SettingsProperty
  140. class CalendarSettingsFeed(gdata.data.GDFeed):
  141. """Personal settings for Calendar application"""
  142. entry = [SettingsEntry]
  143. class SuppressReplyNotificationsProperty(atom.core.XmlElement):
  144. """Lists notification methods to be suppressed for this reply"""
  145. _qname = GCAL_TEMPLATE % 'suppressReplyNotifications'
  146. methods = 'methods'
  147. class SyncEventProperty(atom.core.XmlElement):
  148. """Describes whether this is a sync scenario where the Ical UID and Sequence number are honored during inserts and updates"""
  149. _qname = GCAL_TEMPLATE % 'syncEvent'
  150. value = 'value'
  151. class CalendarEventEntry(gdata.data.BatchEntry):
  152. """Describes a Calendar event entry"""
  153. quickadd = QuickAddProperty
  154. send_event_notifications = SendEventNotificationsProperty
  155. sync_event = SyncEventProperty
  156. anyone_can_add_self = AnyoneCanAddSelfProperty
  157. extended_property = [CalendarExtendedProperty]
  158. sequence = SequenceNumberProperty
  159. guests_can_invite_others = GuestsCanInviteOthersProperty
  160. guests_can_modify = GuestsCanModifyProperty
  161. guests_can_see_guests = GuestsCanSeeGuestsProperty
  162. georss_where = gdata.geo.data.GeoRssWhere
  163. private_copy = PrivateCopyProperty
  164. suppress_reply_notifications = SuppressReplyNotificationsProperty
  165. uid = IcalUIDProperty
  166. class TimeZoneProperty(atom.core.XmlElement):
  167. """Describes the time zone of a calendar"""
  168. _qname = GCAL_TEMPLATE % 'timezone'
  169. value = 'value'
  170. class TimesCleanedProperty(atom.core.XmlElement):
  171. """Describes how many times calendar was cleaned via Manage Calendars"""
  172. _qname = GCAL_TEMPLATE % 'timesCleaned'
  173. value = 'value'
  174. class CalendarEntry(gdata.data.GDEntry):
  175. """Describes a Calendar entry in the feed of a user's calendars"""
  176. timezone = TimeZoneProperty
  177. overridename = OverrideNameProperty
  178. hidden = HiddenProperty
  179. selected = SelectedProperty
  180. times_cleaned = TimesCleanedProperty
  181. color = ColorProperty
  182. where = [CalendarWhere]
  183. accesslevel = AccessLevelProperty
  184. class CalendarEventFeed(gdata.data.BatchFeed):
  185. """Describes a Calendar event feed"""
  186. allow_g_sync2 = AllowGSync2Property
  187. timezone = TimeZoneProperty
  188. entry = [CalendarEventEntry]
  189. times_cleaned = TimesCleanedProperty
  190. allow_g_sync = AllowGSyncProperty
  191. class CalendarFeed(gdata.data.GDFeed):
  192. """Describes a feed of Calendars"""
  193. entry = [CalendarEntry]
  194. class WebContentGadgetPref(atom.core.XmlElement):
  195. """Describes a single web content gadget preference"""
  196. _qname = GCAL_TEMPLATE % 'webContentGadgetPref'
  197. name = 'name'
  198. value = 'value'
  199. class WebContent(atom.core.XmlElement):
  200. """Describes a "web content" extension"""
  201. _qname = GCAL_TEMPLATE % 'webContent'
  202. height = 'height'
  203. width = 'width'
  204. web_content_gadget_pref = [WebContentGadgetPref]
  205. url = 'url'
  206. display = 'display'