/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. # This module is used for version 2 of the Google Data APIs.
  17. """Provides classes and constants for XML in the Google Project Hosting API.
  18. Canonical documentation for the raw XML which these classes represent can be
  19. found here: http://code.google.com/p/support/wiki/IssueTrackerAPI
  20. """
  21. __author__ = 'jlapenna@google.com (Joe LaPenna)'
  22. import atom.core
  23. import gdata.data
  24. ISSUES_TEMPLATE = '{http://schemas.google.com/projecthosting/issues/2009}%s'
  25. ISSUES_FULL_FEED = '/feeds/issues/p/%s/issues/full'
  26. COMMENTS_FULL_FEED = '/feeds/issues/p/%s/issues/%s/comments/full'
  27. class Uri(atom.core.XmlElement):
  28. """The issues:uri element."""
  29. _qname = ISSUES_TEMPLATE % 'uri'
  30. class Username(atom.core.XmlElement):
  31. """The issues:username element."""
  32. _qname = ISSUES_TEMPLATE % 'username'
  33. class Cc(atom.core.XmlElement):
  34. """The issues:cc element."""
  35. _qname = ISSUES_TEMPLATE % 'cc'
  36. uri = Uri
  37. username = Username
  38. class Label(atom.core.XmlElement):
  39. """The issues:label element."""
  40. _qname = ISSUES_TEMPLATE % 'label'
  41. class Owner(atom.core.XmlElement):
  42. """The issues:owner element."""
  43. _qname = ISSUES_TEMPLATE % 'owner'
  44. uri = Uri
  45. username = Username
  46. class Stars(atom.core.XmlElement):
  47. """The issues:stars element."""
  48. _qname = ISSUES_TEMPLATE % 'stars'
  49. class State(atom.core.XmlElement):
  50. """The issues:state element."""
  51. _qname = ISSUES_TEMPLATE % 'state'
  52. class Status(atom.core.XmlElement):
  53. """The issues:status element."""
  54. _qname = ISSUES_TEMPLATE % 'status'
  55. class Summary(atom.core.XmlElement):
  56. """The issues:summary element."""
  57. _qname = ISSUES_TEMPLATE % 'summary'
  58. class OwnerUpdate(atom.core.XmlElement):
  59. """The issues:ownerUpdate element."""
  60. _qname = ISSUES_TEMPLATE % 'ownerUpdate'
  61. class CcUpdate(atom.core.XmlElement):
  62. """The issues:ccUpdate element."""
  63. _qname = ISSUES_TEMPLATE % 'ccUpdate'
  64. class Updates(atom.core.XmlElement):
  65. """The issues:updates element."""
  66. _qname = ISSUES_TEMPLATE % 'updates'
  67. summary = Summary
  68. status = Status
  69. ownerUpdate = OwnerUpdate
  70. label = [Label]
  71. ccUpdate = [CcUpdate]
  72. class IssueEntry(gdata.data.GDEntry):
  73. """Represents the information of one issue."""
  74. _qname = atom.data.ATOM_TEMPLATE % 'entry'
  75. owner = Owner
  76. cc = [Cc]
  77. label = [Label]
  78. stars = Stars
  79. state = State
  80. status = Status
  81. class IssuesFeed(gdata.data.GDFeed):
  82. """An Atom feed listing a project's issues."""
  83. entry = [IssueEntry]
  84. class CommentEntry(gdata.data.GDEntry):
  85. """An entry detailing one comment on an issue."""
  86. _qname = atom.data.ATOM_TEMPLATE % 'entry'
  87. updates = Updates
  88. class CommentsFeed(gdata.data.GDFeed):
  89. """An Atom feed listing a project's issue's comments."""
  90. entry = [CommentEntry]