diff options
author | Brian Dolbec <brian.dolbec@gmail.com> | 2011-02-06 15:37:30 -0800 |
---|---|---|
committer | Brian Dolbec <brian.dolbec@gmail.com> | 2011-02-12 19:55:47 -0800 |
commit | b9635c0d5a2b99263ba361bf957d31ac0907c5a0 (patch) | |
tree | 93ea2fa2aa929033eeb2adb08483596b094e9fa5 | |
parent | 8f3c12a02768bea0cf1ceed02b27886cdac3f2af (diff) | |
download | layman-b9635c0d5a2b99263ba361bf957d31ac0907c5a0.tar.gz layman-b9635c0d5a2b99263ba361bf957d31ac0907c5a0.tar.bz2 layman-b9635c0d5a2b99263ba361bf957d31ac0907c5a0.zip |
rename Overlay's __str__(). split out UnknownOverlayMessage() from the exception class
-rw-r--r-- | layman/dbbase.py | 8 | ||||
-rw-r--r-- | layman/overlays/overlay.py | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/layman/dbbase.py b/layman/dbbase.py index 3532062..5d082a0 100644 --- a/layman/dbbase.py +++ b/layman/dbbase.py @@ -41,10 +41,12 @@ from layman.overlays.overlay import Overlay # Class UnknownOverlayException # #------------------------------------------------------------------------------- +def UnknownOverlayMessage(ovl): + return 'Overlay "%s" does not exist.' % ovl class UnknownOverlayException(Exception): def __init__(self, repo_name): - message = 'Overlay "%s" does not exist.' % repo_name + UnknownOverlayMessage(repo_name) super(UnknownOverlayException, self).__init__(message) #=============================================================================== @@ -242,8 +244,8 @@ class DbBase: for overlay in selection: if verbose: - result.append((str(overlay), overlay.is_supported(), - overlay.is_official())) + result.append(overlay.get_infostr(), overlay.is_supported(), + overlay.is_official()) else: result.append((overlay.short_list(width), overlay.is_supported(), overlay.is_official())) diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py index e73f7e4..f93530e 100644 --- a/layman/overlays/overlay.py +++ b/layman/overlays/overlay.py @@ -305,7 +305,7 @@ class Overlay(object): assert len(self.sources) == 1 return self.sources[0].delete(base) - def __str__(self): + def get_infostr(self): ''' >>> here = os.path.dirname(os.path.realpath(__file__)) >>> import xml.etree.ElementTree as ET # Python 2.5 |