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

Proposed by Michael Vogt on 2012-03-26
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) 2012-03-26 Approve on 2012-03-26
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.
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
1=== modified file 'softwarecenter/db/pkginfo_impl/aptcache.py'
2--- softwarecenter/db/pkginfo_impl/aptcache.py 2012-03-07 20:08:53 +0000
3+++ softwarecenter/db/pkginfo_impl/aptcache.py 2012-03-26 13:37:18 +0000
4@@ -364,12 +364,13 @@
5 this will use
6 """
7 if not pkgname in self._cache or not self._cache[pkgname].candidate:
8- return
9+ return None
10 origins = set([origin.origin for origin in self.get_origins(pkgname)])
11 if len(origins) > 1:
12- raise Exception("Error, more than one origin '%s'" % origins)
13+ LOG.warn("more than one origin '%s'" % origins)
14+ return None
15 if not origins:
16- return
17+ return None
18 # we support only a single origin (but its fine if that is available
19 # on multiple mirrors). lowercase as the server excepts it this way
20 origin_str = origins.pop()

Subscribers

People subscribed via source and target branches