Merge lp:~mvo/software-center/lp964918 into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 2920
Proposed branch: lp:~mvo/software-center/lp964918
Merge into: lp:software-center
Diff against target: 20 lines (+4/-3)
1 file modified
softwarecenter/db/pkginfo_impl/aptcache.py (+4/-3)
To merge this branch: bzr merge lp:~mvo/software-center/lp964918
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+99329@code.launchpad.net

Description of the change

When there are multiple origins, do not rasie a exception but instead log it and return None.
The frontend will deal with the "None" and display a unknown origin warning (which makes sense
in this case).

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Nice work! I like it. Thanks mvo!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'softwarecenter/db/pkginfo_impl/aptcache.py'
--- softwarecenter/db/pkginfo_impl/aptcache.py 2012-03-07 20:08:53 +0000
+++ softwarecenter/db/pkginfo_impl/aptcache.py 2012-03-26 13:37:18 +0000
@@ -364,12 +364,13 @@
364 this will use364 this will use
365 """365 """
366 if not pkgname in self._cache or not self._cache[pkgname].candidate:366 if not pkgname in self._cache or not self._cache[pkgname].candidate:
367 return367 return None
368 origins = set([origin.origin for origin in self.get_origins(pkgname)])368 origins = set([origin.origin for origin in self.get_origins(pkgname)])
369 if len(origins) > 1:369 if len(origins) > 1:
370 raise Exception("Error, more than one origin '%s'" % origins)370 LOG.warn("more than one origin '%s'" % origins)
371 return None
371 if not origins:372 if not origins:
372 return373 return None
373 # we support only a single origin (but its fine if that is available374 # we support only a single origin (but its fine if that is available
374 # on multiple mirrors). lowercase as the server excepts it this way375 # on multiple mirrors). lowercase as the server excepts it this way
375 origin_str = origins.pop()376 origin_str = origins.pop()

Subscribers

People subscribed via source and target branches