PageRenderTime 40ms CodeModel.GetById 17ms app.highlight 17ms RepoModel.GetById 2ms app.codeStats 0ms

/gdata/projecthosting/data.py

http://radioappz.googlecode.com/
Python | 134 lines | 61 code | 39 blank | 34 comment | 0 complexity | c9796764f46d6059db0e41a4e3498698 MD5 | raw file
  1#!/usr/bin/env python
  2#
  3# Copyright 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# This module is used for version 2 of the Google Data APIs.
 19
 20
 21"""Provides classes and constants for XML in the Google Project Hosting API.
 22
 23Canonical documentation for the raw XML which these classes represent can be
 24found here: http://code.google.com/p/support/wiki/IssueTrackerAPI
 25"""
 26
 27
 28__author__ = 'jlapenna@google.com (Joe LaPenna)'
 29
 30import atom.core
 31import gdata.data
 32
 33
 34ISSUES_TEMPLATE = '{http://schemas.google.com/projecthosting/issues/2009}%s'
 35
 36
 37ISSUES_FULL_FEED = '/feeds/issues/p/%s/issues/full'
 38COMMENTS_FULL_FEED = '/feeds/issues/p/%s/issues/%s/comments/full'
 39
 40
 41class Uri(atom.core.XmlElement):
 42  """The issues:uri element."""
 43  _qname = ISSUES_TEMPLATE % 'uri'
 44
 45
 46class Username(atom.core.XmlElement):
 47  """The issues:username element."""
 48  _qname = ISSUES_TEMPLATE % 'username'
 49
 50
 51class Cc(atom.core.XmlElement):
 52  """The issues:cc element."""
 53  _qname = ISSUES_TEMPLATE % 'cc'
 54  uri = Uri
 55  username = Username
 56
 57
 58class Label(atom.core.XmlElement):
 59  """The issues:label element."""
 60  _qname = ISSUES_TEMPLATE % 'label'
 61
 62
 63class Owner(atom.core.XmlElement):
 64  """The issues:owner element."""
 65  _qname = ISSUES_TEMPLATE % 'owner'
 66  uri = Uri
 67  username = Username
 68
 69
 70class Stars(atom.core.XmlElement):
 71  """The issues:stars element."""
 72  _qname = ISSUES_TEMPLATE % 'stars'
 73
 74
 75class State(atom.core.XmlElement):
 76  """The issues:state element."""
 77  _qname = ISSUES_TEMPLATE % 'state'
 78
 79
 80class Status(atom.core.XmlElement):
 81  """The issues:status element."""
 82  _qname = ISSUES_TEMPLATE % 'status'
 83
 84
 85class Summary(atom.core.XmlElement):
 86  """The issues:summary element."""
 87  _qname = ISSUES_TEMPLATE % 'summary'
 88
 89
 90class OwnerUpdate(atom.core.XmlElement):
 91  """The issues:ownerUpdate element."""
 92  _qname = ISSUES_TEMPLATE % 'ownerUpdate'
 93
 94
 95class CcUpdate(atom.core.XmlElement):
 96  """The issues:ccUpdate element."""
 97  _qname = ISSUES_TEMPLATE % 'ccUpdate'
 98
 99
100class Updates(atom.core.XmlElement):
101  """The issues:updates element."""
102  _qname = ISSUES_TEMPLATE % 'updates'
103  summary = Summary
104  status = Status
105  ownerUpdate = OwnerUpdate
106  label = [Label]
107  ccUpdate = [CcUpdate]
108
109
110class IssueEntry(gdata.data.GDEntry):
111  """Represents the information of one issue."""
112  _qname = atom.data.ATOM_TEMPLATE % 'entry'
113  owner = Owner
114  cc = [Cc]
115  label = [Label]
116  stars = Stars
117  state = State
118  status = Status
119
120
121class IssuesFeed(gdata.data.GDFeed):
122  """An Atom feed listing a project's issues."""
123  entry = [IssueEntry]
124
125
126class CommentEntry(gdata.data.GDEntry):
127  """An entry detailing one comment on an issue."""
128  _qname = atom.data.ATOM_TEMPLATE % 'entry'
129  updates = Updates
130
131
132class CommentsFeed(gdata.data.GDFeed):
133  """An Atom feed listing a project's issue's comments."""
134  entry = [CommentEntry]