Merge ~cjwatson/launchpad:stormbase-dbobject into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: ee58097161051b6d1f0be631cedd588f51b2b2f4
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:stormbase-dbobject
Merge into: launchpad:master
Diff against target: 27 lines (+4/-4)
1 file modified
lib/lp/services/webapp/database.zcml (+4/-4)
Reviewer Review Type Date Requested Status
Ines Almeida Approve
Review via email: mp+449738@code.launchpad.net

Commit message

Make StormBase implement IDBObject

Description of the change

According to https://bugs.launchpad.net/launchpad/+bug/591841, there was once a problem with getting non-`SQLBase` Storm models to implement `IDBObject`, and as a result the `IPrimaryObject` adapter had to be registered on the very broad `Interface` rather than on the more sensible `IDBObject`.

Nowadays, all our Storm models use `StormBase` (enforced by lint rules), and there doesn't appear to be any problem with declaring that that class implements `IDBObject`, so we can replace this ancient hack with something neater.

To post a comment you must log in.
Revision history for this message
Ines Almeida (ines-almeida) wrote :

Makes sense!

Builds need re-running, they seem to have failed with a random failure

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/services/webapp/database.zcml b/lib/lp/services/webapp/database.zcml
2index 4c9bd10..b7130a2 100644
3--- a/lib/lp/services/webapp/database.zcml
4+++ b/lib/lp/services/webapp/database.zcml
5@@ -50,12 +50,9 @@
6 for="zope.interface.Interface"
7 factory="lp.services.webapp.adapter.get_standby_store"
8 />
9- <!-- Universal adapter needed here per Bug #591841.
10- We have no way of specifying that all subclasses of
11- storm.locals.Storm implement an Interface. -->
12 <adapter
13 provides="lp.services.database.interfaces.IPrimaryObject"
14- for="zope.interface.Interface"
15+ for="lp.services.database.interfaces.IDBObject"
16 trusted="yes"
17 factory="lp.services.webapp.adapter.get_object_from_primary_store"
18 />
19@@ -66,5 +63,8 @@
20 <class class="lp.services.database.sqlbase.SQLBase">
21 <implements interface="lp.services.database.interfaces.IDBObject" />
22 </class>
23+ <class class="lp.services.database.stormbase.StormBase">
24+ <implements interface="lp.services.database.interfaces.IDBObject" />
25+ </class>
26
27 </configure>

Subscribers

People subscribed via source and target branches

to status/vote changes: