diff options
author | eliott <eliott@cactuswax.net> | 2008-04-16 21:16:30 -0700 |
---|---|---|
committer | eliott <eliott@cactuswax.net> | 2008-04-16 21:16:30 -0700 |
commit | 54c30baf0be93d601930cc4f6112327efdf66b7d (patch) | |
tree | 856e00e7c4f0dca25bd2b57fcbb5a86d428a3606 | |
parent | 7e65418c7ed399fee08ed788626c432fe3cb7be9 (diff) |
fixed issue where testing and unstable packages caused errors in get_depends
-rw-r--r-- | main/models.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/main/models.py b/main/models.py index 1e7d0647..3d732154 100644 --- a/main/models.py +++ b/main/models.py @@ -222,17 +222,18 @@ class Package(models.Model): """ deps = [] for dep in self.packagedepend_set.order_by('depname'): - try: - # we only need depend on same-arch-packages - p = Package.objects.get( - Q(arch__name__iexact='any') | Q(arch=self.arch), - pkgname=dep.depname) - except Package.DoesNotExist, IndexError: + # we only need depend on same-arch-packages + pkgs = Package.objects.filter( + Q(arch__name__iexact='any') | Q(arch=self.arch), + pkgname=dep.depname) + if len(pkgs) == 0: # couldn't find a package in the DB # it should be a virtual depend (or a removed package) deps.append((None, dep.depname, None)) continue - deps.append((p.id,dep.depname,dep.depvcmp)) + else: + for p in pkgs: + deps.append((p.id,dep.depname,dep.depvcmp)) return deps class PackageFile(models.Model): |