Merge lp:~lifeless/launchpad/cachedproperty into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Michael Hudson-Doyle on 2010-08-16 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 11366 |
| Proposed branch: | lp:~lifeless/launchpad/cachedproperty |
| Merge into: | lp:launchpad |
| Diff against target: |
419 lines (+179/-20) 9 files modified
lib/canonical/cachedproperty.py (+145/-4) lib/canonical/database/sqlbase.py (+12/-0) lib/canonical/launchpad/database/librarian.py (+1/-0) lib/lp/registry/doc/teammembership.txt (+2/-1) lib/lp/registry/model/distribution.py (+4/-3) lib/lp/registry/model/person.py (+10/-10) lib/lp/registry/model/product.py (+1/-2) lib/lp/translations/model/potemplate.py (+1/-0) lib/lp/translations/model/potmsgset.py (+3/-0) |
| To merge this branch: | bzr merge lp:~lifeless/launchpad/cachedproperty |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Michael Hudson-Doyle | 2010-08-16 | Approve on 2010-08-16 | |
|
Review via email:
|
|||
Commit Message
Automatically clear cachedproperties on SQLBase derived classes when storm invalidates an object.
Description of the Change
Make invalidation of cached properties on SQLBase derived classes automatic. This addresses many of the risks associated with using them in the test suite (the server already discards all such objects between transactions), leaving just read-write-readback cases to handle as and when they occur.
| Jeroen T. Vermeulen (jtv) wrote : | # |
Is there or will there be a similar mechanism for pure Storm classes? Otherwise this adds a nasty pitfall to Storm migration.
| Robert Collins (lifeless) wrote : | # |
On Mon, Aug 16, 2010 at 3:51 PM, Jeroen T. Vermeulen <email address hidden> wrote:
> Is there or will there be a similar mechanism for pure Storm classes? Otherwise this adds a nasty pitfall to Storm migration.
Its a two liner:
def __storm_
clear_
SQLBase is storm to all intents and purposes these days.

Hi,
This looks good. I'm not sure what value there is in initializing _cached_properties in SQLBase.__init__ is -- seems to slightly increase coupling.
Generally, yay for safer-by-default.
Cheers,
mwh