summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Heinlein <sebi@sebi-laptop>2006-11-30 22:41:02 +0100
committerSebastian Heinlein <sebi@sebi-laptop>2006-11-30 22:41:02 +0100
commit0707e8fce07af2ff9a81406b32dd618e59fb42f6 (patch)
tree6b03a4f16bc6379711714a34c348ad35336929a3
parent3238d360ff4101b808f6259414c7b3bd38bd3f93 (diff)
downloadpython-apt-0707e8fce07af2ff9a81406b32dd618e59fb42f6.tar.gz
* add get_comp_desc which returns a nice description for a component
of a template
-rw-r--r--AptSources/DistInfo.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/AptSources/DistInfo.py b/AptSources/DistInfo.py
index 41edd75c..6387dbd2 100644
--- a/AptSources/DistInfo.py
+++ b/AptSources/DistInfo.py
@@ -43,6 +43,17 @@ class Suite:
self.distribution = None
self.available = True
+ def get_comp_desc(self, comp, short=False):
+ ''' Return a human readable description of a component '''
+ if self.components.has_key(comp):
+ if self.components[comp][1] == "" or short == True:
+ return self.components[comp][0]
+ elif self.components[comp][1] != "":
+ return self.components[comp][1]
+ else:
+ return "Unnamed component"
+ return None
+
class Component:
def __init__(self):
self.name = ""