launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03745
[Merge] lp:~stub/launchpad/bug-758587-dbclasses into lp:launchpad/db-devel
Stuart Bishop has proposed merging lp:~stub/launchpad/bug-758587-dbclasses into lp:launchpad/db-devel with lp:~stub/launchpad/bug-758587 as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~stub/launchpad/bug-758587-dbclasses/+merge/62409
= Summary =
Add Python boilerplate for the BugSummary database table.
== Proposed fix ==
== Pre-implementation notes ==
== Implementation details ==
== Tests ==
== Demo and Q/A ==
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
database/sampledata/current.sql
database/sampledata/current-dev.sql
database/schema/comments.sql
database/schema/security.cfg
lib/lp/bugs/interfaces/bugsummary.py
lib/lp/bugs/model/bugsummary.py
database/schema/patch-2208-63-0.sql
--
https://code.launchpad.net/~stub/launchpad/bug-758587-dbclasses/+merge/62409
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stub/launchpad/bug-758587-dbclasses into lp:launchpad/db-devel.
=== added file 'lib/lp/bugs/interfaces/bugsummary.py'
--- lib/lp/bugs/interfaces/bugsummary.py 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/interfaces/bugsummary.py 2011-05-26 05:22:30 +0000
@@ -0,0 +1,62 @@
+# Copyright 2011 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""BugSummary interfaces."""
+
+__metaclass__ = type
+__all__ = ['IBugSummary']
+
+
+from zope.interface import Interface
+from zope.schema import (
+ Choice,
+ Int,
+ Object,
+ Text,
+ )
+
+from canonical.launchpad import _
+from lp.bugs.interfaces.bugtask import BugTaskStatus
+from lp.registry.interfaces.distribution import IDistribution
+from lp.registry.interfaces.distroseries import IDistroSeries
+from lp.registry.interfaces.milestone import IMilestone
+from lp.registry.interfaces.person import IPerson
+from lp.registry.interfaces.product import IProduct
+from lp.registry.interfaces.productseries import IProductSeries
+from lp.registry.interfaces.sourcepackagename import ISourcePackageName
+
+
+class IBugSummary(Interface):
+ """Interface for BugSummary database class.
+
+ All fields are readonly as this table is maintained by database
+ triggers.
+ """
+
+ id = Int(readonly=True)
+ count = Int(readonly=True)
+
+ product_id = Int(readonly=True)
+ product = Object(IProduct, readonly=True)
+
+ productseries_id = Int(readonly=True)
+ productseries = Object(IProductSeries, readonly=True)
+
+ distribution_id = Int(readonly=True)
+ distribution = Object(IDistribution, readonly=True)
+
+ distroseries_id = Int(readonly=True)
+ distroseries = Object(IDistroSeries, readonly=True)
+
+ sourcepackagename_id = Int(readonly=True)
+ sourcepackagename = Object(ISourcePackageName, readonly=True)
+
+ viewed_by_id = Int(readonly=True)
+ viewed_by = Object(IPerson, readonly=True)
+
+ tag = Text(readonly=True)
+ status = Choice(
+ title=_('Status'), vocabulary=BugTaskStatus, readonly=True)
+
+ milestone_id = Int(readonly=True)
+ milestone = Object(IMilestone, readonly=True)
=== added file 'lib/lp/bugs/model/bugsummary.py'
--- lib/lp/bugs/model/bugsummary.py 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/model/bugsummary.py 2011-05-26 05:22:30 +0000
@@ -0,0 +1,61 @@
+# Copyright 2011 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""BugSummary Storm database classes."""
+
+__metaclass__ = type
+__all__ = ['BugSummary']
+
+from storm.locals import (
+ Int,
+ Reference,
+ Storm,
+ Unicode,
+ )
+from zope.interface import implements
+
+from canonical.database.enumcol import EnumCol
+from lp.bugs.interfaces.bugsummary import IBugSummary
+from lp.bugs.interfaces.bugtask import BugTaskStatus
+from lp.registry.model.distribution import Distribution
+from lp.registry.model.distroseries import DistroSeries
+from lp.registry.model.milestone import Milestone
+from lp.registry.model.person import Person
+from lp.registry.model.product import Product
+from lp.registry.model.productseries import ProductSeries
+from lp.registry.model.sourcepackagename import SourcePackageName
+
+
+class BugSummary(Storm):
+ """BugSummary Storm database class."""
+
+ implements(IBugSummary)
+
+ __storm_table__ = 'bugsummary'
+
+ id = Int(primary=True)
+ count = Int()
+
+ product_id = Int(name='product')
+ product = Reference(product_id, Product.id)
+
+ productseries_id = Int(name='productseries')
+ productseries = Reference(productseries_id, ProductSeries.id)
+
+ distribution_id = Int(name='distribution')
+ distribution = Reference(distribution_id, Distribution.id)
+
+ distroseries_id = Int(name='distroseries')
+ distroseries = Reference(distroseries_id, DistroSeries.id)
+
+ sourcepackagename_id = Int(name='sourcepackagename')
+ sourcepackagename = Reference(sourcepackagename_id, SourcePackageName.id)
+
+ viewed_by_id = Int(name='viewed_by')
+ viewed_by = Reference(viewed_by_id, Person.id)
+
+ tag = Unicode()
+ status = EnumCol(dbName='status', schema=BugTaskStatus)
+
+ milestone_id = Int(name='milestone')
+ milestone = Reference(milestone_id, Milestone.id)