Merge lp:~stevenk/launchpad/fixes-bug-553068 into lp:launchpad
Proposed by
Steve Kowalik
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Gavin Panella | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~stevenk/launchpad/fixes-bug-553068 | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
117 lines (+22/-11) 2 files modified
lib/lp/soyuz/doc/archive.txt (+18/-7) lib/lp/soyuz/model/archive.py (+4/-4) |
||||
To merge this branch: | bzr merge lp:~stevenk/launchpad/fixes-bug-553068 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | Approve | ||
Review via email: mp+22926@code.launchpad.net |
Commit message
Slightly refactor findDepCandidat
Description of the change
This branch fixes bug 553068 by allowing findDepCandidat
To post a comment you must log in.
Hi Steven,
This looks good! I have some ideas for making findDepCandidat eByName( )
faster, but it's good as is.
Gavin.
> === modified file 'lib/lp/ soyuz/model/ archive. py' soyuz/model/ archive. py 2010-03-18 09:11:33 +0000 soyuz/model/ archive. py 2010-04-07 11:03:27 +0000 append( self.distributi on.main_ archive. id) append( self.id) cy.selectOneBy( archive= self) append( dep.dependency. id) cy.selectOneBy( archive= dep.dependency) dep.dependency. id for archive_dep in self.dependencies])
> --- lib/lp/
> +++ lib/lp/
> @@ -779,10 +779,8 @@
> if self.is_ppa:
> archives.
> archives.
> - dep = ArchiveDependen
> - while dep is not None:
> - archives.
> - dep = ArchiveDependen
> + archives.extend(
> + [archive_
I've got a couple of ways to make this more efficient.
First, the list comprehension can be dropped, and dependencyID can be
used instead of loading the dependency Archive (which may result in
another database query). The diff for that is:
{{{ soyuz/model/ archive. py' soyuz/model/ archive. py 2010-04-07 06:59:54 +0000 soyuz/model/ archive. py 2010-04-07 11:16:29 +0000
archives. append( self.distributi on.main_ archive. id)
archives. append( self.id)
archives. extend( dep.dependency. id for archive_dep in self.dependencies]) dep.dependencyI D for archive_dep in self.dependencies)
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -780,7 +780,7 @@
- [archive_
+ archive_
query = """
binarypac kagename = %s AND
}}}
This can be taken even further! Though the above is perfectly okay, we
can avoid loading even the ArchiveDependency objects:
{{{ soyuz/model/ archive. py' soyuz/model/ archive. py 2010-04-07 06:59:54 +0000 soyuz/model/ archive. py 2010-04-07 11:19:32 +0000 interfaces import IResultSet
archives. append( self.distributi on.main_ archive. id)
archives. append( self.id)
archives. extend( dep.dependency. id for archive_dep in self.dependencies]) self.dependenci es).values( cy.dependencyID ))
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -18,6 +18,7 @@
from storm.expr import Or, And, Select
from storm.locals import Count, Join
from storm.store import Store
+from storm.zope.
from zope.component import getUtility
from zope.event import notify
from zope.interface import alsoProvides, implements
@@ -780,7 +781,9 @@
- [archive_
+ IResultSet(
+ ArchiveDependen
+
query = """
binarypac kagename = %s AND
}}}