Merge lp://staging/~lifeless/launchpad/bug-793848 into lp://staging/launchpad/db-devel
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Robert Collins | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 10699 | ||||
Proposed branch: | lp://staging/~lifeless/launchpad/bug-793848 | ||||
Merge into: | lp://staging/launchpad/db-devel | ||||
Diff against target: |
1302 lines (+256/-387) 22 files modified
lib/lp/bugs/browser/bugtarget.py (+22/-12) lib/lp/bugs/browser/bugtask.py (+5/-10) lib/lp/bugs/interfaces/bugsummary.py (+17/-1) lib/lp/bugs/interfaces/bugtarget.py (+0/-9) lib/lp/bugs/interfaces/bugtask.py (+10/-5) lib/lp/bugs/model/bug.py (+3/-2) lib/lp/bugs/model/bugsummary.py (+30/-2) lib/lp/bugs/model/bugtarget.py (+16/-35) lib/lp/bugs/model/bugtask.py (+53/-5) lib/lp/bugs/stories/bugs/xx-portlets-bug-milestones.txt (+12/-34) lib/lp/bugs/tests/bugtarget-bugcount.txt (+0/-137) lib/lp/bugs/tests/test_bugtarget.py (+1/-11) lib/lp/bugs/tests/test_bugtask_search.py (+12/-9) lib/lp/registry/configure.zcml (+8/-1) lib/lp/registry/model/distribution.py (+10/-20) lib/lp/registry/model/distributionsourcepackage.py (+9/-21) lib/lp/registry/model/distroseries.py (+10/-17) lib/lp/registry/model/milestone.py (+8/-1) lib/lp/registry/model/product.py (+8/-15) lib/lp/registry/model/productseries.py (+6/-12) lib/lp/registry/model/projectgroup.py (+8/-13) lib/lp/registry/model/sourcepackage.py (+8/-15) |
||||
To merge this branch: | bzr merge lp://staging/~lifeless/launchpad/bug-793848 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Henning Eggers (community) | Approve | ||
Review via email: mp+65158@code.staging.launchpad.net |
Commit message
[r=henninge][bug=793848] Make use of the new bugsummary to handle the bug stats portlet.
Description of the change
This branch gets the table scan component of the bug stats portlet using bugsummary.
It needs the new columns only available in db-devel; along the way I saw dead code that confused me, so I deleted it.
I've added a interface for things that are dimensions in the bugsummary, this lets me avoid code duplication between the tags counting code and countBugs. In fact, in a future branch we probably want to delete the special cased tag counting code.
Oh, and I removed code duplication in the tags counting code, making the only variation the joining condition logic. The previous duplicate code I pulled up to an appropriate common base class.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Robert,
thank you for your branch.
You seem to have a lot of "circular fail" instances in here. It looks like a
lot of them are owed to the same pattern, right?
I only have a fiew minor suggestions that I ask you to consider.
review approve
Cheers,
Henning
Am 20.06.2011 09:11, schrieb Robert Collins: bugs/browser/ bugtarget. py' bugs/browser/ bugtask. py' bugs/interfaces /bugsummary. py' bugs/interfaces /bugsummary. py 2011-06-14 15:06:36 +0000 bugs/interfaces /bugsummary. py 2011-06-20 07:11:33 +0000 ension' , nsion(Interface ): ontextWhereClau se():
> === modified file 'lib/lp/
> === modified file 'lib/lp/
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -4,7 +4,10 @@
> """BugSummary interfaces."""
>
> __metaclass__ = type
> -__all__ = ['IBugSummary']
> +__all__ = [
> + 'IBugSummary',
> + 'IBugSummaryDim
> + ]
>
>
> from zope.interface import Interface
> @@ -70,3 +73,16 @@
>
> has_patch = Bool(readonly=True)
> fixed_upstream = Bool(readonly=True)
> +
> +
> +class IBugSummaryDime
> + """Interface for dimensions used in the BugSummary database class."""
> +
> + def _getBugSummaryC
I don't think "private" methods belong in an interface. I suggest simply
making it public.
> + """Return a storm clause to filter bugsummaries on this context. bugs/interfaces /bugtarget. py' bugs/interfaces /bugtask. py' bugs/model/ bug.py' bugs/model/ bugsummary. py' bugs/model/ bugsummary. py 2011-06-14 15:06:36 +0000 bugs/model/ bugsummary. py 2011-06-20 07:11:33 +0000 aryContraint' ,
> +
> + This method is intentended for in-appserver use only.
> +
> + :return: Either a storm clause to filter bugsummaries, or False if
> + there cannot be any matching bug summaries.
> + """
>
> === modified file 'lib/lp/
> === modified file 'lib/lp/
> === modified file 'lib/lp/
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -4,9 +4,13 @@
> """BugSummary Storm database classes."""
>
> __metaclass__ = type
> -__all__ = ['BugSummary']
> +__all__ = [
> + 'BugSummary'
> + 'CombineBugSumm
> + ]
>
> from storm.locals import (
> + And,
> Bool,
> Int,
> Reference,
> @@ -14,6 +18,7 @@
> Unicode,
> )
> from zope.interface import implements
> +from zope.security.proxy import removeSecurityProxy
I don't see were this is used.
> database. enumcol import EnumCol interfaces. bugsummary import IBugSummary ryContraint( object) :
> from canonical.
> from lp.bugs.
> @@ -68,3 +73,21 @@
>
> has_patch = Bool()
> fixed_upstream = Bool()
> +
> +
> +class CombineBugSumma
AFAIUI you can drop the "(object)" because of the __metaclass__ declaration at
the top of the file.
> + """A class to combine two separate bug summary constraints.
> +
> + This is useful for querying on multiple related dimensions (e.g. milestone
> + + sourcepackage) - and essential when a dimension is not unique to a
> + context.
> + """
Missing "implements( IBugSummaryDime nsion)" , is it not?
> + yProxy( x._getBugSummar yCont.. .
> + def __init__(self, *dimensions):
> + self.dimensions = map(
> + lambda x:removeSecurit