From 6db71f043212980cd590ced1790c0c91b7b8a553 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Fri, 15 Jan 2010 01:54:48 +0100 Subject: Fix whitspace handling for description field (with layman -i) --- CHANGES | 7 ++++--- layman/overlays/overlay.py | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 5f44ecc..248e88c 100644 --- a/CHANGES +++ b/CHANGES @@ -8,9 +8,10 @@ Version TODO On addition all sources will be probed until a working one is found. This should help Layman through many firewalls. - - Include more information in overlay info display (i.e. layman -i): - - quality indicator (not guarantee) - - feed URIs + - Improve overlay info display (i.e. layman -i): + - Add quality indicator (not guarantee) + - Add feed URIs + - Fix whitspace handling for description field - Improve usage display diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py index 179123c..ddb118e 100644 --- a/layman/overlays/overlay.py +++ b/layman/overlays/overlay.py @@ -65,6 +65,7 @@ OVERLAY_TYPES = dict((e.type_key, e) for e in ( QUALITY_LEVELS = 'core|stable|testing|experimental|graveyard'.split('|') +WHITESPACE_REGEX = re.compile('\s+') #=============================================================================== # @@ -162,7 +163,9 @@ class Overlay(object): _desc = xml.find('description') if _desc != None: - self.description = ensure_unicode(_desc.text.strip()) + d = WHITESPACE_REGEX.sub(' ', _desc.text.strip()) + self.description = ensure_unicode(d) + del d else: self.description = '' if not ignore: -- cgit v1.2.3-65-gdbad