Permalink
Browse files

Add a get_full_ticket() method which populates an existing ticket wit…

…h all its details (particularly versions) - it uses /tickets/123.xml rather than the limited detail that exists in the list calls
  • Loading branch information...
1 parent f002a23 commit 8988309f57a1666dbda3fde60f5e4bc48b8d36df @rcoup rcoup committed Dec 22, 2010
Showing with 15 additions and 2 deletions.
  1. +15 −2 lighthouse.py
View
@@ -325,7 +325,19 @@ def get_tickets(self, project, page=1):
t_obj.fields.add(py_field_name)
project.tickets[t_obj.number] = t_obj
return c
-
+
+ def get_full_ticket(self, project, ticket):
+ path = Ticket.endpoint_single % (project.id, ticket.number)
+ ticket_data = self._get_data(path)
+ for field in ticket_data['children']:
+ field_name, field_value, field_type = \
+ self._parse_field(field)
+ py_field_name = field_name.replace('-', '_')
+ ticket.__setattr__(py_field_name, field_value)
+ ticket.fields.add(py_field_name)
+
+ return ticket
+
def get_users(self, name):
pass
@@ -354,11 +366,12 @@ def add_ticket(self, project=None, title=None, body=None):
t_obj.__setattr__(field_name.replace('-', '_'),\
field_value)
return t_obj
-
+
class Ticket(object):
"""Tickets are individual issues or bugs"""
endpoint = 'projects/%d/tickets.xml'
+ endpoint_single = 'projects/%d/tickets/%d.xml'
creation_xml = """<ticket>
<body>%(body)s</body>
<title>%(title)s</title>

0 comments on commit 8988309

Please sign in to comment.