Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1529)

Unified Diff: rietveld.py

Issue 14061008: Have Rietveld.get_description() consistently strip CR and whitespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/rietveld_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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."""
« no previous file with comments | « no previous file | tests/rietveld_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698