bodhi/controllers.py | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
New commits:
commit 25886ac88d469e413b1330594432e7b0c335b60e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 24 12:53:31 2011 -0400
If we're on python2.6, make sure we don't break on hyphens when wrapping text
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 5764f04..95ac4f8 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -1307,8 +1307,13 @@ class Root(controllers.RootController):
if text == 'None':
text = None
else:
- text = textwrap.TextWrapper(width=80,
- break_long_words=False).fill(text)
+ try: # Python 2.6+
+ text = textwrap.TextWrapper(width=80,
+ break_long_words=False,
+ break_on_hyphens=False).fill(text)
+ except TypeError: # Python 2.4
+ text = textwrap.TextWrapper(width=80,
+ break_long_words=False).fill(text)
update.comment(text, karma, author=author, anonymous=True)
raise redirect(update.get_url())
@@ -1351,8 +1356,13 @@ class Root(controllers.RootController):
if text == 'None':
text = None
else:
- text = textwrap.TextWrapper(width=80,
- break_long_words=False).fill(text)
+ try: # Python 2.6+
+ text = textwrap.TextWrapper(width=80,
+ break_long_words=False,
+ break_on_hyphens=False).fill(text)
+ except TypeError: # Python 2.4
+ text = textwrap.TextWrapper(width=80,
+ break_long_words=False).fill(text)
update.comment(text, karma, email=email)
if request_format() == 'json':
return dict(update=update.__json__())
Show replies by date