From 79cba28b2346909a12e4ce225bc25b164c33f062 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 17 Apr 2009 17:20:35 +0200 Subject: * apt/package.py: Introduce Version._translated_records. This new property allows us to get the translated record. This was previously done in 'summary', but because 'description' also uses translated descriptions, the lookup has been moved in this property. --- apt/package.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'apt/package.py') diff --git a/apt/package.py b/apt/package.py index cf1ff2ae..1a2626fa 100644 --- a/apt/package.py +++ b/apt/package.py @@ -219,6 +219,13 @@ class Version(object): if self.package._pcache._records.Lookup(self._cand.FileList[0]): return self.package._pcache._records + @property + def _translated_records(self): + """Internal helper to get the translated description.""" + desc_iter = self._cand.TranslatedDescription + self.package._pcache._records.Lookup(desc_iter.FileList.pop(0)) + return self.package._pcache._records + @property def installed_size(self): """Return the size of the package when installed.""" @@ -252,9 +259,7 @@ class Version(object): @property def summary(self): """Return the short description (one line summary).""" - desc_iter = self._cand.TranslatedDescription - self.package._pcache._records.Lookup(desc_iter.FileList.pop(0)) - return self.package._pcache._records.ShortDesc + return self._translated_records.ShortDesc @property def raw_description(self): @@ -275,9 +280,8 @@ class Version(object): See http://www.debian.org/doc/debian-policy/ch-controlfields.html for more information. """ - self.summary # This does the lookup for us. desc = '' - dsc = self.package._pcache._records.LongDesc + dsc = self._translated_records.LongDesc try: if not isinstance(dsc, unicode): # Only convert where needed (i.e. Python 2.X) -- cgit v1.2.3