Index: rietveld.py |
diff --git a/rietveld.py b/rietveld.py |
index 5cedc471a4373f74676d963f64eb9548eb97e6cf..fd6fabcaba90c132ad3b7cc2036e57c9975a575c 100644 |
--- a/rietveld.py |
+++ b/rietveld.py |
@@ -82,15 +82,20 @@ class Rietveld(object): |
self.post("/%d/close" % issue, [('xsrf_token', self.xsrf_token())]) |
def get_description(self, issue): |
- """Returns the issue's description.""" |
- return self.get('/%d/description' % issue) |
+ """Returns the issue's description. |
+ |
+ Converts any CRLF into LF and strip extraneous whitespace. |
+ """ |
+ return '\n'.join(self.get('/%d/description' % issue).strip().splitlines()) |
iannucci
2013/04/26 18:21:46
So if it ended with a line ending, it won't have a
M-A Ruel
2013/04/26 18:23:53
Exact, which is fine.
|
def get_issue_properties(self, issue, messages): |
"""Returns all the issue's metadata as a dictionary.""" |
url = '/api/%d' % issue |
if messages: |
url += '?messages=true' |
- return json.loads(self.get(url)) |
+ data = json.loads(self.get(url)) |
+ data['description'] = '\n'.join(data['description'].strip().splitlines()) |
iannucci
2013/04/26 18:21:46
Can description can be absent/None?
M-A Ruel
2013/04/26 18:23:53
Not in the real API.
|
+ return data |
def get_patchset_properties(self, issue, patchset): |
"""Returns the patchset properties.""" |