Merge lp:~allenap/launchpad/cache-experiment-roll-out into lp:launchpad

Proposed by Gavin Panella
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 11495
Proposed branch: lp:~allenap/launchpad/cache-experiment-roll-out
Merge into: lp:launchpad
Prerequisite: lp:~allenap/launchpad/cache-experiment
Diff against target: 2880 lines (+248/-457)
114 files modified
.ctags (+3/-0)
lib/canonical/cachedproperty.py (+0/-229)
lib/canonical/database/sqlbase.py (+0/-6)
lib/canonical/launchpad/browser/launchpad.py (+1/-1)
lib/canonical/launchpad/utilities/geoip.py (+1/-1)
lib/canonical/launchpad/webapp/error.py (+1/-1)
lib/canonical/launchpad/webapp/login.py (+1/-1)
lib/canonical/launchpad/webapp/servers.py (+1/-1)
lib/canonical/lazr/feed/feed.py (+17/-8)
lib/canonical/tests/test_cachedproperty.py (+0/-15)
lib/canonical/widgets/popup.py (+8/-7)
lib/lp/answers/browser/faqcollection.py (+1/-1)
lib/lp/answers/browser/question.py (+1/-1)
lib/lp/answers/browser/questiontarget.py (+3/-3)
lib/lp/answers/notification.py (+1/-1)
lib/lp/app/browser/root.py (+1/-1)
lib/lp/archivepublisher/diskpool.py (+1/-1)
lib/lp/blueprints/browser/specification.py (+1/-1)
lib/lp/blueprints/browser/specificationgoal.py (+1/-1)
lib/lp/blueprints/browser/specificationtarget.py (+1/-1)
lib/lp/blueprints/browser/sprint.py (+1/-1)
lib/lp/bugs/browser/bug.py (+1/-1)
lib/lp/bugs/browser/bugalsoaffects.py (+1/-1)
lib/lp/bugs/browser/bugbranch.py (+1/-1)
lib/lp/bugs/browser/bugtarget.py (+1/-1)
lib/lp/bugs/browser/bugtask.py (+1/-1)
lib/lp/bugs/browser/bugtracker.py (+1/-1)
lib/lp/bugs/browser/cvereport.py (+1/-1)
lib/lp/bugs/browser/distribution_upstream_bug_report.py (+1/-1)
lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt (+3/-1)
lib/lp/bugs/externalbugtracker/mantis.py (+1/-1)
lib/lp/bugs/externalbugtracker/rt.py (+1/-1)
lib/lp/bugs/model/bug.py (+13/-12)
lib/lp/bugs/model/bugattachment.py (+3/-3)
lib/lp/bugs/model/bugtask.py (+2/-2)
lib/lp/bugs/tests/externalbugtracker.py (+0/-8)
lib/lp/buildmaster/model/builder.py (+1/-1)
lib/lp/code/browser/bazaar.py (+1/-1)
lib/lp/code/browser/branch.py (+1/-1)
lib/lp/code/browser/branchlisting.py (+1/-1)
lib/lp/code/browser/branchmergeproposal.py (+1/-1)
lib/lp/code/browser/branchmergeproposallisting.py (+1/-1)
lib/lp/code/browser/branchvisibilitypolicy.py (+1/-1)
lib/lp/code/browser/codeimport.py (+1/-1)
lib/lp/code/browser/codeimportmachine.py (+1/-1)
lib/lp/code/browser/codereviewcomment.py (+1/-1)
lib/lp/code/browser/decorations.py (+1/-1)
lib/lp/code/browser/summary.py (+1/-1)
lib/lp/code/feed/branch.py (+1/-1)
lib/lp/code/model/branchvisibilitypolicy.py (+1/-1)
lib/lp/codehosting/codeimport/worker.py (+1/-1)
lib/lp/codehosting/puller/scheduler.py (+1/-1)
lib/lp/hardwaredb/scripts/hwdbsubmissions.py (+1/-1)
lib/lp/registry/browser/__init__.py (+1/-1)
lib/lp/registry/browser/announcement.py (+1/-1)
lib/lp/registry/browser/distribution.py (+2/-4)
lib/lp/registry/browser/distributionmirror.py (+1/-1)
lib/lp/registry/browser/distributionsourcepackage.py (+4/-3)
lib/lp/registry/browser/distroseries.py (+1/-1)
lib/lp/registry/browser/karma.py (+1/-1)
lib/lp/registry/browser/mailinglists.py (+1/-1)
lib/lp/registry/browser/milestone.py (+1/-1)
lib/lp/registry/browser/person.py (+6/-6)
lib/lp/registry/browser/pillar.py (+1/-1)
lib/lp/registry/browser/product.py (+3/-3)
lib/lp/registry/browser/productseries.py (+1/-1)
lib/lp/registry/browser/project.py (+1/-1)
lib/lp/registry/browser/structuralsubscription.py (+1/-1)
lib/lp/registry/browser/team.py (+1/-1)
lib/lp/registry/model/distribution.py (+5/-8)
lib/lp/registry/model/distroseries.py (+3/-5)
lib/lp/registry/model/mailinglist.py (+1/-1)
lib/lp/registry/model/person.py (+4/-22)
lib/lp/registry/model/product.py (+6/-3)
lib/lp/registry/vocabularies.py (+1/-1)
lib/lp/services/mailman/doc/staging.txt (+2/-1)
lib/lp/services/openid/browser/openiddiscovery.py (+1/-1)
lib/lp/services/propertycache.py (+41/-0)
lib/lp/services/salesforce/proxy.py (+1/-1)
lib/lp/services/tests/test_doc.py (+4/-2)
lib/lp/shipit.py (+4/-0)
lib/lp/soyuz/browser/archive.py (+2/-4)
lib/lp/soyuz/browser/archivesubscription.py (+1/-1)
lib/lp/soyuz/browser/build.py (+2/-2)
lib/lp/soyuz/browser/builder.py (+1/-1)
lib/lp/soyuz/browser/distributionsourcepackagerelease.py (+2/-2)
lib/lp/soyuz/browser/packagesearch.py (+1/-1)
lib/lp/soyuz/browser/publishing.py (+1/-1)
lib/lp/soyuz/model/archive.py (+1/-3)
lib/lp/soyuz/model/distroarchseriesbinarypackage.py (+2/-2)
lib/lp/soyuz/model/distroseriesbinarypackage.py (+6/-3)
lib/lp/soyuz/model/queue.py (+1/-1)
lib/lp/soyuz/model/sourcepackagerelease.py (+2/-4)
lib/lp/soyuz/scripts/ppareport.py (+1/-1)
lib/lp/soyuz/scripts/queue.py (+1/-1)
lib/lp/testing/__init__.py (+7/-2)
lib/lp/testopenid/browser/server.py (+7/-3)
lib/lp/translations/browser/distribution.py (+1/-1)
lib/lp/translations/browser/distroseries.py (+1/-1)
lib/lp/translations/browser/hastranslationimports.py (+1/-1)
lib/lp/translations/browser/language.py (+1/-1)
lib/lp/translations/browser/person.py (+1/-1)
lib/lp/translations/browser/poexportrequest.py (+1/-1)
lib/lp/translations/browser/pofile.py (+1/-1)
lib/lp/translations/browser/product.py (+1/-1)
lib/lp/translations/browser/productseries.py (+1/-1)
lib/lp/translations/browser/serieslanguage.py (+1/-1)
lib/lp/translations/browser/translationmessage.py (+1/-1)
lib/lp/translations/browser/translations.py (+1/-1)
lib/lp/translations/model/pofile.py (+1/-1)
lib/lp/translations/model/potemplate.py (+1/-1)
lib/lp/translations/model/translationmessage.py (+1/-1)
lib/lp/translations/utilities/translation_import.py (+1/-1)
utilities/sourcedeps.conf (+1/-1)
To merge this branch: bzr merge lp:~allenap/launchpad/cache-experiment-roll-out
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Robert Collins (community) Approve
Review via email: mp+33542@code.launchpad.net

Commit message

Roll out the propertycache API everywhere, remove canonical.cachedproperty, and provide bits of the API for shipit to import.

Description of the change

This rolls out the propertycache API - see lp:~allenap/launchpad/cache-experiment - everywhere and removes canonical.cachedproperty.

It also provides hooks for shipit to import the propertycache bits it needs. See lp:~allenap/shipit/shipit-use-propertycache for the other side of that deal. Once the shipit branch has landed, utilities/sourcedeps.conf will be updated to point to the relevant revision.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

While this branch appears very long, the majority of it is mechanical
changes. I've attached a diff of the non-mechanical parts.

=== removed file 'lib/canonical/cachedproperty.py'
--- lib/canonical/cachedproperty.py 2010-08-17 07:03:25 +0000
+++ lib/canonical/cachedproperty.py 1970-01-01 00:00:00 +0000
@@ -1,229 +0,0 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).
3
4"""Cached properties for situations where a property is computed once and
5then returned each time it is asked for.
6
7The clear_cachedproperties function can be used to wipe the cache of properties
8from an instance.
9"""
10
11__metaclass__ = type
12
13__all__ = [
14 'cache_property',
15 'cachedproperty',
16 'clear_cachedproperties',
17 'clear_property',
18 ]
19
20from zope.security.proxy import removeSecurityProxy
21
22from canonical.lazr.utils import safe_hasattr
23
24# XXX: JonathanLange 2010-01-11 bug=505731: Move this to lp.services.
25
26def cachedproperty(attrname_or_fn):
27 """A decorator for methods that makes them properties with their return
28 value cached.
29
30 The value is cached on the instance, using the attribute name provided.
31
32 If you don't provide a name, the mangled name of the property is used.
33
34 cachedproperty is not threadsafe - it should not be used on objects which
35 are shared across threads / external locking should be used on those
36 objects.
37
38 >>> class CachedPropertyTest(object):
39 ...
40 ... @cachedproperty('_foo_cache')
41 ... def foo(self):
42 ... print 'foo computed'
43 ... return 23
44 ...
45 ... @cachedproperty
46 ... def bar(self):
47 ... print 'bar computed'
48 ... return 69
49
50 >>> cpt = CachedPropertyTest()
51 >>> getattr(cpt, '_foo_cache', None) is None
52 True
53 >>> cpt.foo
54 foo computed
55 23
56 >>> cpt.foo
57 23
58 >>> cpt._foo_cache
59 23
60 >>> cpt.bar
61 bar computed
62 69
63 >>> cpt._bar_cached_value
64 69
65
66 Cached properties are listed on instances.
67 >>> sorted(cpt._cached_properties)
68 ['_bar_cached_value', '_foo_cache']
69
70 """
71 if isinstance(attrname_or_fn, basestring):
72 attrname = attrname_or_fn
73 return CachedPropertyForAttr(attrname)
74 else:
75 fn = attrname_or_fn
76 attrname = '_%s_cached_value' % fn.__name__
77 return CachedProperty(attrname, fn)
78
79def cache_property(instance, attrname, value):
80 """Cache value on instance as attrname.
81
82 instance._cached_properties is updated with attrname.
83
84 >>> class CachedPropertyTest(object):
85 ...
86 ... @cachedproperty('_foo_cache')
87 ... def foo(self):
88 ... return 23
89 ...
90 >>> instance = CachedPropertyTest()
91 >>> cache_property(instance, '_foo_cache', 42)
92 >>> instance.foo
93 42
94 >>> instance._cached_properties
95 ['_foo_cache']
96
97 Caching a new value does not duplicate the cache keys.
98
99 >>> cache_property(instance, '_foo_cache', 84)
100 >>> instance._cached_properties
101 ['_foo_cache']
102
103 And does update the cached value.
104
105 >>> instance.foo
106 84
107 """
108 naked_instance = removeSecurityProxy(instance)
109 clear_property(naked_instance, attrname)
110 setattr(naked_instance, attrname, value)
111 cached_properties = getattr(naked_instance, '_cached_properties', [])
112 cached_properties.append(attrname)
113 naked_instance._cached_properties = cached_properties
114
115
116def clear_property(instance, attrname):
117 """Remove a cached attribute from instance.
118
119 The attribute name is removed from instance._cached_properties.
120
121 If the property is not cached, nothing happens.
122
123 :seealso clear_cachedproperties: For clearing all cached items at once.
124
125 >>> class CachedPropertyTest(object):
126 ...
127 ... @cachedproperty('_foo_cache')
128 ... def foo(self):
129 ... return 23
130 ...
131 >>> instance = CachedPropertyTest()
132 >>> instance.foo
133 23
134 >>> clear_property(instance, '_foo_cache')
135 >>> instance._cached_properties
136 []
137 >>> is_cached(instance, '_foo_cache')
138 False
139 >>> clear_property(instance, '_foo_cache')
140 """
141 naked_instance = removeSecurityProxy(instance)
142 if not is_cached(naked_instance, attrname):
143 return
144 delattr(naked_instance, attrname)
145 naked_instance._cached_properties.remove(attrname)
146
147
148def clear_cachedproperties(instance):
149 """Clear cached properties from an object.
150
151 >>> class CachedPropertyTest(object):
152 ...
153 ... @cachedproperty('_foo_cache')
154 ... def foo(self):
155 ... return 23
156 ...
157 >>> instance = CachedPropertyTest()
158 >>> instance.foo
159 23
160 >>> instance._cached_properties
161 ['_foo_cache']
162 >>> clear_cachedproperties(instance)
163 >>> instance._cached_properties
164 []
165 >>> hasattr(instance, '_foo_cache')
166 False
167 """
168 naked_instance = removeSecurityProxy(instance)
169 cached_properties = getattr(naked_instance, '_cached_properties', [])
170 for property_name in cached_properties:
171 delattr(naked_instance, property_name)
172 naked_instance._cached_properties = []
173
174
175def is_cached(instance, attrname):
176 """Return True if attrname is cached on instance.
177
178 >>> class CachedPropertyTest(object):
179 ...
180 ... @cachedproperty('_foo_cache')
181 ... def foo(self):
182 ... return 23
183 ...
184 >>> instance = CachedPropertyTest()
185 >>> instance.foo
186 23
187 >>> is_cached(instance, '_foo_cache')
188 True
189 >>> is_cached(instance, '_var_cache')
190 False
191 """
192 naked_instance = removeSecurityProxy(instance)
193 return safe_hasattr(naked_instance, attrname)
194
195
196class CachedPropertyForAttr:
197 """Curry a decorator to provide arguments to the CachedProperty."""
198
199 def __init__(self, attrname):
200 self.attrname = attrname
201
202 def __call__(self, fn):
203 return CachedProperty(self.attrname, fn)
204
205
206class CachedProperty:
207
208 # Used to detect not-yet-cached properties.
209 sentinel = object()
210
211 def __init__(self, attrname, fn):
212 self.fn = fn
213 self.attrname = attrname
214
215 def __get__(self, inst, cls=None):
216 if inst is None:
217 return self
218 cachedresult = getattr(inst, self.attrname, CachedProperty.sentinel)
219 if cachedresult is CachedProperty.sentinel:
220 result = self.fn(inst)
221 cache_property(inst, self.attrname, result)
222 return result
223 else:
224 return cachedresult
225
226
227if __name__ == '__main__':
228 import doctest
229 doctest.testmod()
2300
=== modified file 'lib/canonical/database/sqlbase.py'
--- lib/canonical/database/sqlbase.py 2010-08-23 10:57:10 +0000
+++ lib/canonical/database/sqlbase.py 2010-08-24 10:29:11 +0000
@@ -65,7 +65,6 @@
65from zope.interface import implements65from zope.interface import implements
66from zope.security.proxy import removeSecurityProxy66from zope.security.proxy import removeSecurityProxy
6767
68from canonical.cachedproperty import clear_cachedproperties
69from canonical.config import (68from canonical.config import (
70 config,69 config,
71 dbconfig,70 dbconfig,
@@ -271,10 +270,6 @@
271 # XXX: RobertCollins 2010-08-16 bug=622648: Note this is not directly270 # XXX: RobertCollins 2010-08-16 bug=622648: Note this is not directly
272 # tested, but the entire test suite blows up awesomely if it's broken.271 # tested, but the entire test suite blows up awesomely if it's broken.
273 # It's entirely unclear where tests for this should be.272 # It's entirely unclear where tests for this should be.
274
275 # While canonical.cachedproperty and lp.services.propertycache are
276 # both in use, we must clear the caches for both.
277 clear_cachedproperties(self)
278 IPropertyCacheManager(self).clear()273 IPropertyCacheManager(self).clear()
279274
280275
281276
=== removed file 'lib/canonical/tests/test_cachedproperty.py'
--- lib/canonical/tests/test_cachedproperty.py 2010-07-14 14:11:15 +0000
+++ lib/canonical/tests/test_cachedproperty.py 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).
3
4from doctest import DocTestSuite, ELLIPSIS
5import unittest
6
7import canonical.cachedproperty
8
9def test_suite():
10 suite = DocTestSuite(canonical.cachedproperty, optionflags=ELLIPSIS)
11 return suite
12
13
14if __name__ == '__main__':
15 unittest.main(defaultTest='test_suite')
160
=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py 2010-08-22 18:31:30 +0000
+++ lib/lp/bugs/model/bug.py 2010-08-24 10:12:39 +0000
@@ -70,9 +70,9 @@
70 providedBy,70 providedBy,
71 )71 )
7272
73from canonical.cachedproperty import (73from lp.services.propertycache import (
74 cachedproperty,74 cachedproperty,
75 clear_property,75 IPropertyCache,
76 )76 )
77from canonical.config import config77from canonical.config import config
78from canonical.database.constants import UTC_NOW78from canonical.database.constants import UTC_NOW
@@ -633,7 +633,7 @@
633 # disabled see the change.633 # disabled see the change.
634 store.flush()634 store.flush()
635 self.updateHeat()635 self.updateHeat()
636 clear_property(self, '_cached_viewers')636 del IPropertyCache(self)._known_viewers
637 return637 return
638638
639 def unsubscribeFromDupes(self, person, unsubscribed_by):639 def unsubscribeFromDupes(self, person, unsubscribed_by):
@@ -1626,7 +1626,7 @@
1626 self, self.messages[comment_number])1626 self, self.messages[comment_number])
1627 bug_message.visible = visible1627 bug_message.visible = visible
16281628
1629 @cachedproperty('_cached_viewers')1629 @cachedproperty
1630 def _known_viewers(self):1630 def _known_viewers(self):
1631 """A dict of of known persons able to view this bug."""1631 """A dict of of known persons able to view this bug."""
1632 return set()1632 return set()
16331633
=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py 2010-08-22 18:31:30 +0000
+++ lib/lp/bugs/model/bugtask.py 2010-08-24 10:32:39 +0000
@@ -59,7 +59,6 @@
59 removeSecurityProxy,59 removeSecurityProxy,
60 )60 )
6161
62from canonical.cachedproperty import cache_property
63from canonical.config import config62from canonical.config import config
64from canonical.database.constants import UTC_NOW63from canonical.database.constants import UTC_NOW
65from canonical.database.datetimecol import UtcDateTimeCol64from canonical.database.datetimecol import UtcDateTimeCol
@@ -156,6 +155,9 @@
156from lp.soyuz.interfaces.publishing import PackagePublishingStatus155from lp.soyuz.interfaces.publishing import PackagePublishingStatus
157from lp.soyuz.model.publishing import SourcePackagePublishingHistory156from lp.soyuz.model.publishing import SourcePackagePublishingHistory
158from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease157from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
158from lp.services.propertycache import (
159 IPropertyCache,
160 )
159161
160162
161debbugsseveritymap = {None: BugTaskImportance.UNDECIDED,163debbugsseveritymap = {None: BugTaskImportance.UNDECIDED,
@@ -1324,7 +1326,7 @@
1324 """1326 """
1325 userid = user.id1327 userid = user.id
1326 def cache_user_can_view_bug(bugtask):1328 def cache_user_can_view_bug(bugtask):
1327 cache_property(bugtask.bug, '_cached_viewers', set([userid]))1329 IPropertyCache(bugtask.bug)._known_viewers = set([userid])
1328 return bugtask1330 return bugtask
1329 return cache_user_can_view_bug1331 return cache_user_can_view_bug
13301332
13311333
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py 2010-08-23 03:25:20 +0000
+++ lib/lp/registry/browser/person.py 2010-08-24 10:19:26 +0000
@@ -141,7 +141,10 @@
141from zope.security.interfaces import Unauthorized141from zope.security.interfaces import Unauthorized
142from zope.security.proxy import removeSecurityProxy142from zope.security.proxy import removeSecurityProxy
143143
144from canonical.cachedproperty import cachedproperty144from lp.services.propertycache import (
145 cachedproperty,
146 IPropertyCache,
147 )
145from canonical.config import config148from canonical.config import config
146from canonical.database.sqlbase import flush_database_updates149from canonical.database.sqlbase import flush_database_updates
147from canonical.launchpad import (150from canonical.launchpad import (
@@ -5693,10 +5696,7 @@
5693 def _reset_state(self):5696 def _reset_state(self):
5694 """Reset the cache because the recipients changed."""5697 """Reset the cache because the recipients changed."""
5695 self._count_recipients = None5698 self._count_recipients = None
5696 if safe_hasattr(self, '_all_recipients_cached'):5699 del IPropertyCache(self)._all_recipients
5697 # The clear the cache of _all_recipients. The caching will fail
5698 # if this method creates the attribute before _all_recipients.
5699 del self._all_recipients_cached
57005700
5701 def _getPrimaryReason(self, person_or_team):5701 def _getPrimaryReason(self, person_or_team):
5702 """Return the primary reason enumeration.5702 """Return the primary reason enumeration.
@@ -5804,7 +5804,7 @@
5804 'You are contacting %s of the %s (%s) team directly.'5804 'You are contacting %s of the %s (%s) team directly.'
5805 % (text, person_or_team.displayname, person_or_team.name))5805 % (text, person_or_team.displayname, person_or_team.name))
58065806
5807 @cachedproperty('_all_recipients_cached')5807 @cachedproperty
5808 def _all_recipients(self):5808 def _all_recipients(self):
5809 """Set the cache of all recipients."""5809 """Set the cache of all recipients."""
5810 all_recipients = {}5810 all_recipients = {}
58115811
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2010-08-22 18:31:30 +0000
+++ lib/lp/registry/model/distroseries.py 2010-08-24 10:20:53 +0000
@@ -547,7 +547,7 @@
547 orderBy=["Language.englishname"])547 orderBy=["Language.englishname"])
548 return result548 return result
549549
550 @cachedproperty('_previous_series_cached')550 @cachedproperty
551 def previous_series(self):551 def previous_series(self):
552 """See `IDistroSeries`."""552 """See `IDistroSeries`."""
553 # This property is cached because it is used intensely inside553 # This property is cached because it is used intensely inside
554554
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2010-08-22 19:26:46 +0000
+++ lib/lp/registry/model/product.py 2010-08-24 10:23:04 +0000
@@ -38,7 +38,10 @@
38from zope.interface import implements38from zope.interface import implements
39from zope.security.proxy import removeSecurityProxy39from zope.security.proxy import removeSecurityProxy
4040
41from canonical.cachedproperty import cachedproperty41from lp.services.propertycache import (
42 cachedproperty,
43 IPropertyCache,
44 )
42from canonical.database.constants import UTC_NOW45from canonical.database.constants import UTC_NOW
43from canonical.database.datetimecol import UtcDateTimeCol46from canonical.database.datetimecol import UtcDateTimeCol
44from canonical.database.enumcol import EnumCol47from canonical.database.enumcol import EnumCol
@@ -428,7 +431,7 @@
428 notNull=True, default=False,431 notNull=True, default=False,
429 storm_validator=_validate_license_approved)432 storm_validator=_validate_license_approved)
430433
431 @cachedproperty('_commercial_subscription_cached')434 @cachedproperty
432 def commercial_subscription(self):435 def commercial_subscription(self):
433 return CommercialSubscription.selectOneBy(product=self)436 return CommercialSubscription.selectOneBy(product=self)
434437
@@ -475,7 +478,7 @@
475 purchaser=purchaser,478 purchaser=purchaser,
476 sales_system_id=voucher,479 sales_system_id=voucher,
477 whiteboard=whiteboard)480 whiteboard=whiteboard)
478 self._commercial_subscription_cached = subscription481 IPropertyCache(self).commercial_subscription = subscription
479 else:482 else:
480 if current_datetime <= self.commercial_subscription.date_expires:483 if current_datetime <= self.commercial_subscription.date_expires:
481 # Extend current subscription.484 # Extend current subscription.
482485
=== modified file 'lib/lp/soyuz/model/distroseriesbinarypackage.py'
--- lib/lp/soyuz/model/distroseriesbinarypackage.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/model/distroseriesbinarypackage.py 2010-08-24 10:25:36 +0000
@@ -12,7 +12,10 @@
12from storm.store import Store12from storm.store import Store
13from zope.interface import implements13from zope.interface import implements
1414
15from canonical.cachedproperty import cachedproperty15from lp.services.propertycache import (
16 cachedproperty,
17 IPropertyCache,
18 )
16from canonical.database.sqlbase import sqlvalues19from canonical.database.sqlbase import sqlvalues
17from lp.soyuz.interfaces.distroseriesbinarypackage import (20from lp.soyuz.interfaces.distroseriesbinarypackage import (
18 IDistroSeriesBinaryPackage,21 IDistroSeriesBinaryPackage,
@@ -40,7 +43,7 @@
40 self.distroseries = distroseries43 self.distroseries = distroseries
41 self.binarypackagename = binarypackagename44 self.binarypackagename = binarypackagename
42 if cache is not None:45 if cache is not None:
43 self._cache = cache46 IPropertyCache(self).cache = cache
4447
45 @property48 @property
46 def name(self):49 def name(self):
@@ -58,7 +61,7 @@
58 """See IDistroSeriesBinaryPackage."""61 """See IDistroSeriesBinaryPackage."""
59 return self.distroseries.distribution62 return self.distroseries.distribution
6063
61 @cachedproperty('_cache')64 @cachedproperty
62 def cache(self):65 def cache(self):
63 """See IDistroSeriesBinaryPackage."""66 """See IDistroSeriesBinaryPackage."""
64 store = Store.of(self.distroseries)67 store = Store.of(self.distroseries)
6568
=== modified file 'lib/lp/testopenid/browser/server.py'
--- lib/lp/testopenid/browser/server.py 2010-08-20 20:31:18 +0000
+++ lib/lp/testopenid/browser/server.py 2010-08-24 10:27:59 +0000
@@ -32,7 +32,10 @@
32from zope.security.proxy import isinstance as zisinstance32from zope.security.proxy import isinstance as zisinstance
33from zope.session.interfaces import ISession33from zope.session.interfaces import ISession
3434
35from canonical.cachedproperty import cachedproperty35from lp.services.propertycache import (
36 cachedproperty,
37 IPropertyCache,
38 )
36from canonical.launchpad import _39from canonical.launchpad import _
37from canonical.launchpad.interfaces.account import (40from canonical.launchpad.interfaces.account import (
38 AccountStatus,41 AccountStatus,
@@ -142,7 +145,7 @@
142 return (self.openid_request.idSelect() or145 return (self.openid_request.idSelect() or
143 self.openid_request.identity == self.user_identity_url)146 self.openid_request.identity == self.user_identity_url)
144147
145 @cachedproperty('_openid_parameters')148 @cachedproperty
146 def openid_parameters(self):149 def openid_parameters(self):
147 """A dictionary of OpenID query parameters from request."""150 """A dictionary of OpenID query parameters from request."""
148 query = {}151 query = {}
@@ -165,8 +168,9 @@
165 def restoreRequestFromSession(self):168 def restoreRequestFromSession(self):
166 """Get the OpenIDRequest from our session."""169 """Get the OpenIDRequest from our session."""
167 session = self.getSession()170 session = self.getSession()
171 cache = IPropertyCache(self)
168 try:172 try:
169 self._openid_parameters = session[OPENID_REQUEST_SESSION_KEY]173 cache.openid_parameters = session[OPENID_REQUEST_SESSION_KEY]
170 except KeyError:174 except KeyError:
171 raise UnexpectedFormData("No OpenID request in session")175 raise UnexpectedFormData("No OpenID request in session")
172176
173177
=== modified file 'lib/lp/shipit.py'
--- lib/lp/shipit.py 2010-08-20 20:31:18 +0000
+++ lib/lp/shipit.py 2010-08-24 15:27:46 +0000
@@ -106,6 +106,10 @@
106from lp.registry.model.person import Person106from lp.registry.model.person import Person
107from lp.services.mail import stub107from lp.services.mail import stub
108from lp.services.mail.sendmail import simple_sendmail108from lp.services.mail.sendmail import simple_sendmail
109from lp.services.propertycache import (
110 cachedproperty,
111 IPropertyCache,
112 )
109from lp.services.scripts.base import (113from lp.services.scripts.base import (
110 LaunchpadCronScript,114 LaunchpadCronScript,
111 LaunchpadScript,115 LaunchpadScript,
Revision history for this message
Robert Collins (lifeless) wrote :

\o/

review: Approve
Revision history for this message
Graham Binns (gmb) wrote :

r=me on the changes made here: http://paste.ubuntu.com/486317/

review: Approve (code)
Revision history for this message
Gavin Panella (allenap) wrote :

Hi Rob,

If you get a chance, please could you review my workaround for bug
628762
(diff attached). It passes the full test suite, hurrah :)

Thanks, Gavin.

=== modified file 'lib/lp/services/propertycache.py'
--- lib/lp/services/propertycache.py 2010-08-31 11:03:41 +0000
+++ lib/lp/services/propertycache.py 2010-09-02 12:52:40 +0000
@@ -184,3 +184,32 @@
184 name = name_or_function.__name__184 name = name_or_function.__name__
185 populate = name_or_function185 populate = name_or_function
186 return CachedProperty(name=name, populate=populate)186 return CachedProperty(name=name, populate=populate)
187
188
189# XXX: GavinPanella 2010-09-02 bug=628762: There are some weird adaption
190# failures when running the full test suite. All that follows is a temporary,
191# mostly non-Zope, workaround.
192
193_IPropertyCache = IPropertyCache
194_IPropertyCacheManager = IPropertyCacheManager
195
196def IPropertyCache(target):
197 """Return the `IPropertyCache` for `target`.
198
199 Note: this is a workaround; see bug 628762.
200 """
201 if _IPropertyCache.providedBy(target):
202 return target
203 else:
204 return get_default_cache(target)
205
206def IPropertyCacheManager(target):
207 """Return the `IPropertyCacheManager` for `target`.
208
209 Note: this is a workaround; see bug 628762.
210 """
211 cache = IPropertyCache(target)
212 if isinstance(cache, DefaultPropertyCache):
213 return DefaultPropertyCacheManager(cache)
214 else:
215 return PropertyCacheManager(cache)
Revision history for this message
Robert Collins (lifeless) wrote :

looks ok to me

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.ctags'
--- .ctags 2010-01-06 20:06:23 +0000
+++ .ctags 2010-09-02 12:57:56 +0000
@@ -1,1 +1,4 @@
1--python-kinds=-iv1--python-kinds=-iv
2--exclude=*-min.js
3--exclude=*-debug.js
4--extra=+f
25
=== removed file 'lib/canonical/cachedproperty.py'
--- lib/canonical/cachedproperty.py 2010-08-17 07:03:25 +0000
+++ lib/canonical/cachedproperty.py 1970-01-01 00:00:00 +0000
@@ -1,229 +0,0 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).
3
4"""Cached properties for situations where a property is computed once and
5then returned each time it is asked for.
6
7The clear_cachedproperties function can be used to wipe the cache of properties
8from an instance.
9"""
10
11__metaclass__ = type
12
13__all__ = [
14 'cache_property',
15 'cachedproperty',
16 'clear_cachedproperties',
17 'clear_property',
18 ]
19
20from zope.security.proxy import removeSecurityProxy
21
22from canonical.lazr.utils import safe_hasattr
23
24# XXX: JonathanLange 2010-01-11 bug=505731: Move this to lp.services.
25
26def cachedproperty(attrname_or_fn):
27 """A decorator for methods that makes them properties with their return
28 value cached.
29
30 The value is cached on the instance, using the attribute name provided.
31
32 If you don't provide a name, the mangled name of the property is used.
33
34 cachedproperty is not threadsafe - it should not be used on objects which
35 are shared across threads / external locking should be used on those
36 objects.
37
38 >>> class CachedPropertyTest(object):
39 ...
40 ... @cachedproperty('_foo_cache')
41 ... def foo(self):
42 ... print 'foo computed'
43 ... return 23
44 ...
45 ... @cachedproperty
46 ... def bar(self):
47 ... print 'bar computed'
48 ... return 69
49
50 >>> cpt = CachedPropertyTest()
51 >>> getattr(cpt, '_foo_cache', None) is None
52 True
53 >>> cpt.foo
54 foo computed
55 23
56 >>> cpt.foo
57 23
58 >>> cpt._foo_cache
59 23
60 >>> cpt.bar
61 bar computed
62 69
63 >>> cpt._bar_cached_value
64 69
65
66 Cached properties are listed on instances.
67 >>> sorted(cpt._cached_properties)
68 ['_bar_cached_value', '_foo_cache']
69
70 """
71 if isinstance(attrname_or_fn, basestring):
72 attrname = attrname_or_fn
73 return CachedPropertyForAttr(attrname)
74 else:
75 fn = attrname_or_fn
76 attrname = '_%s_cached_value' % fn.__name__
77 return CachedProperty(attrname, fn)
78
79def cache_property(instance, attrname, value):
80 """Cache value on instance as attrname.
81
82 instance._cached_properties is updated with attrname.
83
84 >>> class CachedPropertyTest(object):
85 ...
86 ... @cachedproperty('_foo_cache')
87 ... def foo(self):
88 ... return 23
89 ...
90 >>> instance = CachedPropertyTest()
91 >>> cache_property(instance, '_foo_cache', 42)
92 >>> instance.foo
93 42
94 >>> instance._cached_properties
95 ['_foo_cache']
96
97 Caching a new value does not duplicate the cache keys.
98
99 >>> cache_property(instance, '_foo_cache', 84)
100 >>> instance._cached_properties
101 ['_foo_cache']
102
103 And does update the cached value.
104
105 >>> instance.foo
106 84
107 """
108 naked_instance = removeSecurityProxy(instance)
109 clear_property(naked_instance, attrname)
110 setattr(naked_instance, attrname, value)
111 cached_properties = getattr(naked_instance, '_cached_properties', [])
112 cached_properties.append(attrname)
113 naked_instance._cached_properties = cached_properties
114
115
116def clear_property(instance, attrname):
117 """Remove a cached attribute from instance.
118
119 The attribute name is removed from instance._cached_properties.
120
121 If the property is not cached, nothing happens.
122
123 :seealso clear_cachedproperties: For clearing all cached items at once.
124
125 >>> class CachedPropertyTest(object):
126 ...
127 ... @cachedproperty('_foo_cache')
128 ... def foo(self):
129 ... return 23
130 ...
131 >>> instance = CachedPropertyTest()
132 >>> instance.foo
133 23
134 >>> clear_property(instance, '_foo_cache')
135 >>> instance._cached_properties
136 []
137 >>> is_cached(instance, '_foo_cache')
138 False
139 >>> clear_property(instance, '_foo_cache')
140 """
141 naked_instance = removeSecurityProxy(instance)
142 if not is_cached(naked_instance, attrname):
143 return
144 delattr(naked_instance, attrname)
145 naked_instance._cached_properties.remove(attrname)
146
147
148def clear_cachedproperties(instance):
149 """Clear cached properties from an object.
150
151 >>> class CachedPropertyTest(object):
152 ...
153 ... @cachedproperty('_foo_cache')
154 ... def foo(self):
155 ... return 23
156 ...
157 >>> instance = CachedPropertyTest()
158 >>> instance.foo
159 23
160 >>> instance._cached_properties
161 ['_foo_cache']
162 >>> clear_cachedproperties(instance)
163 >>> instance._cached_properties
164 []
165 >>> hasattr(instance, '_foo_cache')
166 False
167 """
168 naked_instance = removeSecurityProxy(instance)
169 cached_properties = getattr(naked_instance, '_cached_properties', [])
170 for property_name in cached_properties:
171 delattr(naked_instance, property_name)
172 naked_instance._cached_properties = []
173
174
175def is_cached(instance, attrname):
176 """Return True if attrname is cached on instance.
177
178 >>> class CachedPropertyTest(object):
179 ...
180 ... @cachedproperty('_foo_cache')
181 ... def foo(self):
182 ... return 23
183 ...
184 >>> instance = CachedPropertyTest()
185 >>> instance.foo
186 23
187 >>> is_cached(instance, '_foo_cache')
188 True
189 >>> is_cached(instance, '_var_cache')
190 False
191 """
192 naked_instance = removeSecurityProxy(instance)
193 return safe_hasattr(naked_instance, attrname)
194
195
196class CachedPropertyForAttr:
197 """Curry a decorator to provide arguments to the CachedProperty."""
198
199 def __init__(self, attrname):
200 self.attrname = attrname
201
202 def __call__(self, fn):
203 return CachedProperty(self.attrname, fn)
204
205
206class CachedProperty:
207
208 # Used to detect not-yet-cached properties.
209 sentinel = object()
210
211 def __init__(self, attrname, fn):
212 self.fn = fn
213 self.attrname = attrname
214
215 def __get__(self, inst, cls=None):
216 if inst is None:
217 return self
218 cachedresult = getattr(inst, self.attrname, CachedProperty.sentinel)
219 if cachedresult is CachedProperty.sentinel:
220 result = self.fn(inst)
221 cache_property(inst, self.attrname, result)
222 return result
223 else:
224 return cachedresult
225
226
227if __name__ == '__main__':
228 import doctest
229 doctest.testmod()
2300
=== modified file 'lib/canonical/database/sqlbase.py'
--- lib/canonical/database/sqlbase.py 2010-09-02 12:57:52 +0000
+++ lib/canonical/database/sqlbase.py 2010-09-02 12:57:56 +0000
@@ -65,7 +65,6 @@
65from zope.interface import implements65from zope.interface import implements
66from zope.security.proxy import removeSecurityProxy66from zope.security.proxy import removeSecurityProxy
6767
68from canonical.cachedproperty import clear_cachedproperties
69from canonical.config import (68from canonical.config import (
70 config,69 config,
71 dbconfig,70 dbconfig,
@@ -73,7 +72,6 @@
73from canonical.database.interfaces import ISQLBase72from canonical.database.interfaces import ISQLBase
74from lp.services.propertycache import IPropertyCacheManager73from lp.services.propertycache import IPropertyCacheManager
7574
76
77# Default we want for scripts, and the PostgreSQL default. Note psycopg1 will75# Default we want for scripts, and the PostgreSQL default. Note psycopg1 will
78# use SERIALIZABLE unless we override, but psycopg2 will not.76# use SERIALIZABLE unless we override, but psycopg2 will not.
79ISOLATION_LEVEL_DEFAULT = ISOLATION_LEVEL_READ_COMMITTED77ISOLATION_LEVEL_DEFAULT = ISOLATION_LEVEL_READ_COMMITTED
@@ -271,10 +269,6 @@
271 # XXX: RobertCollins 2010-08-16 bug=622648: Note this is not directly269 # XXX: RobertCollins 2010-08-16 bug=622648: Note this is not directly
272 # tested, but the entire test suite blows up awesomely if it's broken.270 # tested, but the entire test suite blows up awesomely if it's broken.
273 # It's entirely unclear where tests for this should be.271 # It's entirely unclear where tests for this should be.
274
275 # While canonical.cachedproperty and lp.services.propertycache are
276 # both in use, we must clear the caches for both.
277 clear_cachedproperties(self)
278 IPropertyCacheManager(self).clear()272 IPropertyCacheManager(self).clear()
279273
280274
281275
=== modified file 'lib/canonical/launchpad/browser/launchpad.py'
--- lib/canonical/launchpad/browser/launchpad.py 2010-08-20 20:31:18 +0000
+++ lib/canonical/launchpad/browser/launchpad.py 2010-09-02 12:57:56 +0000
@@ -53,7 +53,6 @@
53from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest53from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest
54from zope.security.interfaces import Unauthorized54from zope.security.interfaces import Unauthorized
5555
56from canonical.cachedproperty import cachedproperty
57from canonical.config import config56from canonical.config import config
58from canonical.launchpad.helpers import intOrZero57from canonical.launchpad.helpers import intOrZero
59from canonical.launchpad.interfaces.account import AccountStatus58from canonical.launchpad.interfaces.account import AccountStatus
@@ -142,6 +141,7 @@
142 )141 )
143from lp.registry.interfaces.projectgroup import IProjectGroupSet142from lp.registry.interfaces.projectgroup import IProjectGroupSet
144from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet143from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
144from lp.services.propertycache import cachedproperty
145from lp.services.worlddata.interfaces.country import ICountrySet145from lp.services.worlddata.interfaces.country import ICountrySet
146from lp.services.worlddata.interfaces.language import ILanguageSet146from lp.services.worlddata.interfaces.language import ILanguageSet
147from lp.soyuz.interfaces.binarypackagename import IBinaryPackageNameSet147from lp.soyuz.interfaces.binarypackagename import IBinaryPackageNameSet
148148
=== modified file 'lib/canonical/launchpad/utilities/geoip.py'
--- lib/canonical/launchpad/utilities/geoip.py 2010-08-20 20:31:18 +0000
+++ lib/canonical/launchpad/utilities/geoip.py 2010-09-02 12:57:56 +0000
@@ -15,7 +15,6 @@
15from zope.i18n.interfaces import IUserPreferredLanguages15from zope.i18n.interfaces import IUserPreferredLanguages
16from zope.interface import implements16from zope.interface import implements
1717
18from canonical.cachedproperty import cachedproperty
19from canonical.config import config18from canonical.config import config
20from canonical.launchpad.components.request_country import (19from canonical.launchpad.components.request_country import (
21 ipaddress_from_request,20 ipaddress_from_request,
@@ -26,6 +25,7 @@
26 IRequestLocalLanguages,25 IRequestLocalLanguages,
27 IRequestPreferredLanguages,26 IRequestPreferredLanguages,
28 )27 )
28from lp.services.propertycache import cachedproperty
29from lp.services.worlddata.interfaces.country import ICountrySet29from lp.services.worlddata.interfaces.country import ICountrySet
30from lp.services.worlddata.interfaces.language import ILanguageSet30from lp.services.worlddata.interfaces.language import ILanguageSet
3131
3232
=== modified file 'lib/canonical/launchpad/webapp/error.py'
--- lib/canonical/launchpad/webapp/error.py 2010-08-23 21:58:28 +0000
+++ lib/canonical/launchpad/webapp/error.py 2010-09-02 12:57:56 +0000
@@ -22,7 +22,6 @@
22from zope.exceptions.exceptionformatter import format_exception22from zope.exceptions.exceptionformatter import format_exception
23from zope.interface import implements23from zope.interface import implements
2424
25from canonical.cachedproperty import cachedproperty
26from canonical.config import config25from canonical.config import config
27import canonical.launchpad.layers26import canonical.launchpad.layers
28from canonical.launchpad.webapp.adapter import (27from canonical.launchpad.webapp.adapter import (
@@ -31,6 +30,7 @@
31 )30 )
32from canonical.launchpad.webapp.interfaces import ILaunchBag31from canonical.launchpad.webapp.interfaces import ILaunchBag
33from canonical.launchpad.webapp.publisher import LaunchpadView32from canonical.launchpad.webapp.publisher import LaunchpadView
33from lp.services.propertycache import cachedproperty
3434
3535
36class SystemErrorView(LaunchpadView):36class SystemErrorView(LaunchpadView):
3737
=== modified file 'lib/canonical/launchpad/webapp/login.py'
--- lib/canonical/launchpad/webapp/login.py 2010-08-20 20:31:18 +0000
+++ lib/canonical/launchpad/webapp/login.py 2010-09-02 12:57:56 +0000
@@ -42,7 +42,6 @@
42 ISession,42 ISession,
43 )43 )
4444
45from canonical.cachedproperty import cachedproperty
46from canonical.config import config45from canonical.config import config
47from canonical.launchpad import _46from canonical.launchpad import _
48from canonical.launchpad.interfaces.account import AccountSuspendedError47from canonical.launchpad.interfaces.account import AccountSuspendedError
@@ -65,6 +64,7 @@
65 IPersonSet,64 IPersonSet,
66 PersonCreationRationale,65 PersonCreationRationale,
67 )66 )
67from lp.services.propertycache import cachedproperty
6868
6969
70class UnauthorizedView(SystemErrorView):70class UnauthorizedView(SystemErrorView):
7171
=== modified file 'lib/canonical/launchpad/webapp/servers.py'
--- lib/canonical/launchpad/webapp/servers.py 2010-08-27 16:01:05 +0000
+++ lib/canonical/launchpad/webapp/servers.py 2010-09-02 12:57:56 +0000
@@ -62,7 +62,6 @@
62from zope.server.http.wsgihttpserver import PMDBWSGIHTTPServer62from zope.server.http.wsgihttpserver import PMDBWSGIHTTPServer
63from zope.session.interfaces import ISession63from zope.session.interfaces import ISession
6464
65from canonical.cachedproperty import cachedproperty
66from canonical.config import config65from canonical.config import config
67from canonical.launchpad.interfaces.launchpad import (66from canonical.launchpad.interfaces.launchpad import (
68 IFeedsApplication,67 IFeedsApplication,
@@ -117,6 +116,7 @@
117from canonical.lazr.timeout import set_default_timeout_function116from canonical.lazr.timeout import set_default_timeout_function
118from lp.app.errors import UnexpectedFormData117from lp.app.errors import UnexpectedFormData
119from lp.services.features.flags import NullFeatureController118from lp.services.features.flags import NullFeatureController
119from lp.services.propertycache import cachedproperty
120from lp.testopenid.interfaces.server import ITestOpenIDApplication120from lp.testopenid.interfaces.server import ITestOpenIDApplication
121121
122122
123123
=== modified file 'lib/canonical/lazr/feed/feed.py'
--- lib/canonical/lazr/feed/feed.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/lazr/feed/feed.py 2010-09-02 12:57:56 +0000
@@ -17,32 +17,41 @@
17 'MINUTES',17 'MINUTES',
18 ]18 ]
1919
20from BeautifulSoup import BeautifulSoup
21from datetime import datetime20from datetime import datetime
22import pytz
23import operator21import operator
24import os22import os
25import time23import time
26from urlparse import urljoin24from urlparse import urljoin
27from xml.sax.saxutils import escape as xml_escape25from xml.sax.saxutils import escape as xml_escape
2826
27from BeautifulSoup import BeautifulSoup
28import pytz
29from z3c.ptcompat import ViewPageTemplateFile
30from zope.component import getUtility
29from zope.datetime import rfc1123_date31from zope.datetime import rfc1123_date
30from zope.component import getUtility
31from zope.interface import implements32from zope.interface import implements
3233
33from z3c.ptcompat import ViewPageTemplateFile
34
35from canonical.cachedproperty import cachedproperty
36from canonical.config import config34from canonical.config import config
37# XXX: bac 2007-09-20 bug=153795: modules in canonical.lazr should not import35# XXX: bac 2007-09-20 bug=153795: modules in canonical.lazr should not import
38# from canonical.launchpad, but we're doing it here as an expediency to get a36# from canonical.launchpad, but we're doing it here as an expediency to get a
39# working prototype.37# working prototype.
40from canonical.launchpad.interfaces import ILaunchpadRoot38from canonical.launchpad.interfaces import ILaunchpadRoot
41from canonical.launchpad.webapp import (39from canonical.launchpad.webapp import (
42 LaunchpadView, canonical_url, urlappend, urlparse)40 canonical_url,
41 LaunchpadView,
42 urlappend,
43 urlparse,
44 )
43from canonical.launchpad.webapp.vhosts import allvhosts45from canonical.launchpad.webapp.vhosts import allvhosts
44from canonical.lazr.interfaces import (46from canonical.lazr.interfaces import (
45 IFeed, IFeedEntry, IFeedPerson, IFeedTypedData, UnsupportedFeedFormat)47 IFeed,
48 IFeedEntry,
49 IFeedPerson,
50 IFeedTypedData,
51 UnsupportedFeedFormat,
52 )
53from lp.services.propertycache import cachedproperty
54
4655
47SUPPORTED_FEEDS = ('.atom', '.html')56SUPPORTED_FEEDS = ('.atom', '.html')
48MINUTES = 60 # Seconds in a minute.57MINUTES = 60 # Seconds in a minute.
4958
=== removed file 'lib/canonical/tests/test_cachedproperty.py'
--- lib/canonical/tests/test_cachedproperty.py 2010-07-14 14:11:15 +0000
+++ lib/canonical/tests/test_cachedproperty.py 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).
3
4from doctest import DocTestSuite, ELLIPSIS
5import unittest
6
7import canonical.cachedproperty
8
9def test_suite():
10 suite = DocTestSuite(canonical.cachedproperty, optionflags=ELLIPSIS)
11 return suite
12
13
14if __name__ == '__main__':
15 unittest.main(defaultTest='test_suite')
160
=== modified file 'lib/canonical/widgets/popup.py'
--- lib/canonical/widgets/popup.py 2010-06-21 18:51:07 +0000
+++ lib/canonical/widgets/popup.py 2010-09-02 12:57:56 +0000
@@ -7,18 +7,19 @@
77
8__metaclass__ = type8__metaclass__ = type
99
10import cgi
10import os11import os
11import cgi12
12import simplejson13import simplejson
1314from z3c.ptcompat import ViewPageTemplateFile
15from zope.app.form.browser.itemswidgets import (
16 ItemsWidgetBase,
17 SingleDataHelper,
18 )
14from zope.schema.interfaces import IChoice19from zope.schema.interfaces import IChoice
15from zope.app.form.browser.itemswidgets import (
16 ItemsWidgetBase, SingleDataHelper)
17
18from z3c.ptcompat import ViewPageTemplateFile
1920
20from canonical.launchpad.webapp import canonical_url21from canonical.launchpad.webapp import canonical_url
21from canonical.cachedproperty import cachedproperty22from lp.services.propertycache import cachedproperty
2223
2324
24class VocabularyPickerWidget(SingleDataHelper, ItemsWidgetBase):25class VocabularyPickerWidget(SingleDataHelper, ItemsWidgetBase):
2526
=== modified file 'lib/lp/answers/browser/faqcollection.py'
--- lib/lp/answers/browser/faqcollection.py 2010-08-20 20:31:18 +0000
+++ lib/lp/answers/browser/faqcollection.py 2010-09-02 12:57:56 +0000
@@ -12,7 +12,6 @@
1212
13from urllib import urlencode13from urllib import urlencode
1414
15from canonical.cachedproperty import cachedproperty
16from canonical.launchpad import _15from canonical.launchpad import _
17from canonical.launchpad.webapp import (16from canonical.launchpad.webapp import (
18 action,17 action,
@@ -34,6 +33,7 @@
34 )33 )
35from lp.answers.interfaces.questionenums import QuestionSort34from lp.answers.interfaces.questionenums import QuestionSort
36from lp.registry.interfaces.projectgroup import IProjectGroup35from lp.registry.interfaces.projectgroup import IProjectGroup
36from lp.services.propertycache import cachedproperty
3737
3838
39class FAQCollectionMenu(NavigationMenu):39class FAQCollectionMenu(NavigationMenu):
4040
=== modified file 'lib/lp/answers/browser/question.py'
--- lib/lp/answers/browser/question.py 2010-08-20 20:31:18 +0000
+++ lib/lp/answers/browser/question.py 2010-09-02 12:57:56 +0000
@@ -55,7 +55,6 @@
55 )55 )
56import zope.security56import zope.security
5757
58from canonical.cachedproperty import cachedproperty
59from canonical.launchpad import _58from canonical.launchpad import _
60from canonical.launchpad.helpers import (59from canonical.launchpad.helpers import (
61 is_english_variant,60 is_english_variant,
@@ -116,6 +115,7 @@
116 UnexpectedFormData,115 UnexpectedFormData,
117 )116 )
118from lp.registry.interfaces.projectgroup import IProjectGroup117from lp.registry.interfaces.projectgroup import IProjectGroup
118from lp.services.propertycache import cachedproperty
119119
120120
121class QuestionLinksMixin:121class QuestionLinksMixin:
122122
=== modified file 'lib/lp/answers/browser/questiontarget.py'
--- lib/lp/answers/browser/questiontarget.py 2010-08-26 17:45:46 +0000
+++ lib/lp/answers/browser/questiontarget.py 2010-09-02 12:57:56 +0000
@@ -28,8 +28,8 @@
28from z3c.ptcompat import ViewPageTemplateFile28from z3c.ptcompat import ViewPageTemplateFile
29from zope.app.form.browser import DropdownWidget29from zope.app.form.browser import DropdownWidget
30from zope.component import (30from zope.component import (
31 getMultiAdapter,
31 getUtility,32 getUtility,
32 getMultiAdapter,
33 queryMultiAdapter,33 queryMultiAdapter,
34 )34 )
35from zope.formlib import form35from zope.formlib import form
@@ -43,7 +43,6 @@
43 SimpleVocabulary,43 SimpleVocabulary,
44 )44 )
4545
46from canonical.cachedproperty import cachedproperty
47from canonical.launchpad import _46from canonical.launchpad import _
48from canonical.launchpad.helpers import (47from canonical.launchpad.helpers import (
49 browserLanguages,48 browserLanguages,
@@ -67,7 +66,6 @@
67from canonical.launchpad.webapp.breadcrumb import Breadcrumb66from canonical.launchpad.webapp.breadcrumb import Breadcrumb
68from canonical.launchpad.webapp.menu import structured67from canonical.launchpad.webapp.menu import structured
69from canonical.widgets import LabeledMultiCheckBoxWidget68from canonical.widgets import LabeledMultiCheckBoxWidget
70from lp.app.errors import NotFoundError
71from lp.answers.browser.faqcollection import FAQCollectionMenu69from lp.answers.browser.faqcollection import FAQCollectionMenu
72from lp.answers.interfaces.faqcollection import IFAQCollection70from lp.answers.interfaces.faqcollection import IFAQCollection
73from lp.answers.interfaces.questioncollection import (71from lp.answers.interfaces.questioncollection import (
@@ -80,10 +78,12 @@
80 IQuestionTarget,78 IQuestionTarget,
81 ISearchQuestionsForm,79 ISearchQuestionsForm,
82 )80 )
81from lp.app.errors import NotFoundError
83from lp.registry.interfaces.distribution import IDistribution82from lp.registry.interfaces.distribution import IDistribution
84from lp.registry.interfaces.product import IProduct83from lp.registry.interfaces.product import IProduct
85from lp.registry.interfaces.projectgroup import IProjectGroup84from lp.registry.interfaces.projectgroup import IProjectGroup
86from lp.services.fields import PublicPersonChoice85from lp.services.fields import PublicPersonChoice
86from lp.services.propertycache import cachedproperty
87from lp.services.worlddata.interfaces.language import ILanguageSet87from lp.services.worlddata.interfaces.language import ILanguageSet
8888
8989
9090
=== modified file 'lib/lp/answers/notification.py'
--- lib/lp/answers/notification.py 2010-08-20 20:31:18 +0000
+++ lib/lp/answers/notification.py 2010-09-02 12:57:56 +0000
@@ -10,7 +10,6 @@
1010
11import os11import os
1212
13from canonical.cachedproperty import cachedproperty
14from canonical.config import config13from canonical.config import config
15from canonical.launchpad.mail import (14from canonical.launchpad.mail import (
16 format_address,15 format_address,
@@ -21,6 +20,7 @@
21from lp.registry.interfaces.person import IPerson20from lp.registry.interfaces.person import IPerson
22from lp.services.mail.mailwrapper import MailWrapper21from lp.services.mail.mailwrapper import MailWrapper
23from lp.services.mail.notificationrecipientset import NotificationRecipientSet22from lp.services.mail.notificationrecipientset import NotificationRecipientSet
23from lp.services.propertycache import cachedproperty
2424
2525
26def get_email_template(filename):26def get_email_template(filename):
2727
=== modified file 'lib/lp/app/browser/root.py'
--- lib/lp/app/browser/root.py 2010-08-20 20:31:18 +0000
+++ lib/lp/app/browser/root.py 2010-09-02 12:57:56 +0000
@@ -20,7 +20,6 @@
20from zope.schema.interfaces import TooLong20from zope.schema.interfaces import TooLong
21from zope.schema.vocabulary import getVocabularyRegistry21from zope.schema.vocabulary import getVocabularyRegistry
2222
23from canonical.cachedproperty import cachedproperty
24from canonical.config import config23from canonical.config import config
25from canonical.launchpad.interfaces.launchpad import (24from canonical.launchpad.interfaces.launchpad import (
26 ILaunchpadCelebrities,25 ILaunchpadCelebrities,
@@ -54,6 +53,7 @@
54from lp.registry.interfaces.person import IPersonSet53from lp.registry.interfaces.person import IPersonSet
55from lp.registry.interfaces.pillar import IPillarNameSet54from lp.registry.interfaces.pillar import IPillarNameSet
56from lp.registry.interfaces.product import IProductSet55from lp.registry.interfaces.product import IProductSet
56from lp.services.propertycache import cachedproperty
5757
5858
59shipit_faq_url = 'http://www.ubuntu.com/getubuntu/shipit-faq'59shipit_faq_url = 'http://www.ubuntu.com/getubuntu/shipit-faq'
6060
=== modified file 'lib/lp/archivepublisher/diskpool.py'
--- lib/lp/archivepublisher/diskpool.py 2010-08-20 20:31:18 +0000
+++ lib/lp/archivepublisher/diskpool.py 2010-09-02 12:57:56 +0000
@@ -6,12 +6,12 @@
6import os6import os
7import tempfile7import tempfile
88
9from canonical.cachedproperty import cachedproperty
10from canonical.librarian.utils import (9from canonical.librarian.utils import (
11 copy_and_close,10 copy_and_close,
12 sha1_from_path,11 sha1_from_path,
13 )12 )
14from lp.archivepublisher import HARDCODED_COMPONENT_ORDER13from lp.archivepublisher import HARDCODED_COMPONENT_ORDER
14from lp.services.propertycache import cachedproperty
15from lp.soyuz.interfaces.publishing import (15from lp.soyuz.interfaces.publishing import (
16 MissingSymlinkInPool,16 MissingSymlinkInPool,
17 NotInPool,17 NotInPool,
1818
=== modified file 'lib/lp/blueprints/browser/specification.py'
--- lib/lp/blueprints/browser/specification.py 2010-08-20 20:31:18 +0000
+++ lib/lp/blueprints/browser/specification.py 2010-09-02 12:57:56 +0000
@@ -61,7 +61,6 @@
61 SimpleVocabulary,61 SimpleVocabulary,
62 )62 )
6363
64from canonical.cachedproperty import cachedproperty
65from canonical.config import config64from canonical.config import config
66from canonical.launchpad import _65from canonical.launchpad import _
67from canonical.launchpad.browser.launchpad import AppFrontPageSearchView66from canonical.launchpad.browser.launchpad import AppFrontPageSearchView
@@ -100,6 +99,7 @@
100from lp.code.interfaces.branchnamespace import IBranchNamespaceSet99from lp.code.interfaces.branchnamespace import IBranchNamespaceSet
101from lp.registry.interfaces.distribution import IDistribution100from lp.registry.interfaces.distribution import IDistribution
102from lp.registry.interfaces.product import IProduct101from lp.registry.interfaces.product import IProduct
102from lp.services.propertycache import cachedproperty
103103
104104
105class NewSpecificationView(LaunchpadFormView):105class NewSpecificationView(LaunchpadFormView):
106106
=== modified file 'lib/lp/blueprints/browser/specificationgoal.py'
--- lib/lp/blueprints/browser/specificationgoal.py 2010-08-20 20:31:18 +0000
+++ lib/lp/blueprints/browser/specificationgoal.py 2010-09-02 12:57:56 +0000
@@ -12,7 +12,6 @@
1212
13from zope.component import getUtility13from zope.component import getUtility
1414
15from canonical.cachedproperty import cachedproperty
16from canonical.launchpad.webapp import (15from canonical.launchpad.webapp import (
17 canonical_url,16 canonical_url,
18 LaunchpadView,17 LaunchpadView,
@@ -20,6 +19,7 @@
20from canonical.launchpad.webapp.interfaces import ILaunchBag19from canonical.launchpad.webapp.interfaces import ILaunchBag
21from lp.blueprints.browser.specificationtarget import HasSpecificationsView20from lp.blueprints.browser.specificationtarget import HasSpecificationsView
22from lp.blueprints.interfaces.specification import SpecificationFilter21from lp.blueprints.interfaces.specification import SpecificationFilter
22from lp.services.propertycache import cachedproperty
2323
2424
25class GoalDecideView(HasSpecificationsView, LaunchpadView):25class GoalDecideView(HasSpecificationsView, LaunchpadView):
2626
=== modified file 'lib/lp/blueprints/browser/specificationtarget.py'
--- lib/lp/blueprints/browser/specificationtarget.py 2010-08-20 20:31:18 +0000
+++ lib/lp/blueprints/browser/specificationtarget.py 2010-09-02 12:57:56 +0000
@@ -17,7 +17,6 @@
1717
18from zope.component import queryMultiAdapter18from zope.component import queryMultiAdapter
1919
20from canonical.cachedproperty import cachedproperty
21from canonical.config import config20from canonical.config import config
22from canonical.launchpad import _21from canonical.launchpad import _
23from canonical.launchpad.helpers import shortlist22from canonical.launchpad.helpers import shortlist
@@ -48,6 +47,7 @@
48 IProjectGroup,47 IProjectGroup,
49 IProjectGroupSeries,48 IProjectGroupSeries,
50 )49 )
50from lp.services.propertycache import cachedproperty
5151
5252
53class HasSpecificationsMenuMixin:53class HasSpecificationsMenuMixin:
5454
=== modified file 'lib/lp/blueprints/browser/sprint.py'
--- lib/lp/blueprints/browser/sprint.py 2010-08-20 20:31:18 +0000
+++ lib/lp/blueprints/browser/sprint.py 2010-09-02 12:57:56 +0000
@@ -30,7 +30,6 @@
30from zope.component import getUtility30from zope.component import getUtility
31from zope.interface import implements31from zope.interface import implements
3232
33from canonical.cachedproperty import cachedproperty
34from canonical.launchpad import _33from canonical.launchpad import _
35from canonical.launchpad.helpers import shortlist34from canonical.launchpad.helpers import shortlist
36from canonical.launchpad.webapp import (35from canonical.launchpad.webapp import (
@@ -71,6 +70,7 @@
71 IRegistryCollectionNavigationMenu,70 IRegistryCollectionNavigationMenu,
72 RegistryCollectionActionMenuBase,71 RegistryCollectionActionMenuBase,
73 )72 )
73from lp.services.propertycache import cachedproperty
7474
7575
76class SprintFacets(StandardLaunchpadFacets):76class SprintFacets(StandardLaunchpadFacets):
7777
=== modified file 'lib/lp/bugs/browser/bug.py'
--- lib/lp/bugs/browser/bug.py 2010-08-27 05:34:32 +0000
+++ lib/lp/bugs/browser/bug.py 2010-09-02 12:57:56 +0000
@@ -63,7 +63,6 @@
63from zope.schema.interfaces import IText63from zope.schema.interfaces import IText
64from zope.security.interfaces import Unauthorized64from zope.security.interfaces import Unauthorized
6565
66from canonical.cachedproperty import cachedproperty
67from canonical.launchpad import _66from canonical.launchpad import _
68from canonical.launchpad.browser.librarian import ProxiedLibraryFileAlias67from canonical.launchpad.browser.librarian import ProxiedLibraryFileAlias
69from canonical.launchpad.mailnotification import MailWrapper68from canonical.launchpad.mailnotification import MailWrapper
@@ -115,6 +114,7 @@
115from lp.bugs.interfaces.cve import ICveSet114from lp.bugs.interfaces.cve import ICveSet
116from lp.bugs.mail.bugnotificationbuilder import format_rfc2822_date115from lp.bugs.mail.bugnotificationbuilder import format_rfc2822_date
117from lp.services.fields import DuplicateBug116from lp.services.fields import DuplicateBug
117from lp.services.propertycache import cachedproperty
118118
119119
120class BugNavigation(Navigation):120class BugNavigation(Navigation):
121121
=== modified file 'lib/lp/bugs/browser/bugalsoaffects.py'
--- lib/lp/bugs/browser/bugalsoaffects.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/browser/bugalsoaffects.py 2010-09-02 12:57:56 +0000
@@ -29,7 +29,6 @@
29 SimpleVocabulary,29 SimpleVocabulary,
30 )30 )
3131
32from canonical.cachedproperty import cachedproperty
33from canonical.launchpad import _32from canonical.launchpad import _
34from canonical.launchpad.browser.multistep import (33from canonical.launchpad.browser.multistep import (
35 MultiStepView,34 MultiStepView,
@@ -85,6 +84,7 @@
85 License,84 License,
86 )85 )
87from lp.services.fields import StrippedTextLine86from lp.services.fields import StrippedTextLine
87from lp.services.propertycache import cachedproperty
8888
8989
90class BugAlsoAffectsProductMetaView(MultiStepView):90class BugAlsoAffectsProductMetaView(MultiStepView):
9191
=== modified file 'lib/lp/bugs/browser/bugbranch.py'
--- lib/lp/bugs/browser/bugbranch.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/browser/bugbranch.py 2010-09-02 12:57:56 +0000
@@ -22,7 +22,6 @@
22 Interface,22 Interface,
23 )23 )
2424
25from canonical.cachedproperty import cachedproperty
26from canonical.launchpad import _25from canonical.launchpad import _
27from canonical.launchpad.webapp import (26from canonical.launchpad.webapp import (
28 action,27 action,
@@ -38,6 +37,7 @@
38 latest_proposals_for_each_branch,37 latest_proposals_for_each_branch,
39 )38 )
40from lp.code.enums import BranchLifecycleStatus39from lp.code.enums import BranchLifecycleStatus
40from lp.services.propertycache import cachedproperty
4141
4242
43class BugBranchPrimaryContext:43class BugBranchPrimaryContext:
4444
=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py 2010-08-22 18:31:30 +0000
+++ lib/lp/bugs/browser/bugtarget.py 2010-09-02 12:57:56 +0000
@@ -50,7 +50,6 @@
50from zope.schema.vocabulary import SimpleVocabulary50from zope.schema.vocabulary import SimpleVocabulary
51from zope.security.proxy import removeSecurityProxy51from zope.security.proxy import removeSecurityProxy
5252
53from canonical.cachedproperty import cachedproperty
54from canonical.config import config53from canonical.config import config
55from canonical.launchpad import _54from canonical.launchpad import _
56from canonical.launchpad.browser.feeds import (55from canonical.launchpad.browser.feeds import (
@@ -137,6 +136,7 @@
137from lp.registry.interfaces.sourcepackage import ISourcePackage136from lp.registry.interfaces.sourcepackage import ISourcePackage
138from lp.registry.vocabularies import ValidPersonOrTeamVocabulary137from lp.registry.vocabularies import ValidPersonOrTeamVocabulary
139from lp.services.job.interfaces.job import JobStatus138from lp.services.job.interfaces.job import JobStatus
139from lp.services.propertycache import cachedproperty
140140
141# A simple vocabulary for the subscribe_to_existing_bug form field.141# A simple vocabulary for the subscribe_to_existing_bug form field.
142SUBSCRIBE_TO_BUG_VOCABULARY = SimpleVocabulary.fromItems(142SUBSCRIBE_TO_BUG_VOCABULARY = SimpleVocabulary.fromItems(
143143
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2010-08-31 18:15:15 +0000
+++ lib/lp/bugs/browser/bugtask.py 2010-09-02 12:57:56 +0000
@@ -125,7 +125,6 @@
125 )125 )
126from zope.traversing.interfaces import IPathAdapter126from zope.traversing.interfaces import IPathAdapter
127127
128from canonical.cachedproperty import cachedproperty
129from canonical.config import config128from canonical.config import config
130from canonical.database.sqlbase import cursor129from canonical.database.sqlbase import cursor
131from canonical.launchpad import (130from canonical.launchpad import (
@@ -260,6 +259,7 @@
260from lp.registry.interfaces.sourcepackage import ISourcePackage259from lp.registry.interfaces.sourcepackage import ISourcePackage
261from lp.registry.vocabularies import MilestoneVocabulary260from lp.registry.vocabularies import MilestoneVocabulary
262from lp.services.fields import PersonChoice261from lp.services.fields import PersonChoice
262from lp.services.propertycache import cachedproperty
263263
264264
265@component.adapter(IBugTask, IReferenceChoice, IWebServiceClientRequest)265@component.adapter(IBugTask, IReferenceChoice, IWebServiceClientRequest)
266266
=== modified file 'lib/lp/bugs/browser/bugtracker.py'
--- lib/lp/bugs/browser/bugtracker.py 2010-08-26 12:33:03 +0000
+++ lib/lp/bugs/browser/bugtracker.py 2010-09-02 12:57:56 +0000
@@ -29,7 +29,6 @@
29from zope.schema.vocabulary import SimpleVocabulary29from zope.schema.vocabulary import SimpleVocabulary
30from zope.security.interfaces import Unauthorized30from zope.security.interfaces import Unauthorized
3131
32from canonical.cachedproperty import cachedproperty
33from canonical.database.sqlbase import flush_database_updates32from canonical.database.sqlbase import flush_database_updates
34from canonical.launchpad import _33from canonical.launchpad import _
35from canonical.launchpad.helpers import (34from canonical.launchpad.helpers import (
@@ -69,6 +68,7 @@
69 IBugTrackerSet,68 IBugTrackerSet,
70 IRemoteBug,69 IRemoteBug,
71 )70 )
71from lp.services.propertycache import cachedproperty
7272
73# A set of bug tracker types for which there can only ever be one bug73# A set of bug tracker types for which there can only ever be one bug
74# tracker.74# tracker.
7575
=== modified file 'lib/lp/bugs/browser/cvereport.py'
--- lib/lp/bugs/browser/cvereport.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/browser/cvereport.py 2010-09-02 12:57:56 +0000
@@ -11,7 +11,6 @@
1111
12from zope.component import getUtility12from zope.component import getUtility
1313
14from canonical.cachedproperty import cachedproperty
15from canonical.launchpad.helpers import shortlist14from canonical.launchpad.helpers import shortlist
16from canonical.launchpad.searchbuilder import any15from canonical.launchpad.searchbuilder import any
17from canonical.launchpad.webapp import LaunchpadView16from canonical.launchpad.webapp import LaunchpadView
@@ -23,6 +22,7 @@
23 UNRESOLVED_BUGTASK_STATUSES,22 UNRESOLVED_BUGTASK_STATUSES,
24 )23 )
25from lp.bugs.interfaces.cve import ICveSet24from lp.bugs.interfaces.cve import ICveSet
25from lp.services.propertycache import cachedproperty
2626
2727
28class BugTaskCve:28class BugTaskCve:
2929
=== modified file 'lib/lp/bugs/browser/distribution_upstream_bug_report.py'
--- lib/lp/bugs/browser/distribution_upstream_bug_report.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/browser/distribution_upstream_bug_report.py 2010-09-02 12:57:56 +0000
@@ -11,13 +11,13 @@
1111
12from operator import attrgetter12from operator import attrgetter
1313
14from canonical.cachedproperty import cachedproperty
15from canonical.launchpad.webapp.publisher import (14from canonical.launchpad.webapp.publisher import (
16 canonical_url,15 canonical_url,
17 LaunchpadView,16 LaunchpadView,
18 )17 )
19from canonical.launchpad.webapp.url import urlappend18from canonical.launchpad.webapp.url import urlappend
20from lp.bugs.browser.bugtask import get_buglisting_search_filter_url19from lp.bugs.browser.bugtask import get_buglisting_search_filter_url
20from lp.services.propertycache import cachedproperty
2121
22# TODO: fix column sorting to work for the different colspans, or22# TODO: fix column sorting to work for the different colspans, or
23# alternatively implement a sort option box.23# alternatively implement a sort option box.
2424
=== modified file 'lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt'
--- lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt 2010-04-21 10:30:24 +0000
+++ lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt 2010-09-02 12:57:56 +0000
@@ -121,8 +121,10 @@
121Instead of issuing one request per bug watch, like was done before,121Instead of issuing one request per bug watch, like was done before,
122updateBugWatches() issues only one request to update all watches:122updateBugWatches() issues only one request to update all watches:
123123
124 >>> from lp.services.propertycache import IPropertyCache
125 >>> del IPropertyCache(example_ext_bug_tracker).csv_data
126
124 >>> example_ext_bug_tracker.trace_calls = True127 >>> example_ext_bug_tracker.trace_calls = True
125 >>> example_ext_bug_tracker.cleanCache()
126 >>> bug_watch_updater.updateBugWatches(128 >>> bug_watch_updater.updateBugWatches(
127 ... example_ext_bug_tracker, example_bug_tracker.watches)129 ... example_ext_bug_tracker, example_bug_tracker.watches)
128 INFO:...:Updating 6 watches for 6 bugs on http://bugs.some.where130 INFO:...:Updating 6 watches for 6 bugs on http://bugs.some.where
129131
=== modified file 'lib/lp/bugs/externalbugtracker/mantis.py'
--- lib/lp/bugs/externalbugtracker/mantis.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/externalbugtracker/mantis.py 2010-09-02 12:57:56 +0000
@@ -18,7 +18,6 @@
18 SoupStrainer,18 SoupStrainer,
19 )19 )
2020
21from canonical.cachedproperty import cachedproperty
22from canonical.launchpad.webapp.url import urlparse21from canonical.launchpad.webapp.url import urlparse
23from lp.bugs.externalbugtracker import (22from lp.bugs.externalbugtracker import (
24 BugNotFound,23 BugNotFound,
@@ -37,6 +36,7 @@
37 BugTaskStatus,36 BugTaskStatus,
38 )37 )
39from lp.bugs.interfaces.externalbugtracker import UNKNOWN_REMOTE_IMPORTANCE38from lp.bugs.interfaces.externalbugtracker import UNKNOWN_REMOTE_IMPORTANCE
39from lp.services.propertycache import cachedproperty
4040
4141
42class MantisLoginHandler(urllib2.HTTPRedirectHandler):42class MantisLoginHandler(urllib2.HTTPRedirectHandler):
4343
=== modified file 'lib/lp/bugs/externalbugtracker/rt.py'
--- lib/lp/bugs/externalbugtracker/rt.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/externalbugtracker/rt.py 2010-09-02 12:57:56 +0000
@@ -10,7 +10,6 @@
10import urllib10import urllib
11import urllib211import urllib2
1212
13from canonical.cachedproperty import cachedproperty
14from canonical.config import config13from canonical.config import config
15from canonical.launchpad.webapp.url import urlparse14from canonical.launchpad.webapp.url import urlparse
16from lp.bugs.externalbugtracker import (15from lp.bugs.externalbugtracker import (
@@ -24,6 +23,7 @@
24from lp.bugs.externalbugtracker.isolation import ensure_no_transaction23from lp.bugs.externalbugtracker.isolation import ensure_no_transaction
25from lp.bugs.interfaces.bugtask import BugTaskStatus24from lp.bugs.interfaces.bugtask import BugTaskStatus
26from lp.bugs.interfaces.externalbugtracker import UNKNOWN_REMOTE_IMPORTANCE25from lp.bugs.interfaces.externalbugtracker import UNKNOWN_REMOTE_IMPORTANCE
26from lp.services.propertycache import cachedproperty
2727
2828
29class RequestTracker(ExternalBugTracker):29class RequestTracker(ExternalBugTracker):
3030
=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py 2010-08-31 23:22:19 +0000
+++ lib/lp/bugs/model/bug.py 2010-09-02 12:57:56 +0000
@@ -70,11 +70,6 @@
70 providedBy,70 providedBy,
71 )71 )
7272
73from canonical.cachedproperty import (
74 cachedproperty,
75 cache_property,
76 clear_property,
77 )
78from canonical.config import config73from canonical.config import config
79from canonical.database.constants import UTC_NOW74from canonical.database.constants import UTC_NOW
80from canonical.database.datetimecol import UtcDateTimeCol75from canonical.database.datetimecol import UtcDateTimeCol
@@ -83,7 +78,9 @@
83 SQLBase,78 SQLBase,
84 sqlvalues,79 sqlvalues,
85 )80 )
86from canonical.launchpad.components.decoratedresultset import DecoratedResultSet81from canonical.launchpad.components.decoratedresultset import (
82 DecoratedResultSet,
83 )
87from canonical.launchpad.database.librarian import LibraryFileAlias84from canonical.launchpad.database.librarian import LibraryFileAlias
88from canonical.launchpad.database.message import (85from canonical.launchpad.database.message import (
89 Message,86 Message,
@@ -189,6 +186,10 @@
189from lp.registry.model.pillar import pillar_sort_key186from lp.registry.model.pillar import pillar_sort_key
190from lp.registry.model.teammembership import TeamParticipation187from lp.registry.model.teammembership import TeamParticipation
191from lp.services.fields import DuplicateBug188from lp.services.fields import DuplicateBug
189from lp.services.propertycache import (
190 cachedproperty,
191 IPropertyCache,
192 )
192193
193194
194_bug_tag_query_template = """195_bug_tag_query_template = """
@@ -636,7 +637,7 @@
636 # disabled see the change.637 # disabled see the change.
637 store.flush()638 store.flush()
638 self.updateHeat()639 self.updateHeat()
639 clear_property(self, '_cached_viewers')640 del IPropertyCache(self)._known_viewers
640 return641 return
641642
642 def unsubscribeFromDupes(self, person, unsubscribed_by):643 def unsubscribeFromDupes(self, person, unsubscribed_by):
@@ -1658,7 +1659,7 @@
1658 self, self.messages[comment_number])1659 self, self.messages[comment_number])
1659 bug_message.visible = visible1660 bug_message.visible = visible
16601661
1661 @cachedproperty('_cached_viewers')1662 @cachedproperty
1662 def _known_viewers(self):1663 def _known_viewers(self):
1663 """A dict of of known persons able to view this bug."""1664 """A dict of of known persons able to view this bug."""
1664 return set()1665 return set()
@@ -1775,7 +1776,7 @@
1775 @property1776 @property
1776 def attachments(self):1777 def attachments(self):
1777 """See `IBug`.1778 """See `IBug`.
1778 1779
1779 This property does eager loading of the index_messages so that the API1780 This property does eager loading of the index_messages so that the API
1780 which wants the message_link for the attachment can answer that without1781 which wants the message_link for the attachment can answer that without
1781 O(N^2) overhead. As such it is moderately expensive to call (it1782 O(N^2) overhead. As such it is moderately expensive to call (it
@@ -1791,7 +1792,7 @@
1791 # will be found without a query when dereferenced.1792 # will be found without a query when dereferenced.
1792 indexed_message = message_to_indexed.get(attachment._messageID)1793 indexed_message = message_to_indexed.get(attachment._messageID)
1793 if indexed_message is not None:1794 if indexed_message is not None:
1794 cache_property(attachment, '_message_cached', indexed_message)1795 IPropertyCache(attachment).message = indexed_message
1795 return attachment1796 return attachment
1796 rawresults = self._attachments_query()1797 rawresults = self._attachments_query()
1797 return DecoratedResultSet(rawresults, set_indexed_message)1798 return DecoratedResultSet(rawresults, set_indexed_message)
@@ -1799,9 +1800,9 @@
1799 @property1800 @property
1800 def attachments_unpopulated(self):1801 def attachments_unpopulated(self):
1801 """See `IBug`.1802 """See `IBug`.
1802 1803
1803 This version does not pre-lookup messages and LibraryFileAliases.1804 This version does not pre-lookup messages and LibraryFileAliases.
1804 1805
1805 The regular 'attachments' property does prepopulation because it is1806 The regular 'attachments' property does prepopulation because it is
1806 exposed in the API.1807 exposed in the API.
1807 """1808 """
18081809
=== modified file 'lib/lp/bugs/model/bugattachment.py'
--- lib/lp/bugs/model/bugattachment.py 2010-08-29 22:26:36 +0000
+++ lib/lp/bugs/model/bugattachment.py 2010-09-02 12:57:56 +0000
@@ -19,7 +19,6 @@
19from zope.event import notify19from zope.event import notify
20from zope.interface import implements20from zope.interface import implements
2121
22from canonical.cachedproperty import cachedproperty
23from canonical.database.enumcol import EnumCol22from canonical.database.enumcol import EnumCol
24from canonical.database.sqlbase import SQLBase23from canonical.database.sqlbase import SQLBase
25from lp.app.errors import NotFoundError24from lp.app.errors import NotFoundError
@@ -28,6 +27,7 @@
28 IBugAttachment,27 IBugAttachment,
29 IBugAttachmentSet,28 IBugAttachmentSet,
30 )29 )
30from lp.services.propertycache import cachedproperty
3131
3232
33class BugAttachment(SQLBase):33class BugAttachment(SQLBase):
@@ -50,10 +50,10 @@
50 _message = ForeignKey(50 _message = ForeignKey(
51 foreignKey='Message', dbName='message', notNull=True)51 foreignKey='Message', dbName='message', notNull=True)
5252
53 @cachedproperty('_message_cached')53 @cachedproperty
54 def message(self):54 def message(self):
55 """This is a cachedproperty to allow message to be an IIndexedMessage.55 """This is a cachedproperty to allow message to be an IIndexedMessage.
56 56
57 This is needed for the bug/attachments API call which needs to index57 This is needed for the bug/attachments API call which needs to index
58 an IIndexedMessage rather than a simple DB model IMessage. See58 an IIndexedMessage rather than a simple DB model IMessage. See
59 Bug.attachments where the injection occurs.59 Bug.attachments where the injection occurs.
6060
=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py 2010-08-30 19:30:45 +0000
+++ lib/lp/bugs/model/bugtask.py 2010-09-02 12:57:56 +0000
@@ -58,7 +58,6 @@
58 removeSecurityProxy,58 removeSecurityProxy,
59 )59 )
6060
61from canonical.cachedproperty import cache_property
62from canonical.config import config61from canonical.config import config
63from canonical.database.constants import UTC_NOW62from canonical.database.constants import UTC_NOW
64from canonical.database.datetimecol import UtcDateTimeCol63from canonical.database.datetimecol import UtcDateTimeCol
@@ -153,6 +152,7 @@
153from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet152from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
154from lp.registry.model.pillar import pillar_sort_key153from lp.registry.model.pillar import pillar_sort_key
155from lp.registry.model.sourcepackagename import SourcePackageName154from lp.registry.model.sourcepackagename import SourcePackageName
155from lp.services.propertycache import IPropertyCache
156from lp.soyuz.enums import PackagePublishingStatus156from lp.soyuz.enums import PackagePublishingStatus
157from lp.soyuz.model.publishing import SourcePackagePublishingHistory157from lp.soyuz.model.publishing import SourcePackagePublishingHistory
158from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease158from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
@@ -1338,7 +1338,7 @@
1338 """1338 """
1339 userid = user.id1339 userid = user.id
1340 def cache_user_can_view_bug(bugtask):1340 def cache_user_can_view_bug(bugtask):
1341 cache_property(bugtask.bug, '_cached_viewers', set([userid]))1341 IPropertyCache(bugtask.bug)._known_viewers = set([userid])
1342 return bugtask1342 return bugtask
1343 return cache_user_can_view_bug1343 return cache_user_can_view_bug
13441344
13451345
=== modified file 'lib/lp/bugs/tests/externalbugtracker.py'
--- lib/lp/bugs/tests/externalbugtracker.py 2010-08-21 07:31:45 +0000
+++ lib/lp/bugs/tests/externalbugtracker.py 2010-09-02 12:57:56 +0000
@@ -1102,14 +1102,6 @@
1102 print "CALLED _postPage(%r, ...)" % (page)1102 print "CALLED _postPage(%r, ...)" % (page)
1103 return ''1103 return ''
11041104
1105 def cleanCache(self):
1106 """Clean the csv_data cache."""
1107 # Remove the self._csv_data_cached_value if it exists.
1108 try:
1109 del self._csv_data_cached_value
1110 except AttributeError:
1111 pass
1112
11131105
1114class TestTrac(Trac):1106class TestTrac(Trac):
1115 """Trac ExternalBugTracker for testing purposes.1107 """Trac ExternalBugTracker for testing purposes.
11161108
=== modified file 'lib/lp/buildmaster/model/builder.py'
--- lib/lp/buildmaster/model/builder.py 2010-08-23 10:38:44 +0000
+++ lib/lp/buildmaster/model/builder.py 2010-09-02 12:57:56 +0000
@@ -38,7 +38,6 @@
38from zope.interface import implements38from zope.interface import implements
3939
40from canonical.buildd.slave import BuilderStatus40from canonical.buildd.slave import BuilderStatus
41from canonical.cachedproperty import cachedproperty
42from canonical.config import config41from canonical.config import config
43from canonical.database.sqlbase import (42from canonical.database.sqlbase import (
44 SQLBase,43 SQLBase,
@@ -80,6 +79,7 @@
80from lp.services.job.interfaces.job import JobStatus79from lp.services.job.interfaces.job import JobStatus
81from lp.services.job.model.job import Job80from lp.services.job.model.job import Job
82from lp.services.osutils import until_no_eintr81from lp.services.osutils import until_no_eintr
82from lp.services.propertycache import cachedproperty
83# XXX Michael Nelson 2010-01-13 bug=49133083# XXX Michael Nelson 2010-01-13 bug=491330
84# These dependencies on soyuz will be removed when getBuildRecords()84# These dependencies on soyuz will be removed when getBuildRecords()
85# is moved.85# is moved.
8686
=== modified file 'lib/lp/code/browser/bazaar.py'
--- lib/lp/code/browser/bazaar.py 2010-08-31 01:11:34 +0000
+++ lib/lp/code/browser/bazaar.py 2010-09-02 12:57:56 +0000
@@ -15,7 +15,6 @@
15import bzrlib15import bzrlib
16from zope.component import getUtility16from zope.component import getUtility
1717
18from canonical.cachedproperty import cachedproperty
19from canonical.config import config18from canonical.config import config
20from canonical.launchpad.webapp import (19from canonical.launchpad.webapp import (
21 canonical_url,20 canonical_url,
@@ -32,6 +31,7 @@
32from lp.code.interfaces.branchcollection import IAllBranches31from lp.code.interfaces.branchcollection import IAllBranches
33from lp.code.interfaces.codeimport import ICodeImportSet32from lp.code.interfaces.codeimport import ICodeImportSet
34from lp.registry.interfaces.product import IProductSet33from lp.registry.interfaces.product import IProductSet
34from lp.services.propertycache import cachedproperty
3535
3636
37class BazaarApplicationView(LaunchpadView):37class BazaarApplicationView(LaunchpadView):
3838
=== modified file 'lib/lp/code/browser/branch.py'
--- lib/lp/code/browser/branch.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/browser/branch.py 2010-09-02 12:57:56 +0000
@@ -72,7 +72,6 @@
72 )72 )
73from zope.traversing.interfaces import IPathAdapter73from zope.traversing.interfaces import IPathAdapter
7474
75from canonical.cachedproperty import cachedproperty
76from canonical.config import config75from canonical.config import config
77from canonical.database.constants import UTC_NOW76from canonical.database.constants import UTC_NOW
78from canonical.launchpad import _77from canonical.launchpad import _
@@ -145,6 +144,7 @@
145 )144 )
146from lp.registry.interfaces.productseries import IProductSeries145from lp.registry.interfaces.productseries import IProductSeries
147from lp.registry.vocabularies import UserTeamsParticipationPlusSelfVocabulary146from lp.registry.vocabularies import UserTeamsParticipationPlusSelfVocabulary
147from lp.services.propertycache import cachedproperty
148148
149149
150def quote(text):150def quote(text):
151151
=== modified file 'lib/lp/code/browser/branchlisting.py'
--- lib/lp/code/browser/branchlisting.py 2010-08-23 04:48:17 +0000
+++ lib/lp/code/browser/branchlisting.py 2010-09-02 12:57:56 +0000
@@ -52,7 +52,6 @@
52 )52 )
53from zope.schema import Choice53from zope.schema import Choice
5454
55from canonical.cachedproperty import cachedproperty
56from canonical.config import config55from canonical.config import config
57from canonical.launchpad import _56from canonical.launchpad import _
58from canonical.launchpad.browser.feeds import (57from canonical.launchpad.browser.feeds import (
@@ -131,6 +130,7 @@
131from lp.registry.interfaces.sourcepackage import ISourcePackageFactory130from lp.registry.interfaces.sourcepackage import ISourcePackageFactory
132from lp.registry.model.sourcepackage import SourcePackage131from lp.registry.model.sourcepackage import SourcePackage
133from lp.services.browser_helpers import get_plural_text132from lp.services.browser_helpers import get_plural_text
133from lp.services.propertycache import cachedproperty
134134
135135
136class CodeVHostBreadcrumb(Breadcrumb):136class CodeVHostBreadcrumb(Breadcrumb):
137137
=== modified file 'lib/lp/code/browser/branchmergeproposal.py'
--- lib/lp/code/browser/branchmergeproposal.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/browser/branchmergeproposal.py 2010-09-02 12:57:56 +0000
@@ -68,7 +68,6 @@
68 SimpleVocabulary,68 SimpleVocabulary,
69 )69 )
7070
71from canonical.cachedproperty import cachedproperty
72from canonical.config import config71from canonical.config import config
73from canonical.launchpad import _72from canonical.launchpad import _
74from canonical.launchpad.interfaces.message import IMessageSet73from canonical.launchpad.interfaces.message import IMessageSet
@@ -122,6 +121,7 @@
122 Summary,121 Summary,
123 Whiteboard,122 Whiteboard,
124 )123 )
124from lp.services.propertycache import cachedproperty
125125
126126
127def latest_proposals_for_each_branch(proposals):127def latest_proposals_for_each_branch(proposals):
128128
=== modified file 'lib/lp/code/browser/branchmergeproposallisting.py'
--- lib/lp/code/browser/branchmergeproposallisting.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/browser/branchmergeproposallisting.py 2010-09-02 12:57:56 +0000
@@ -29,7 +29,6 @@
29 )29 )
30from zope.schema import Choice30from zope.schema import Choice
3131
32from canonical.cachedproperty import cachedproperty
33from canonical.config import config32from canonical.config import config
34from canonical.launchpad import _33from canonical.launchpad import _
35from canonical.launchpad.webapp import (34from canonical.launchpad.webapp import (
@@ -53,6 +52,7 @@
53 IBranchMergeProposalListingBatchNavigator,52 IBranchMergeProposalListingBatchNavigator,
54 )53 )
55from lp.code.interfaces.hasbranches import IHasMergeProposals54from lp.code.interfaces.hasbranches import IHasMergeProposals
55from lp.services.propertycache import cachedproperty
5656
5757
58class BranchMergeProposalListingItem:58class BranchMergeProposalListingItem:
5959
=== modified file 'lib/lp/code/browser/branchvisibilitypolicy.py'
--- lib/lp/code/browser/branchvisibilitypolicy.py 2010-08-23 03:30:54 +0000
+++ lib/lp/code/browser/branchvisibilitypolicy.py 2010-09-02 12:57:56 +0000
@@ -22,7 +22,6 @@
22 SimpleVocabulary,22 SimpleVocabulary,
23 )23 )
2424
25from canonical.cachedproperty import cachedproperty
26from canonical.launchpad import _25from canonical.launchpad import _
27from canonical.launchpad.webapp import (26from canonical.launchpad.webapp import (
28 action,27 action,
@@ -42,6 +41,7 @@
42from lp.code.interfaces.branchvisibilitypolicy import (41from lp.code.interfaces.branchvisibilitypolicy import (
43 IBranchVisibilityTeamPolicy,42 IBranchVisibilityTeamPolicy,
44 )43 )
44from lp.services.propertycache import cachedproperty
4545
4646
47class BaseBranchVisibilityTeamPolicyView(LaunchpadFormView):47class BaseBranchVisibilityTeamPolicyView(LaunchpadFormView):
4848
=== modified file 'lib/lp/code/browser/codeimport.py'
--- lib/lp/code/browser/codeimport.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/browser/codeimport.py 2010-09-02 12:57:56 +0000
@@ -29,7 +29,6 @@
29from zope.interface import Interface29from zope.interface import Interface
30from zope.schema import Choice30from zope.schema import Choice
3131
32from canonical.cachedproperty import cachedproperty
33from canonical.launchpad import _32from canonical.launchpad import _
34from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities33from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
35from canonical.launchpad.webapp import (34from canonical.launchpad.webapp import (
@@ -75,6 +74,7 @@
75from lp.code.interfaces.codeimportmachine import ICodeImportMachineSet74from lp.code.interfaces.codeimportmachine import ICodeImportMachineSet
76from lp.registry.interfaces.product import IProduct75from lp.registry.interfaces.product import IProduct
77from lp.services.fields import URIField76from lp.services.fields import URIField
77from lp.services.propertycache import cachedproperty
7878
7979
80class CodeImportSetNavigation(Navigation):80class CodeImportSetNavigation(Navigation):
8181
=== modified file 'lib/lp/code/browser/codeimportmachine.py'
--- lib/lp/code/browser/codeimportmachine.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/browser/codeimportmachine.py 2010-09-02 12:57:56 +0000
@@ -19,7 +19,6 @@
19from zope.interface import Interface19from zope.interface import Interface
20from zope.schema import TextLine20from zope.schema import TextLine
2121
22from canonical.cachedproperty import cachedproperty
23from canonical.launchpad import _22from canonical.launchpad import _
24from canonical.launchpad.webapp import (23from canonical.launchpad.webapp import (
25 action,24 action,
@@ -35,6 +34,7 @@
35 )34 )
36from lp.code.interfaces.codeimportevent import ICodeImportEvent35from lp.code.interfaces.codeimportevent import ICodeImportEvent
37from lp.code.interfaces.codeimportmachine import ICodeImportMachineSet36from lp.code.interfaces.codeimportmachine import ICodeImportMachineSet
37from lp.services.propertycache import cachedproperty
3838
3939
40class CodeImportMachineBreadcrumb(Breadcrumb):40class CodeImportMachineBreadcrumb(Breadcrumb):
4141
=== modified file 'lib/lp/code/browser/codereviewcomment.py'
--- lib/lp/code/browser/codereviewcomment.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/browser/codereviewcomment.py 2010-09-02 12:57:56 +0000
@@ -24,7 +24,6 @@
24 )24 )
25from zope.schema import Text25from zope.schema import Text
2626
27from canonical.cachedproperty import cachedproperty
28from canonical.config import config27from canonical.config import config
29from canonical.launchpad import _28from canonical.launchpad import _
30from canonical.launchpad.interfaces import ILibraryFileAlias29from canonical.launchpad.interfaces import ILibraryFileAlias
@@ -41,6 +40,7 @@
41from lp.code.interfaces.codereviewcomment import ICodeReviewComment40from lp.code.interfaces.codereviewcomment import ICodeReviewComment
42from lp.code.interfaces.codereviewvote import ICodeReviewVoteReference41from lp.code.interfaces.codereviewvote import ICodeReviewVoteReference
43from lp.services.comments.interfaces.conversation import IComment42from lp.services.comments.interfaces.conversation import IComment
43from lp.services.propertycache import cachedproperty
4444
4545
46class CodeReviewDisplayComment:46class CodeReviewDisplayComment:
4747
=== modified file 'lib/lp/code/browser/decorations.py'
--- lib/lp/code/browser/decorations.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/browser/decorations.py 2010-09-02 12:57:56 +0000
@@ -14,13 +14,13 @@
1414
15from lazr.delegates import delegates15from lazr.delegates import delegates
1616
17from canonical.cachedproperty import cachedproperty
18from canonical.launchpad.webapp.authorization import check_permission17from canonical.launchpad.webapp.authorization import check_permission
19from lp.bugs.interfaces.bug import IBug18from lp.bugs.interfaces.bug import IBug
20from lp.code.interfaces.branch import (19from lp.code.interfaces.branch import (
21 BzrIdentityMixin,20 BzrIdentityMixin,
22 IBranch,21 IBranch,
23 )22 )
23from lp.services.propertycache import cachedproperty
2424
2525
26class DecoratedBug:26class DecoratedBug:
2727
=== modified file 'lib/lp/code/browser/summary.py'
--- lib/lp/code/browser/summary.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/browser/summary.py 2010-09-02 12:57:56 +0000
@@ -9,13 +9,13 @@
9 ]9 ]
1010
1111
12from canonical.cachedproperty import cachedproperty
13from canonical.launchpad import _12from canonical.launchpad import _
14from canonical.launchpad.webapp.publisher import LaunchpadView13from canonical.launchpad.webapp.publisher import LaunchpadView
15from lp.code.interfaces.branch import DEFAULT_BRANCH_STATUS_IN_LISTING14from lp.code.interfaces.branch import DEFAULT_BRANCH_STATUS_IN_LISTING
16from lp.code.interfaces.branchcollection import IBranchCollection15from lp.code.interfaces.branchcollection import IBranchCollection
17from lp.code.interfaces.revisioncache import IRevisionCache16from lp.code.interfaces.revisioncache import IRevisionCache
18from lp.services.browser_helpers import get_plural_text17from lp.services.browser_helpers import get_plural_text
18from lp.services.propertycache import cachedproperty
1919
2020
21class BranchCountSummaryView(LaunchpadView):21class BranchCountSummaryView(LaunchpadView):
2222
=== modified file 'lib/lp/code/feed/branch.py'
--- lib/lp/code/feed/branch.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/feed/branch.py 2010-09-02 12:57:56 +0000
@@ -24,7 +24,6 @@
24from zope.interface import implements24from zope.interface import implements
25from zope.security.interfaces import Unauthorized25from zope.security.interfaces import Unauthorized
2626
27from canonical.cachedproperty import cachedproperty
28from canonical.config import config27from canonical.config import config
29from canonical.launchpad.webapp import (28from canonical.launchpad.webapp import (
30 canonical_url,29 canonical_url,
@@ -49,6 +48,7 @@
49from lp.registry.interfaces.person import IPerson48from lp.registry.interfaces.person import IPerson
50from lp.registry.interfaces.product import IProduct49from lp.registry.interfaces.product import IProduct
51from lp.registry.interfaces.projectgroup import IProjectGroup50from lp.registry.interfaces.projectgroup import IProjectGroup
51from lp.services.propertycache import cachedproperty
5252
5353
54def revision_feed_id(revision):54def revision_feed_id(revision):
5555
=== modified file 'lib/lp/code/model/branchvisibilitypolicy.py'
--- lib/lp/code/model/branchvisibilitypolicy.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/model/branchvisibilitypolicy.py 2010-09-02 12:57:56 +0000
@@ -15,7 +15,6 @@
15from sqlobject import ForeignKey15from sqlobject import ForeignKey
16from zope.interface import implements16from zope.interface import implements
1717
18from canonical.cachedproperty import cachedproperty
19from canonical.database.enumcol import EnumCol18from canonical.database.enumcol import EnumCol
20from canonical.database.sqlbase import SQLBase19from canonical.database.sqlbase import SQLBase
21from canonical.launchpad.helpers import shortlist20from canonical.launchpad.helpers import shortlist
@@ -27,6 +26,7 @@
27from lp.registry.interfaces.person import validate_person26from lp.registry.interfaces.person import validate_person
28from lp.registry.interfaces.product import IProduct27from lp.registry.interfaces.product import IProduct
29from lp.registry.interfaces.projectgroup import IProjectGroup28from lp.registry.interfaces.projectgroup import IProjectGroup
29from lp.services.propertycache import cachedproperty
3030
3131
32class BranchVisibilityTeamPolicy(SQLBase):32class BranchVisibilityTeamPolicy(SQLBase):
3333
=== modified file 'lib/lp/codehosting/codeimport/worker.py'
--- lib/lp/codehosting/codeimport/worker.py 2010-08-20 20:31:18 +0000
+++ lib/lp/codehosting/codeimport/worker.py 2010-09-02 12:57:56 +0000
@@ -45,7 +45,6 @@
45import CVS45import CVS
46import SCM46import SCM
4747
48from canonical.cachedproperty import cachedproperty
49from canonical.config import config48from canonical.config import config
50from lp.code.enums import RevisionControlSystems49from lp.code.enums import RevisionControlSystems
51from lp.codehosting.codeimport.foreigntree import (50from lp.codehosting.codeimport.foreigntree import (
@@ -57,6 +56,7 @@
57 extract_tarball,56 extract_tarball,
58 )57 )
59from lp.codehosting.codeimport.uifactory import LoggingUIFactory58from lp.codehosting.codeimport.uifactory import LoggingUIFactory
59from lp.services.propertycache import cachedproperty
6060
6161
62class CodeImportWorkerExitCode:62class CodeImportWorkerExitCode:
6363
=== modified file 'lib/lp/codehosting/puller/scheduler.py'
--- lib/lp/codehosting/puller/scheduler.py 2010-08-20 20:31:18 +0000
+++ lib/lp/codehosting/puller/scheduler.py 2010-09-02 12:57:56 +0000
@@ -34,12 +34,12 @@
34 log,34 log,
35 )35 )
3636
37from canonical.cachedproperty import cachedproperty
38from canonical.config import config37from canonical.config import config
39from canonical.launchpad.webapp import errorlog38from canonical.launchpad.webapp import errorlog
40from lp.code.interfaces.codehosting import LAUNCHPAD_SERVICES39from lp.code.interfaces.codehosting import LAUNCHPAD_SERVICES
41from lp.codehosting.puller import get_lock_id_for_branch_id40from lp.codehosting.puller import get_lock_id_for_branch_id
42from lp.codehosting.puller.worker import get_canonical_url_for_branch_name41from lp.codehosting.puller.worker import get_canonical_url_for_branch_name
42from lp.services.propertycache import cachedproperty
43from lp.services.twistedsupport.processmonitor import (43from lp.services.twistedsupport.processmonitor import (
44 ProcessMonitorProtocolWithTimeout,44 ProcessMonitorProtocolWithTimeout,
45 )45 )
4646
=== modified file 'lib/lp/hardwaredb/scripts/hwdbsubmissions.py'
--- lib/lp/hardwaredb/scripts/hwdbsubmissions.py 2010-08-20 20:31:18 +0000
+++ lib/lp/hardwaredb/scripts/hwdbsubmissions.py 2010-09-02 12:57:56 +0000
@@ -35,7 +35,7 @@
3535
36from canonical.lazr.xml import RelaxNGValidator36from canonical.lazr.xml import RelaxNGValidator
3737
38from canonical.cachedproperty import cachedproperty38from lp.services.propertycache import cachedproperty
39from canonical.config import config39from canonical.config import config
40from canonical.librarian.interfaces import LibrarianServerError40from canonical.librarian.interfaces import LibrarianServerError
41from lp.hardwaredb.interfaces.hwdb import (41from lp.hardwaredb.interfaces.hwdb import (
4242
=== modified file 'lib/lp/registry/browser/__init__.py'
--- lib/lp/registry/browser/__init__.py 2010-08-27 22:33:36 +0000
+++ lib/lp/registry/browser/__init__.py 2010-09-02 12:57:56 +0000
@@ -20,7 +20,6 @@
20from storm.store import Store20from storm.store import Store
21from zope.component import getUtility21from zope.component import getUtility
2222
23from canonical.cachedproperty import cachedproperty
24from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities23from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
25from canonical.launchpad.webapp.launchpadform import (24from canonical.launchpad.webapp.launchpadform import (
26 action,25 action,
@@ -33,6 +32,7 @@
33 )32 )
34from lp.registry.interfaces.productseries import IProductSeries33from lp.registry.interfaces.productseries import IProductSeries
35from lp.registry.interfaces.series import SeriesStatus34from lp.registry.interfaces.series import SeriesStatus
35from lp.services.propertycache import cachedproperty
3636
3737
38class StatusCount:38class StatusCount:
3939
=== modified file 'lib/lp/registry/browser/announcement.py'
--- lib/lp/registry/browser/announcement.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/announcement.py 2010-09-02 12:57:56 +0000
@@ -26,7 +26,6 @@
26 TextLine,26 TextLine,
27 )27 )
2828
29from canonical.cachedproperty import cachedproperty
30from canonical.config import config29from canonical.config import config
31from canonical.launchpad import _30from canonical.launchpad import _
32from canonical.launchpad.browser.feeds import (31from canonical.launchpad.browser.feeds import (
@@ -58,6 +57,7 @@
58 Summary,57 Summary,
59 Title,58 Title,
60 )59 )
60from lp.services.propertycache import cachedproperty
6161
6262
63class AnnouncementMenuMixin:63class AnnouncementMenuMixin:
6464
=== modified file 'lib/lp/registry/browser/distribution.py'
--- lib/lp/registry/browser/distribution.py 2010-08-27 19:19:27 +0000
+++ lib/lp/registry/browser/distribution.py 2010-09-02 12:57:56 +0000
@@ -44,7 +44,6 @@
44from zope.lifecycleevent import ObjectCreatedEvent44from zope.lifecycleevent import ObjectCreatedEvent
45from zope.security.interfaces import Unauthorized45from zope.security.interfaces import Unauthorized
4646
47from canonical.cachedproperty import cachedproperty
48from canonical.launchpad.browser.feeds import FeedsMixin47from canonical.launchpad.browser.feeds import FeedsMixin
49from canonical.launchpad.components.decoratedresultset import (48from canonical.launchpad.components.decoratedresultset import (
50 DecoratedResultSet,49 DecoratedResultSet,
@@ -109,11 +108,10 @@
109 )108 )
110from lp.registry.interfaces.product import IProduct109from lp.registry.interfaces.product import IProduct
111from lp.registry.interfaces.series import SeriesStatus110from lp.registry.interfaces.series import SeriesStatus
111from lp.services.propertycache import cachedproperty
112from lp.soyuz.browser.packagesearch import PackageSearchViewBase112from lp.soyuz.browser.packagesearch import PackageSearchViewBase
113from lp.soyuz.enums import ArchivePurpose113from lp.soyuz.enums import ArchivePurpose
114from lp.soyuz.interfaces.archive import (114from lp.soyuz.interfaces.archive import IArchiveSet
115 IArchiveSet,
116 )
117115
118116
119class UsesLaunchpadMixin:117class UsesLaunchpadMixin:
120118
=== modified file 'lib/lp/registry/browser/distributionmirror.py'
--- lib/lp/registry/browser/distributionmirror.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/distributionmirror.py 2010-09-02 12:57:56 +0000
@@ -22,7 +22,6 @@
22from zope.interface import implements22from zope.interface import implements
23from zope.lifecycleevent import ObjectCreatedEvent23from zope.lifecycleevent import ObjectCreatedEvent
2424
25from canonical.cachedproperty import cachedproperty
26from canonical.launchpad import _25from canonical.launchpad import _
27from canonical.launchpad.webapp import (26from canonical.launchpad.webapp import (
28 action,27 action,
@@ -40,6 +39,7 @@
40from lp.registry.browser.objectreassignment import ObjectReassignmentView39from lp.registry.browser.objectreassignment import ObjectReassignmentView
41from lp.registry.interfaces.distribution import IDistributionMirrorMenuMarker40from lp.registry.interfaces.distribution import IDistributionMirrorMenuMarker
42from lp.registry.interfaces.distributionmirror import IDistributionMirror41from lp.registry.interfaces.distributionmirror import IDistributionMirror
42from lp.services.propertycache import cachedproperty
43from lp.soyuz.browser.sourceslist import (43from lp.soyuz.browser.sourceslist import (
44 SourcesListEntries,44 SourcesListEntries,
45 SourcesListEntriesView,45 SourcesListEntriesView,
4646
=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
--- lib/lp/registry/browser/distributionsourcepackage.py 2010-08-26 13:42:56 +0000
+++ lib/lp/registry/browser/distributionsourcepackage.py 2010-09-02 12:57:56 +0000
@@ -26,7 +26,7 @@
26 Interface,26 Interface,
27 )27 )
2828
29from canonical.cachedproperty import cachedproperty29from canonical.launchpad.helpers import shortlist
30from canonical.launchpad.webapp import (30from canonical.launchpad.webapp import (
31 action,31 action,
32 canonical_url,32 canonical_url,
@@ -36,7 +36,6 @@
36 redirection,36 redirection,
37 StandardLaunchpadFacets,37 StandardLaunchpadFacets,
38 )38 )
39from canonical.launchpad.helpers import shortlist
40from canonical.launchpad.webapp.breadcrumb import Breadcrumb39from canonical.launchpad.webapp.breadcrumb import Breadcrumb
41from canonical.launchpad.webapp.menu import (40from canonical.launchpad.webapp.menu import (
42 ApplicationMenu,41 ApplicationMenu,
@@ -62,6 +61,7 @@
62 IDistributionSourcePackage,61 IDistributionSourcePackage,
63 )62 )
64from lp.registry.interfaces.pocket import pocketsuffix63from lp.registry.interfaces.pocket import pocketsuffix
64from lp.services.propertycache import cachedproperty
65from lp.soyuz.browser.sourcepackagerelease import (65from lp.soyuz.browser.sourcepackagerelease import (
66 extract_bug_numbers,66 extract_bug_numbers,
67 extract_email_addresses,67 extract_email_addresses,
@@ -73,7 +73,8 @@
73 )73 )
74from lp.soyuz.interfaces.packagediff import IPackageDiffSet74from lp.soyuz.interfaces.packagediff import IPackageDiffSet
75from lp.translations.browser.customlanguagecode import (75from lp.translations.browser.customlanguagecode import (
76 HasCustomLanguageCodesTraversalMixin)76 HasCustomLanguageCodesTraversalMixin,
77 )
7778
7879
79class DistributionSourcePackageFormatterAPI(CustomizableFormatter):80class DistributionSourcePackageFormatterAPI(CustomizableFormatter):
8081
=== modified file 'lib/lp/registry/browser/distroseries.py'
--- lib/lp/registry/browser/distroseries.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/distroseries.py 2010-09-02 12:57:56 +0000
@@ -27,7 +27,6 @@
27 SimpleVocabulary,27 SimpleVocabulary,
28 )28 )
2929
30from canonical.cachedproperty import cachedproperty
31from canonical.database.constants import UTC_NOW30from canonical.database.constants import UTC_NOW
32from canonical.launchpad import (31from canonical.launchpad import (
33 _,32 _,
@@ -72,6 +71,7 @@
72 )71 )
73from lp.registry.interfaces.distroseries import IDistroSeries72from lp.registry.interfaces.distroseries import IDistroSeries
74from lp.registry.interfaces.series import SeriesStatus73from lp.registry.interfaces.series import SeriesStatus
74from lp.services.propertycache import cachedproperty
75from lp.services.worlddata.interfaces.country import ICountry75from lp.services.worlddata.interfaces.country import ICountry
76from lp.services.worlddata.interfaces.language import ILanguageSet76from lp.services.worlddata.interfaces.language import ILanguageSet
77from lp.soyuz.browser.packagesearch import PackageSearchViewBase77from lp.soyuz.browser.packagesearch import PackageSearchViewBase
7878
=== modified file 'lib/lp/registry/browser/karma.py'
--- lib/lp/registry/browser/karma.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/karma.py 2010-09-02 12:57:56 +0000
@@ -13,7 +13,6 @@
1313
14from zope.component import getUtility14from zope.component import getUtility
1515
16from canonical.cachedproperty import cachedproperty
17from canonical.launchpad import _16from canonical.launchpad import _
18from canonical.launchpad.webapp import (17from canonical.launchpad.webapp import (
19 action,18 action,
@@ -29,6 +28,7 @@
29 )28 )
30from lp.registry.interfaces.product import IProduct29from lp.registry.interfaces.product import IProduct
31from lp.registry.interfaces.projectgroup import IProjectGroup30from lp.registry.interfaces.projectgroup import IProjectGroup
31from lp.services.propertycache import cachedproperty
3232
3333
34TOP_CONTRIBUTORS_LIMIT = 2034TOP_CONTRIBUTORS_LIMIT = 20
3535
=== modified file 'lib/lp/registry/browser/mailinglists.py'
--- lib/lp/registry/browser/mailinglists.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/mailinglists.py 2010-09-02 12:57:56 +0000
@@ -20,7 +20,6 @@
20from zope.interface import Interface20from zope.interface import Interface
21from zope.security.proxy import removeSecurityProxy21from zope.security.proxy import removeSecurityProxy
2222
23from canonical.cachedproperty import cachedproperty
24from canonical.launchpad import _23from canonical.launchpad import _
25from canonical.launchpad.webapp import (24from canonical.launchpad.webapp import (
26 action,25 action,
@@ -37,6 +36,7 @@
37 MailingListStatus,36 MailingListStatus,
38 )37 )
39from lp.registry.interfaces.person import ITeam38from lp.registry.interfaces.person import ITeam
39from lp.services.propertycache import cachedproperty
4040
4141
42class ReviewForm(Interface):42class ReviewForm(Interface):
4343
=== modified file 'lib/lp/registry/browser/milestone.py'
--- lib/lp/registry/browser/milestone.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/milestone.py 2010-09-02 12:57:56 +0000
@@ -29,7 +29,6 @@
29 )29 )
30from zope.schema import Choice30from zope.schema import Choice
3131
32from canonical.cachedproperty import cachedproperty
33from canonical.launchpad import _32from canonical.launchpad import _
34from canonical.launchpad.webapp import (33from canonical.launchpad.webapp import (
35 action,34 action,
@@ -75,6 +74,7 @@
75 IProjectGroupMilestone,74 IProjectGroupMilestone,
76 )75 )
77from lp.registry.interfaces.product import IProduct76from lp.registry.interfaces.product import IProduct
77from lp.services.propertycache import cachedproperty
7878
7979
80class MilestoneSetNavigation(GetitemNavigation):80class MilestoneSetNavigation(GetitemNavigation):
8181
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py 2010-08-31 14:00:54 +0000
+++ lib/lp/registry/browser/person.py 2010-09-02 12:57:56 +0000
@@ -141,7 +141,6 @@
141from zope.security.interfaces import Unauthorized141from zope.security.interfaces import Unauthorized
142from zope.security.proxy import removeSecurityProxy142from zope.security.proxy import removeSecurityProxy
143143
144from canonical.cachedproperty import cachedproperty
145from canonical.config import config144from canonical.config import config
146from canonical.database.sqlbase import flush_database_updates145from canonical.database.sqlbase import flush_database_updates
147from canonical.launchpad import (146from canonical.launchpad import (
@@ -309,6 +308,10 @@
309 )308 )
310from lp.services.openid.interfaces.openid import IOpenIDPersistentIdentity309from lp.services.openid.interfaces.openid import IOpenIDPersistentIdentity
311from lp.services.openid.interfaces.openidrpsummary import IOpenIDRPSummarySet310from lp.services.openid.interfaces.openidrpsummary import IOpenIDRPSummarySet
311from lp.services.propertycache import (
312 cachedproperty,
313 IPropertyCache,
314 )
312from lp.services.salesforce.interfaces import (315from lp.services.salesforce.interfaces import (
313 ISalesforceVoucherProxy,316 ISalesforceVoucherProxy,
314 SalesforceVoucherProxyException,317 SalesforceVoucherProxyException,
@@ -5743,10 +5746,7 @@
5743 def _reset_state(self):5746 def _reset_state(self):
5744 """Reset the cache because the recipients changed."""5747 """Reset the cache because the recipients changed."""
5745 self._count_recipients = None5748 self._count_recipients = None
5746 if safe_hasattr(self, '_all_recipients_cached'):5749 del IPropertyCache(self)._all_recipients
5747 # The clear the cache of _all_recipients. The caching will fail
5748 # if this method creates the attribute before _all_recipients.
5749 del self._all_recipients_cached
57505750
5751 def _getPrimaryReason(self, person_or_team):5751 def _getPrimaryReason(self, person_or_team):
5752 """Return the primary reason enumeration.5752 """Return the primary reason enumeration.
@@ -5854,7 +5854,7 @@
5854 'You are contacting %s of the %s (%s) team directly.'5854 'You are contacting %s of the %s (%s) team directly.'
5855 % (text, person_or_team.displayname, person_or_team.name))5855 % (text, person_or_team.displayname, person_or_team.name))
58565856
5857 @cachedproperty('_all_recipients_cached')5857 @cachedproperty
5858 def _all_recipients(self):5858 def _all_recipients(self):
5859 """Set the cache of all recipients."""5859 """Set the cache of all recipients."""
5860 all_recipients = {}5860 all_recipients = {}
58615861
=== modified file 'lib/lp/registry/browser/pillar.py'
--- lib/lp/registry/browser/pillar.py 2010-08-31 14:45:20 +0000
+++ lib/lp/registry/browser/pillar.py 2010-09-02 12:57:56 +0000
@@ -19,7 +19,6 @@
19 Interface,19 Interface,
20 )20 )
2121
22from canonical.cachedproperty import cachedproperty
23from canonical.launchpad.webapp.menu import (22from canonical.launchpad.webapp.menu import (
24 ApplicationMenu,23 ApplicationMenu,
25 enabled_with_permission,24 enabled_with_permission,
@@ -42,6 +41,7 @@
42from lp.registry.interfaces.distroseries import IDistroSeries41from lp.registry.interfaces.distroseries import IDistroSeries
43from lp.registry.interfaces.pillar import IPillar42from lp.registry.interfaces.pillar import IPillar
44from lp.registry.interfaces.projectgroup import IProjectGroup43from lp.registry.interfaces.projectgroup import IProjectGroup
44from lp.services.propertycache import cachedproperty
4545
4646
47class IInvolved(Interface):47class IInvolved(Interface):
4848
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py 2010-08-25 23:43:13 +0000
+++ lib/lp/registry/browser/product.py 2010-09-02 12:57:56 +0000
@@ -50,6 +50,8 @@
50 )50 )
51from operator import attrgetter51from operator import attrgetter
5252
53from lazr.delegates import delegates
54from lazr.restful.interface import copy_field
53import pytz55import pytz
54from z3c.ptcompat import ViewPageTemplateFile56from z3c.ptcompat import ViewPageTemplateFile
55from zope.app.form import CustomWidgetFactory57from zope.app.form import CustomWidgetFactory
@@ -76,10 +78,7 @@
76 )78 )
77from zope.security.proxy import removeSecurityProxy79from zope.security.proxy import removeSecurityProxy
7880
79from canonical.cachedproperty import cachedproperty
80from canonical.config import config81from canonical.config import config
81from lazr.delegates import delegates
82from lazr.restful.interface import copy_field
83from canonical.launchpad import (82from canonical.launchpad import (
84 _,83 _,
85 helpers,84 helpers,
@@ -191,6 +190,7 @@
191 PillarAliases,190 PillarAliases,
192 PublicPersonChoice,191 PublicPersonChoice,
193 )192 )
193from lp.services.propertycache import cachedproperty
194from lp.services.worlddata.interfaces.country import ICountry194from lp.services.worlddata.interfaces.country import ICountry
195from lp.translations.browser.customlanguagecode import (195from lp.translations.browser.customlanguagecode import (
196 HasCustomLanguageCodesTraversalMixin,196 HasCustomLanguageCodesTraversalMixin,
197197
=== modified file 'lib/lp/registry/browser/productseries.py'
--- lib/lp/registry/browser/productseries.py 2010-08-27 19:19:27 +0000
+++ lib/lp/registry/browser/productseries.py 2010-09-02 12:57:56 +0000
@@ -54,7 +54,6 @@
54 SimpleVocabulary,54 SimpleVocabulary,
55 )55 )
5656
57from canonical.cachedproperty import cachedproperty
58from canonical.launchpad import _57from canonical.launchpad import _
59from canonical.launchpad.helpers import browserLanguages58from canonical.launchpad.helpers import browserLanguages
60from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities59from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
@@ -137,6 +136,7 @@
137from lp.registry.interfaces.productseries import IProductSeries136from lp.registry.interfaces.productseries import IProductSeries
138from lp.registry.interfaces.series import SeriesStatus137from lp.registry.interfaces.series import SeriesStatus
139from lp.services.fields import URIField138from lp.services.fields import URIField
139from lp.services.propertycache import cachedproperty
140from lp.services.worlddata.interfaces.country import ICountry140from lp.services.worlddata.interfaces.country import ICountry
141from lp.services.worlddata.interfaces.language import ILanguageSet141from lp.services.worlddata.interfaces.language import ILanguageSet
142from lp.translations.interfaces.potemplate import IPOTemplateSet142from lp.translations.interfaces.potemplate import IPOTemplateSet
143143
=== modified file 'lib/lp/registry/browser/project.py'
--- lib/lp/registry/browser/project.py 2010-08-21 18:41:57 +0000
+++ lib/lp/registry/browser/project.py 2010-09-02 12:57:56 +0000
@@ -42,7 +42,6 @@
42from zope.lifecycleevent import ObjectCreatedEvent42from zope.lifecycleevent import ObjectCreatedEvent
43from zope.schema import Choice43from zope.schema import Choice
4444
45from canonical.cachedproperty import cachedproperty
46from canonical.launchpad import _45from canonical.launchpad import _
47from canonical.launchpad.browser.feeds import FeedsMixin46from canonical.launchpad.browser.feeds import FeedsMixin
48from canonical.launchpad.webapp import (47from canonical.launchpad.webapp import (
@@ -98,6 +97,7 @@
98 PillarAliases,97 PillarAliases,
99 PublicPersonChoice,98 PublicPersonChoice,
100 )99 )
100from lp.services.propertycache import cachedproperty
101101
102102
103class ProjectNavigation(Navigation,103class ProjectNavigation(Navigation,
104104
=== modified file 'lib/lp/registry/browser/structuralsubscription.py'
--- lib/lp/registry/browser/structuralsubscription.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/structuralsubscription.py 2010-09-02 12:57:56 +0000
@@ -22,7 +22,6 @@
22 SimpleVocabulary,22 SimpleVocabulary,
23 )23 )
2424
25from canonical.cachedproperty import cachedproperty
26from canonical.launchpad.webapp import (25from canonical.launchpad.webapp import (
27 action,26 action,
28 canonical_url,27 canonical_url,
@@ -43,6 +42,7 @@
43 IStructuralSubscriptionForm,42 IStructuralSubscriptionForm,
44 IStructuralSubscriptionTarget,43 IStructuralSubscriptionTarget,
45 )44 )
45from lp.services.propertycache import cachedproperty
4646
4747
48class StructuralSubscriptionView(LaunchpadFormView):48class StructuralSubscriptionView(LaunchpadFormView):
4949
=== modified file 'lib/lp/registry/browser/team.py'
--- lib/lp/registry/browser/team.py 2010-08-27 22:33:36 +0000
+++ lib/lp/registry/browser/team.py 2010-09-02 12:57:56 +0000
@@ -41,7 +41,6 @@
41 SimpleVocabulary,41 SimpleVocabulary,
42 )42 )
4343
44from canonical.cachedproperty import cachedproperty
45from canonical.launchpad import _44from canonical.launchpad import _
46from canonical.launchpad.interfaces.authtoken import LoginTokenType45from canonical.launchpad.interfaces.authtoken import LoginTokenType
47from canonical.launchpad.interfaces.emailaddress import IEmailAddressSet46from canonical.launchpad.interfaces.emailaddress import IEmailAddressSet
@@ -92,6 +91,7 @@
92 )91 )
93from lp.registry.interfaces.teammembership import TeamMembershipStatus92from lp.registry.interfaces.teammembership import TeamMembershipStatus
94from lp.services.fields import PublicPersonChoice93from lp.services.fields import PublicPersonChoice
94from lp.services.propertycache import cachedproperty
9595
9696
97class TeamPrivacyAdapter:97class TeamPrivacyAdapter:
9898
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py 2010-09-02 12:57:52 +0000
+++ lib/lp/registry/model/distribution.py 2010-09-02 12:57:56 +0000
@@ -149,15 +149,11 @@
149from lp.registry.model.structuralsubscription import (149from lp.registry.model.structuralsubscription import (
150 StructuralSubscriptionTargetMixin,150 StructuralSubscriptionTargetMixin,
151 )151 )
152<<<<<<< TREE
153from lp.soyuz.enums import (
154=======
155from lp.services.propertycache import (152from lp.services.propertycache import (
156 cachedproperty,153 cachedproperty,
157 IPropertyCache,154 IPropertyCache,
158 )155 )
159from lp.soyuz.interfaces.archive import (156from lp.soyuz.enums import (
160>>>>>>> MERGE-SOURCE
161 ArchivePurpose,157 ArchivePurpose,
162 ArchiveStatus,158 ArchiveStatus,
163 PackagePublishingStatus,159 PackagePublishingStatus,
@@ -170,10 +166,11 @@
170from lp.soyuz.interfaces.archivepermission import IArchivePermissionSet166from lp.soyuz.interfaces.archivepermission import IArchivePermissionSet
171from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet167from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
172from lp.soyuz.interfaces.buildrecords import IHasBuildRecords168from lp.soyuz.interfaces.buildrecords import IHasBuildRecords
173from lp.soyuz.interfaces.publishing import (169from lp.soyuz.interfaces.publishing import active_publishing_status
174 active_publishing_status,170from lp.soyuz.model.archive import Archive
175 )
176from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild171from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
172from lp.soyuz.model.binarypackagename import BinaryPackageName
173from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease
177from lp.soyuz.model.distributionsourcepackagecache import (174from lp.soyuz.model.distributionsourcepackagecache import (
178 DistributionSourcePackageCache,175 DistributionSourcePackageCache,
179 )176 )
180177
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2010-08-26 08:02:08 +0000
+++ lib/lp/registry/model/distroseries.py 2010-09-02 12:57:56 +0000
@@ -36,7 +36,6 @@
36from zope.component import getUtility36from zope.component import getUtility
37from zope.interface import implements37from zope.interface import implements
3838
39from canonical.cachedproperty import cachedproperty
40from canonical.database.constants import (39from canonical.database.constants import (
41 DEFAULT,40 DEFAULT,
42 UTC_NOW,41 UTC_NOW,
@@ -114,15 +113,14 @@
114from lp.registry.model.structuralsubscription import (113from lp.registry.model.structuralsubscription import (
115 StructuralSubscriptionTargetMixin,114 StructuralSubscriptionTargetMixin,
116 )115 )
116from lp.services.propertycache import cachedproperty
117from lp.services.worlddata.model.language import Language117from lp.services.worlddata.model.language import Language
118from lp.soyuz.enums import (118from lp.soyuz.enums import (
119 ArchivePurpose,119 ArchivePurpose,
120 PackagePublishingStatus,120 PackagePublishingStatus,
121 PackageUploadStatus,121 PackageUploadStatus,
122 )122 )
123from lp.soyuz.interfaces.archive import (123from lp.soyuz.interfaces.archive import ALLOW_RELEASE_BUILDS
124 ALLOW_RELEASE_BUILDS,
125 )
126from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet124from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
127from lp.soyuz.interfaces.binarypackagename import IBinaryPackageName125from lp.soyuz.interfaces.binarypackagename import IBinaryPackageName
128from lp.soyuz.interfaces.buildrecords import IHasBuildRecords126from lp.soyuz.interfaces.buildrecords import IHasBuildRecords
@@ -551,7 +549,7 @@
551 orderBy=["Language.englishname"])549 orderBy=["Language.englishname"])
552 return result550 return result
553551
554 @cachedproperty('_previous_series_cached')552 @cachedproperty
555 def previous_series(self):553 def previous_series(self):
556 """See `IDistroSeries`."""554 """See `IDistroSeries`."""
557 # This property is cached because it is used intensely inside555 # This property is cached because it is used intensely inside
558556
=== modified file 'lib/lp/registry/model/mailinglist.py'
--- lib/lp/registry/model/mailinglist.py 2010-08-22 19:14:23 +0000
+++ lib/lp/registry/model/mailinglist.py 2010-09-02 12:57:56 +0000
@@ -51,7 +51,6 @@
51 )51 )
52from zope.security.proxy import removeSecurityProxy52from zope.security.proxy import removeSecurityProxy
5353
54from canonical.cachedproperty import cachedproperty
55from canonical.config import config54from canonical.config import config
56from canonical.database.constants import (55from canonical.database.constants import (
57 DEFAULT,56 DEFAULT,
@@ -95,6 +94,7 @@
95from lp.registry.interfaces.person import validate_public_person94from lp.registry.interfaces.person import validate_public_person
96from lp.registry.model.person import Person95from lp.registry.model.person import Person
97from lp.registry.model.teammembership import TeamParticipation96from lp.registry.model.teammembership import TeamParticipation
97from lp.services.propertycache import cachedproperty
9898
9999
100EMAIL_ADDRESS_STATUSES = (100EMAIL_ADDRESS_STATUSES = (
101101
=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py 2010-09-02 12:57:52 +0000
+++ lib/lp/registry/model/person.py 2010-09-02 12:57:56 +0000
@@ -272,9 +272,7 @@
272 )272 )
273from lp.services.worlddata.model.language import Language273from lp.services.worlddata.model.language import Language
274from lp.soyuz.enums import ArchivePurpose274from lp.soyuz.enums import ArchivePurpose
275from lp.soyuz.interfaces.archive import (275from lp.soyuz.interfaces.archive import IArchiveSet
276 IArchiveSet,
277 )
278from lp.soyuz.interfaces.archivepermission import IArchivePermissionSet276from lp.soyuz.interfaces.archivepermission import IArchivePermissionSet
279from lp.soyuz.interfaces.archivesubscriber import IArchiveSubscriberSet277from lp.soyuz.interfaces.archivesubscriber import IArchiveSubscriberSet
280from lp.soyuz.model.archive import Archive278from lp.soyuz.model.archive import Archive
@@ -1620,7 +1618,7 @@
1620 if not person:1618 if not person:
1621 return1619 return
1622 email = column1620 email = column
1623 cache_property(person, '_preferredemail_cached', email)1621 IPropertyCache(person).preferredemail = email
1624 decorators.append(handleemail)1622 decorators.append(handleemail)
1625 def handleaccount(person, column):1623 def handleaccount(person, column):
1626 #-- validity caching1624 #-- validity caching
@@ -1632,7 +1630,7 @@
1632 column is not None1630 column is not None
1633 # -- preferred email found1631 # -- preferred email found
1634 and person.preferredemail is not None)1632 and person.preferredemail is not None)
1635 cache_property(person, '_is_valid_person_cached', valid)1633 IPropertyCache(person).is_valid_person = valid
1636 decorators.append(handleaccount)1634 decorators.append(handleaccount)
1637 return dict(1635 return dict(
1638 joins=origins,1636 joins=origins,
@@ -1752,27 +1750,11 @@
1752 if need_preferred_email and not need_validity:1750 if need_preferred_email and not need_validity:
1753 email = row[index]1751 email = row[index]
1754 index += 11752 index += 1
1755<<<<<<< TREE1753 cache.preferredemail = email
1756 cache_property(result, '_preferredemail_cached', email)
1757 for decorator in decorators:1754 for decorator in decorators:
1758 column = row[index]1755 column = row[index]
1759=======
1760 cache.preferredemail = email
1761 #-- validity caching
1762 if need_validity:
1763 # valid if:
1764 valid = (
1765 # -- valid account found
1766 row[index] is not None
1767 # -- preferred email found
1768 and result.preferredemail is not None)
1769>>>>>>> MERGE-SOURCE
1770 index += 11756 index += 1
1771<<<<<<< TREE
1772 decorator(result, column)1757 decorator(result, column)
1773=======
1774 cache.is_valid_person = valid
1775>>>>>>> MERGE-SOURCE
1776 return result1758 return result
1777 return DecoratedResultSet(raw_result,1759 return DecoratedResultSet(raw_result,
1778 result_decorator=prepopulate_person)1760 result_decorator=prepopulate_person)
17791761
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2010-08-31 05:58:45 +0000
+++ lib/lp/registry/model/product.py 2010-09-02 12:57:56 +0000
@@ -38,7 +38,6 @@
38from zope.interface import implements38from zope.interface import implements
39from zope.security.proxy import removeSecurityProxy39from zope.security.proxy import removeSecurityProxy
4040
41from canonical.cachedproperty import cachedproperty
42from canonical.database.constants import UTC_NOW41from canonical.database.constants import UTC_NOW
43from canonical.database.datetimecol import UtcDateTimeCol42from canonical.database.datetimecol import UtcDateTimeCol
44from canonical.database.enumcol import EnumCol43from canonical.database.enumcol import EnumCol
@@ -150,6 +149,10 @@
150 StructuralSubscriptionTargetMixin,149 StructuralSubscriptionTargetMixin,
151 )150 )
152from lp.services.database.prejoin import prejoin151from lp.services.database.prejoin import prejoin
152from lp.services.propertycache import (
153 cachedproperty,
154 IPropertyCache,
155 )
153from lp.translations.interfaces.customlanguagecode import (156from lp.translations.interfaces.customlanguagecode import (
154 IHasCustomLanguageCodes,157 IHasCustomLanguageCodes,
155 )158 )
@@ -428,7 +431,7 @@
428 notNull=True, default=False,431 notNull=True, default=False,
429 storm_validator=_validate_license_approved)432 storm_validator=_validate_license_approved)
430433
431 @cachedproperty('_commercial_subscription_cached')434 @cachedproperty
432 def commercial_subscription(self):435 def commercial_subscription(self):
433 return CommercialSubscription.selectOneBy(product=self)436 return CommercialSubscription.selectOneBy(product=self)
434437
@@ -475,7 +478,7 @@
475 purchaser=purchaser,478 purchaser=purchaser,
476 sales_system_id=voucher,479 sales_system_id=voucher,
477 whiteboard=whiteboard)480 whiteboard=whiteboard)
478 self._commercial_subscription_cached = subscription481 IPropertyCache(self).commercial_subscription = subscription
479 else:482 else:
480 if current_datetime <= self.commercial_subscription.date_expires:483 if current_datetime <= self.commercial_subscription.date_expires:
481 # Extend current subscription.484 # Extend current subscription.
482485
=== modified file 'lib/lp/registry/vocabularies.py'
--- lib/lp/registry/vocabularies.py 2010-08-24 07:51:22 +0000
+++ lib/lp/registry/vocabularies.py 2010-09-02 12:57:56 +0000
@@ -88,7 +88,6 @@
88 removeSecurityProxy,88 removeSecurityProxy,
89 )89 )
9090
91from canonical.cachedproperty import cachedproperty
92from canonical.database.sqlbase import (91from canonical.database.sqlbase import (
93 quote,92 quote,
94 quote_like,93 quote_like,
@@ -169,6 +168,7 @@
169from lp.registry.model.projectgroup import ProjectGroup168from lp.registry.model.projectgroup import ProjectGroup
170from lp.registry.model.sourcepackagename import SourcePackageName169from lp.registry.model.sourcepackagename import SourcePackageName
171from lp.registry.model.teammembership import TeamParticipation170from lp.registry.model.teammembership import TeamParticipation
171from lp.services.propertycache import cachedproperty
172172
173173
174class BasePersonVocabulary:174class BasePersonVocabulary:
175175
=== modified file 'lib/lp/services/mailman/doc/staging.txt'
--- lib/lp/services/mailman/doc/staging.txt 2010-06-09 03:38:46 +0000
+++ lib/lp/services/mailman/doc/staging.txt 2010-09-02 12:57:56 +0000
@@ -30,8 +30,9 @@
30 >>> logout()30 >>> logout()
3131
32 >>> from canonical.launchpad.testing.pages import setupBrowser32 >>> from canonical.launchpad.testing.pages import setupBrowser
33 >>> from lp.services.propertycache import IPropertyCache
33 >>> browser = setupBrowser('Basic %s:%s' %34 >>> browser = setupBrowser('Basic %s:%s' %
34 ... (owner._preferredemail_cached.email,35 ... (IPropertyCache(owner).preferredemail.email,
35 ... owner._password_cleartext_cached))36 ... owner._password_cleartext_cached))
3637
37 >>> from lp.services.mailman.testing import helpers38 >>> from lp.services.mailman.testing import helpers
3839
=== modified file 'lib/lp/services/openid/browser/openiddiscovery.py'
--- lib/lp/services/openid/browser/openiddiscovery.py 2010-08-20 20:31:18 +0000
+++ lib/lp/services/openid/browser/openiddiscovery.py 2010-09-02 12:57:56 +0000
@@ -14,9 +14,9 @@
14 YADIS_HEADER_NAME,14 YADIS_HEADER_NAME,
15 )15 )
1616
17from canonical.cachedproperty import cachedproperty
18from canonical.launchpad.webapp import canonical_url17from canonical.launchpad.webapp import canonical_url
19from lp.services.openid.adapters.openid import CurrentOpenIDEndPoint18from lp.services.openid.adapters.openid import CurrentOpenIDEndPoint
19from lp.services.propertycache import cachedproperty
2020
2121
22class XRDSContentNegotiationMixin:22class XRDSContentNegotiationMixin:
2323
=== modified file 'lib/lp/services/propertycache.py'
--- lib/lp/services/propertycache.py 2010-09-02 12:57:52 +0000
+++ lib/lp/services/propertycache.py 2010-09-02 12:57:56 +0000
@@ -20,6 +20,7 @@
20from zope.component import (20from zope.component import (
21 adapter,21 adapter,
22 adapts,22 adapts,
23 getGlobalSiteManager,
23 )24 )
24from zope.interface import (25from zope.interface import (
25 implementer,26 implementer,
@@ -62,6 +63,11 @@
62 """Empty the cache."""63 """Empty the cache."""
6364
6465
66# Register adapters with the global site manager so that they work even when
67# ZCML has not been executed.
68registerAdapter = getGlobalSiteManager().registerAdapter
69
70
65class DefaultPropertyCache:71class DefaultPropertyCache:
66 """A simple cache."""72 """A simple cache."""
6773
@@ -94,6 +100,8 @@
94 naked_target._property_cache = DefaultPropertyCache()100 naked_target._property_cache = DefaultPropertyCache()
95 return naked_target._property_cache101 return naked_target._property_cache
96102
103registerAdapter(get_default_cache)
104
97105
98class PropertyCacheManager:106class PropertyCacheManager:
99 """A simple `IPropertyCacheManager`.107 """A simple `IPropertyCacheManager`.
@@ -112,6 +120,8 @@
112 for name in list(self.cache):120 for name in list(self.cache):
113 delattr(self.cache, name)121 delattr(self.cache, name)
114122
123registerAdapter(PropertyCacheManager)
124
115125
116class DefaultPropertyCacheManager:126class DefaultPropertyCacheManager:
117 """A `IPropertyCacheManager` specifically for `DefaultPropertyCache`.127 """A `IPropertyCacheManager` specifically for `DefaultPropertyCache`.
@@ -128,6 +138,8 @@
128 def clear(self):138 def clear(self):
129 self.cache.__dict__.clear()139 self.cache.__dict__.clear()
130140
141registerAdapter(DefaultPropertyCacheManager)
142
131143
132class CachedProperty:144class CachedProperty:
133 """Cached property descriptor.145 """Cached property descriptor.
@@ -172,3 +184,32 @@
172 name = name_or_function.__name__184 name = name_or_function.__name__
173 populate = name_or_function185 populate = name_or_function
174 return CachedProperty(name=name, populate=populate)186 return CachedProperty(name=name, populate=populate)
187
188
189# XXX: GavinPanella 2010-09-02 bug=628762: There are some weird adaption
190# failures when running the full test suite. All that follows is a temporary,
191# mostly non-Zope, workaround.
192
193_IPropertyCache = IPropertyCache
194_IPropertyCacheManager = IPropertyCacheManager
195
196def IPropertyCache(target):
197 """Return the `IPropertyCache` for `target`.
198
199 Note: this is a workaround; see bug 628762.
200 """
201 if _IPropertyCache.providedBy(target):
202 return target
203 else:
204 return get_default_cache(target)
205
206def IPropertyCacheManager(target):
207 """Return the `IPropertyCacheManager` for `target`.
208
209 Note: this is a workaround; see bug 628762.
210 """
211 cache = IPropertyCache(target)
212 if isinstance(cache, DefaultPropertyCache):
213 return DefaultPropertyCacheManager(cache)
214 else:
215 return PropertyCacheManager(cache)
175216
=== modified file 'lib/lp/services/salesforce/proxy.py'
--- lib/lp/services/salesforce/proxy.py 2010-08-20 20:31:18 +0000
+++ lib/lp/services/salesforce/proxy.py 2010-09-02 12:57:56 +0000
@@ -20,10 +20,10 @@
20from zope.component import getUtility20from zope.component import getUtility
21from zope.interface import implements21from zope.interface import implements
2222
23from canonical.cachedproperty import cachedproperty
24from canonical.config import config23from canonical.config import config
25from canonical.lazr.timeout import SafeTransportWithTimeout24from canonical.lazr.timeout import SafeTransportWithTimeout
26from lp.registry.interfaces.product import IProductSet25from lp.registry.interfaces.product import IProductSet
26from lp.services.propertycache import cachedproperty
27from lp.services.salesforce.interfaces import (27from lp.services.salesforce.interfaces import (
28 ISalesforceVoucher,28 ISalesforceVoucher,
29 ISalesforceVoucherProxy,29 ISalesforceVoucherProxy,
3030
=== modified file 'lib/lp/services/tests/test_doc.py'
--- lib/lp/services/tests/test_doc.py 2010-09-02 12:57:52 +0000
+++ lib/lp/services/tests/test_doc.py 2010-09-02 12:57:56 +0000
@@ -8,8 +8,10 @@
8import os8import os
99
10from canonical.launchpad.testing.systemdocs import LayeredDocFileSuite10from canonical.launchpad.testing.systemdocs import LayeredDocFileSuite
11from canonical.testing import BaseLayer11from canonical.testing import (
12from canonical.testing import LaunchpadZopelessLayer12 BaseLayer,
13 LaunchpadZopelessLayer,
14 )
13from lp.services.testing import build_test_suite15from lp.services.testing import build_test_suite
1416
1517
1618
=== modified file 'lib/lp/shipit.py'
--- lib/lp/shipit.py 2010-08-20 20:31:18 +0000
+++ lib/lp/shipit.py 2010-09-02 12:57:56 +0000
@@ -106,6 +106,10 @@
106from lp.registry.model.person import Person106from lp.registry.model.person import Person
107from lp.services.mail import stub107from lp.services.mail import stub
108from lp.services.mail.sendmail import simple_sendmail108from lp.services.mail.sendmail import simple_sendmail
109from lp.services.propertycache import (
110 cachedproperty,
111 IPropertyCache,
112 )
109from lp.services.scripts.base import (113from lp.services.scripts.base import (
110 LaunchpadCronScript,114 LaunchpadCronScript,
111 LaunchpadScript,115 LaunchpadScript,
112116
=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py 2010-08-27 11:19:54 +0000
+++ lib/lp/soyuz/browser/archive.py 2010-09-02 12:57:56 +0000
@@ -56,7 +56,6 @@
56from zope.security.interfaces import Unauthorized56from zope.security.interfaces import Unauthorized
57from zope.security.proxy import removeSecurityProxy57from zope.security.proxy import removeSecurityProxy
5858
59from canonical.cachedproperty import cachedproperty
60from canonical.launchpad import _59from canonical.launchpad import _
61from canonical.launchpad.browser.librarian import FileNavigationMixin60from canonical.launchpad.browser.librarian import FileNavigationMixin
62from canonical.launchpad.components.tokens import create_token61from canonical.launchpad.components.tokens import create_token
@@ -107,6 +106,7 @@
107from lp.registry.interfaces.series import SeriesStatus106from lp.registry.interfaces.series import SeriesStatus
108from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet107from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
109from lp.services.browser_helpers import get_user_agent_distroseries108from lp.services.browser_helpers import get_user_agent_distroseries
109from lp.services.propertycache import cachedproperty
110from lp.services.worlddata.interfaces.country import ICountrySet110from lp.services.worlddata.interfaces.country import ICountrySet
111from lp.soyuz.adapters.archivedependencies import (111from lp.soyuz.adapters.archivedependencies import (
112 default_component_dependency_name,112 default_component_dependency_name,
@@ -134,9 +134,7 @@
134 IPPAActivateForm,134 IPPAActivateForm,
135 NoSuchPPA,135 NoSuchPPA,
136 )136 )
137from lp.soyuz.interfaces.archivepermission import (137from lp.soyuz.interfaces.archivepermission import IArchivePermissionSet
138 IArchivePermissionSet,
139 )
140from lp.soyuz.interfaces.archivesubscriber import IArchiveSubscriberSet138from lp.soyuz.interfaces.archivesubscriber import IArchiveSubscriberSet
141from lp.soyuz.interfaces.binarypackagebuild import (139from lp.soyuz.interfaces.binarypackagebuild import (
142 BuildSetStatus,140 BuildSetStatus,
143141
=== modified file 'lib/lp/soyuz/browser/archivesubscription.py'
--- lib/lp/soyuz/browser/archivesubscription.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/browser/archivesubscription.py 2010-09-02 12:57:56 +0000
@@ -30,7 +30,6 @@
30 Text,30 Text,
31 )31 )
3232
33from canonical.cachedproperty import cachedproperty
34from canonical.launchpad import _33from canonical.launchpad import _
35from canonical.launchpad.webapp.launchpadform import (34from canonical.launchpad.webapp.launchpadform import (
36 action,35 action,
@@ -45,6 +44,7 @@
45from canonical.widgets import DateWidget44from canonical.widgets import DateWidget
46from canonical.widgets.popup import PersonPickerWidget45from canonical.widgets.popup import PersonPickerWidget
47from lp.services.fields import PersonChoice46from lp.services.fields import PersonChoice
47from lp.services.propertycache import cachedproperty
48from lp.soyuz.browser.sourceslist import (48from lp.soyuz.browser.sourceslist import (
49 SourcesListEntries,49 SourcesListEntries,
50 SourcesListEntriesView,50 SourcesListEntriesView,
5151
=== modified file 'lib/lp/soyuz/browser/build.py'
--- lib/lp/soyuz/browser/build.py 2010-08-27 11:19:54 +0000
+++ lib/lp/soyuz/browser/build.py 2010-09-02 12:57:56 +0000
@@ -19,7 +19,6 @@
19from zope.component import getUtility19from zope.component import getUtility
20from zope.interface import implements20from zope.interface import implements
2121
22from canonical.cachedproperty import cachedproperty
23from canonical.launchpad import _22from canonical.launchpad import _
24from canonical.launchpad.browser.librarian import (23from canonical.launchpad.browser.librarian import (
25 FileNavigationMixin,24 FileNavigationMixin,
@@ -44,12 +43,13 @@
44from lp.app.errors import UnexpectedFormData43from lp.app.errors import UnexpectedFormData
45from lp.buildmaster.enums import BuildStatus44from lp.buildmaster.enums import BuildStatus
46from lp.services.job.interfaces.job import JobStatus45from lp.services.job.interfaces.job import JobStatus
46from lp.services.propertycache import cachedproperty
47from lp.soyuz.enums import PackageUploadStatus
47from lp.soyuz.interfaces.binarypackagebuild import (48from lp.soyuz.interfaces.binarypackagebuild import (
48 IBinaryPackageBuild,49 IBinaryPackageBuild,
49 IBinaryPackageBuildSet,50 IBinaryPackageBuildSet,
50 IBuildRescoreForm,51 IBuildRescoreForm,
51 )52 )
52from lp.soyuz.enums import PackageUploadStatus
5353
5454
55class BuildUrl:55class BuildUrl:
5656
=== modified file 'lib/lp/soyuz/browser/builder.py'
--- lib/lp/soyuz/browser/builder.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/browser/builder.py 2010-09-02 12:57:56 +0000
@@ -28,7 +28,6 @@
28from zope.event import notify28from zope.event import notify
29from zope.lifecycleevent import ObjectCreatedEvent29from zope.lifecycleevent import ObjectCreatedEvent
3030
31from canonical.cachedproperty import cachedproperty
32from canonical.launchpad import _31from canonical.launchpad import _
33from canonical.launchpad.webapp import (32from canonical.launchpad.webapp import (
34 action,33 action,
@@ -53,6 +52,7 @@
53 IBuilder,52 IBuilder,
54 IBuilderSet,53 IBuilderSet,
55 )54 )
55from lp.services.propertycache import cachedproperty
56from lp.soyuz.browser.build import BuildRecordsView56from lp.soyuz.browser.build import BuildRecordsView
57from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet57from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
5858
5959
=== modified file 'lib/lp/soyuz/browser/distributionsourcepackagerelease.py'
--- lib/lp/soyuz/browser/distributionsourcepackagerelease.py 2010-08-24 15:29:01 +0000
+++ lib/lp/soyuz/browser/distributionsourcepackagerelease.py 2010-09-02 12:57:56 +0000
@@ -14,7 +14,6 @@
1414
15from zope.component import getUtility15from zope.component import getUtility
1616
17from canonical.cachedproperty import cachedproperty
18from canonical.launchpad.browser.librarian import ProxiedLibraryFileAlias17from canonical.launchpad.browser.librarian import ProxiedLibraryFileAlias
19from canonical.launchpad.webapp import (18from canonical.launchpad.webapp import (
20 LaunchpadView,19 LaunchpadView,
@@ -25,11 +24,12 @@
25from canonical.lazr.utils import smartquote24from canonical.lazr.utils import smartquote
26from lp.app.errors import NotFoundError25from lp.app.errors import NotFoundError
27from lp.archivepublisher.debversion import Version26from lp.archivepublisher.debversion import Version
27from lp.services.propertycache import cachedproperty
28from lp.soyuz.enums import PackagePublishingStatus
28from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet29from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
29from lp.soyuz.interfaces.distributionsourcepackagerelease import (30from lp.soyuz.interfaces.distributionsourcepackagerelease import (
30 IDistributionSourcePackageRelease,31 IDistributionSourcePackageRelease,
31 )32 )
32from lp.soyuz.enums import PackagePublishingStatus
3333
3434
35class DistributionSourcePackageReleaseBreadcrumb(Breadcrumb):35class DistributionSourcePackageReleaseBreadcrumb(Breadcrumb):
3636
=== modified file 'lib/lp/soyuz/browser/packagesearch.py'
--- lib/lp/soyuz/browser/packagesearch.py 2010-03-04 22:11:34 +0000
+++ lib/lp/soyuz/browser/packagesearch.py 2010-09-02 12:57:56 +0000
@@ -7,9 +7,9 @@
7 'PackageSearchViewBase'7 'PackageSearchViewBase'
8 ]8 ]
99
10from canonical.cachedproperty import cachedproperty
11from canonical.launchpad.webapp.batching import BatchNavigator10from canonical.launchpad.webapp.batching import BatchNavigator
12from canonical.launchpad.webapp.publisher import LaunchpadView11from canonical.launchpad.webapp.publisher import LaunchpadView
12from lp.services.propertycache import cachedproperty
1313
1414
15class PackageSearchViewBase(LaunchpadView):15class PackageSearchViewBase(LaunchpadView):
1616
=== modified file 'lib/lp/soyuz/browser/publishing.py'
--- lib/lp/soyuz/browser/publishing.py 2010-08-24 15:29:01 +0000
+++ lib/lp/soyuz/browser/publishing.py 2010-09-02 12:57:56 +0000
@@ -17,11 +17,11 @@
17from lazr.delegates import delegates17from lazr.delegates import delegates
18from zope.interface import implements18from zope.interface import implements
1919
20from canonical.cachedproperty import cachedproperty
21from canonical.launchpad.browser.librarian import ProxiedLibraryFileAlias20from canonical.launchpad.browser.librarian import ProxiedLibraryFileAlias
22from canonical.launchpad.webapp.authorization import check_permission21from canonical.launchpad.webapp.authorization import check_permission
23from canonical.launchpad.webapp.interfaces import ICanonicalUrlData22from canonical.launchpad.webapp.interfaces import ICanonicalUrlData
24from canonical.launchpad.webapp.publisher import LaunchpadView23from canonical.launchpad.webapp.publisher import LaunchpadView
24from lp.services.propertycache import cachedproperty
25from lp.soyuz.enums import PackagePublishingStatus25from lp.soyuz.enums import PackagePublishingStatus
26from lp.soyuz.interfaces.binarypackagebuild import BuildSetStatus26from lp.soyuz.interfaces.binarypackagebuild import BuildSetStatus
27from lp.soyuz.interfaces.packagediff import IPackageDiff27from lp.soyuz.interfaces.packagediff import IPackageDiff
2828
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2010-09-02 12:57:52 +0000
+++ lib/lp/soyuz/model/archive.py 2010-09-02 12:57:56 +0000
@@ -129,9 +129,7 @@
129 )129 )
130from lp.soyuz.interfaces.archivearch import IArchiveArchSet130from lp.soyuz.interfaces.archivearch import IArchiveArchSet
131from lp.soyuz.interfaces.archiveauthtoken import IArchiveAuthTokenSet131from lp.soyuz.interfaces.archiveauthtoken import IArchiveAuthTokenSet
132from lp.soyuz.interfaces.archivepermission import (132from lp.soyuz.interfaces.archivepermission import IArchivePermissionSet
133 IArchivePermissionSet,
134 )
135from lp.soyuz.interfaces.archivesubscriber import (133from lp.soyuz.interfaces.archivesubscriber import (
136 ArchiveSubscriptionError,134 ArchiveSubscriptionError,
137 IArchiveSubscriberSet,135 IArchiveSubscriberSet,
138136
=== modified file 'lib/lp/soyuz/model/distroarchseriesbinarypackage.py'
--- lib/lp/soyuz/model/distroarchseriesbinarypackage.py 2010-08-24 15:29:01 +0000
+++ lib/lp/soyuz/model/distroarchseriesbinarypackage.py 2010-09-02 12:57:56 +0000
@@ -17,14 +17,14 @@
17 )17 )
18from zope.interface import implements18from zope.interface import implements
1919
20from canonical.cachedproperty import cachedproperty
21from canonical.database.sqlbase import sqlvalues20from canonical.database.sqlbase import sqlvalues
22from canonical.launchpad.interfaces import IStore21from canonical.launchpad.interfaces import IStore
23from lp.app.errors import NotFoundError22from lp.app.errors import NotFoundError
23from lp.services.propertycache import cachedproperty
24from lp.soyuz.enums import PackagePublishingStatus
24from lp.soyuz.interfaces.distroarchseriesbinarypackage import (25from lp.soyuz.interfaces.distroarchseriesbinarypackage import (
25 IDistroArchSeriesBinaryPackage,26 IDistroArchSeriesBinaryPackage,
26 )27 )
27from lp.soyuz.enums import PackagePublishingStatus
28from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease28from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease
29from lp.soyuz.model.distroarchseriesbinarypackagerelease import (29from lp.soyuz.model.distroarchseriesbinarypackagerelease import (
30 DistroArchSeriesBinaryPackageRelease,30 DistroArchSeriesBinaryPackageRelease,
3131
=== modified file 'lib/lp/soyuz/model/distroseriesbinarypackage.py'
--- lib/lp/soyuz/model/distroseriesbinarypackage.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/model/distroseriesbinarypackage.py 2010-09-02 12:57:56 +0000
@@ -12,8 +12,11 @@
12from storm.store import Store12from storm.store import Store
13from zope.interface import implements13from zope.interface import implements
1414
15from canonical.cachedproperty import cachedproperty
16from canonical.database.sqlbase import sqlvalues15from canonical.database.sqlbase import sqlvalues
16from lp.services.propertycache import (
17 cachedproperty,
18 IPropertyCache,
19 )
17from lp.soyuz.interfaces.distroseriesbinarypackage import (20from lp.soyuz.interfaces.distroseriesbinarypackage import (
18 IDistroSeriesBinaryPackage,21 IDistroSeriesBinaryPackage,
19 )22 )
@@ -40,7 +43,7 @@
40 self.distroseries = distroseries43 self.distroseries = distroseries
41 self.binarypackagename = binarypackagename44 self.binarypackagename = binarypackagename
42 if cache is not None:45 if cache is not None:
43 self._cache = cache46 IPropertyCache(self).cache = cache
4447
45 @property48 @property
46 def name(self):49 def name(self):
@@ -58,7 +61,7 @@
58 """See IDistroSeriesBinaryPackage."""61 """See IDistroSeriesBinaryPackage."""
59 return self.distroseries.distribution62 return self.distroseries.distribution
6063
61 @cachedproperty('_cache')64 @cachedproperty
62 def cache(self):65 def cache(self):
63 """See IDistroSeriesBinaryPackage."""66 """See IDistroSeriesBinaryPackage."""
64 store = Store.of(self.distroseries)67 store = Store.of(self.distroseries)
6568
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2010-08-24 12:25:48 +0000
+++ lib/lp/soyuz/model/queue.py 2010-09-02 12:57:56 +0000
@@ -33,7 +33,6 @@
33from zope.component import getUtility33from zope.component import getUtility
34from zope.interface import implements34from zope.interface import implements
3535
36from canonical.cachedproperty import cachedproperty
37from canonical.config import config36from canonical.config import config
38from canonical.database.constants import UTC_NOW37from canonical.database.constants import UTC_NOW
39from canonical.database.datetimecol import UtcDateTimeCol38from canonical.database.datetimecol import UtcDateTimeCol
@@ -72,6 +71,7 @@
72 PackagePublishingPocket,71 PackagePublishingPocket,
73 pocketsuffix,72 pocketsuffix,
74 )73 )
74from lp.services.propertycache import cachedproperty
75from lp.soyuz.enums import (75from lp.soyuz.enums import (
76 BinaryPackageFormat,76 BinaryPackageFormat,
77 PackageUploadCustomFormat,77 PackageUploadCustomFormat,
7878
=== modified file 'lib/lp/soyuz/model/sourcepackagerelease.py'
--- lib/lp/soyuz/model/sourcepackagerelease.py 2010-08-27 11:19:54 +0000
+++ lib/lp/soyuz/model/sourcepackagerelease.py 2010-09-02 12:57:56 +0000
@@ -30,7 +30,6 @@
30from zope.component import getUtility30from zope.component import getUtility
31from zope.interface import implements31from zope.interface import implements
3232
33from canonical.cachedproperty import cachedproperty
34from canonical.database.constants import (33from canonical.database.constants import (
35 DEFAULT,34 DEFAULT,
36 UTC_NOW,35 UTC_NOW,
@@ -59,6 +58,7 @@
59 SourcePackageType,58 SourcePackageType,
60 SourcePackageUrgency,59 SourcePackageUrgency,
61 )60 )
61from lp.services.propertycache import cachedproperty
62from lp.soyuz.enums import (62from lp.soyuz.enums import (
63 PackageDiffStatus,63 PackageDiffStatus,
64 PackagePublishingStatus,64 PackagePublishingStatus,
@@ -68,9 +68,7 @@
68 MAIN_ARCHIVE_PURPOSES,68 MAIN_ARCHIVE_PURPOSES,
69 )69 )
70from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet70from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
71from lp.soyuz.interfaces.packagediff import (71from lp.soyuz.interfaces.packagediff import PackageDiffAlreadyRequested
72 PackageDiffAlreadyRequested,
73 )
74from lp.soyuz.interfaces.sourcepackagerelease import ISourcePackageRelease72from lp.soyuz.interfaces.sourcepackagerelease import ISourcePackageRelease
75from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild73from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
76from lp.soyuz.model.files import SourcePackageReleaseFile74from lp.soyuz.model.files import SourcePackageReleaseFile
7775
=== modified file 'lib/lp/soyuz/scripts/ppareport.py'
--- lib/lp/soyuz/scripts/ppareport.py 2010-08-23 16:51:11 +0000
+++ lib/lp/soyuz/scripts/ppareport.py 2010-09-02 12:57:56 +0000
@@ -19,11 +19,11 @@
19from storm.store import Store19from storm.store import Store
20from zope.component import getUtility20from zope.component import getUtility
2121
22from canonical.cachedproperty import cachedproperty
23from canonical.config import config22from canonical.config import config
24from canonical.launchpad.helpers import emailPeople23from canonical.launchpad.helpers import emailPeople
25from canonical.launchpad.webapp import canonical_url24from canonical.launchpad.webapp import canonical_url
26from lp.registry.interfaces.distribution import IDistributionSet25from lp.registry.interfaces.distribution import IDistributionSet
26from lp.services.propertycache import cachedproperty
27from lp.services.scripts.base import (27from lp.services.scripts.base import (
28 LaunchpadScript,28 LaunchpadScript,
29 LaunchpadScriptFailure,29 LaunchpadScriptFailure,
3030
=== modified file 'lib/lp/soyuz/scripts/queue.py'
--- lib/lp/soyuz/scripts/queue.py 2010-08-24 12:25:48 +0000
+++ lib/lp/soyuz/scripts/queue.py 2010-09-02 12:57:56 +0000
@@ -24,11 +24,11 @@
24import pytz24import pytz
25from zope.component import getUtility25from zope.component import getUtility
2626
27from canonical.cachedproperty import cachedproperty
28from canonical.config import config27from canonical.config import config
29from canonical.launchpad.webapp.tales import DurationFormatterAPI28from canonical.launchpad.webapp.tales import DurationFormatterAPI
30from canonical.librarian.utils import filechunks29from canonical.librarian.utils import filechunks
31from lp.app.errors import NotFoundError30from lp.app.errors import NotFoundError
31from lp.services.propertycache import cachedproperty
32from lp.soyuz.enums import PackageUploadStatus32from lp.soyuz.enums import PackageUploadStatus
33from lp.soyuz.interfaces.component import IComponentSet33from lp.soyuz.interfaces.component import IComponentSet
34from lp.soyuz.interfaces.queue import (34from lp.soyuz.interfaces.queue import (
3535
=== modified file 'lib/lp/testing/__init__.py'
--- lib/lp/testing/__init__.py 2010-08-30 21:10:54 +0000
+++ lib/lp/testing/__init__.py 2010-09-02 12:57:56 +0000
@@ -56,7 +56,6 @@
56 )56 )
57from inspect import (57from inspect import (
58 getargspec,58 getargspec,
59 getmembers,
60 getmro,59 getmro,
61 isclass,60 isclass,
62 ismethod,61 ismethod,
@@ -1023,7 +1022,13 @@
1023 assert isclass(mock_class), (1022 assert isclass(mock_class), (
1024 "validate_mock_class() must be called for a class")1023 "validate_mock_class() must be called for a class")
1025 base_classes = getmro(mock_class)1024 base_classes = getmro(mock_class)
1026 for name, obj in getmembers(mock_class):1025 # Don't use inspect.getmembers() here because it fails on __provides__, a
1026 # descriptor added by zope.interface as part of its caching strategy. See
1027 # http://comments.gmane.org/gmane.comp.python.zope.interface/241.
1028 for name in dir(mock_class):
1029 if name == '__provides__':
1030 continue
1031 obj = getattr(mock_class, name)
1027 if ismethod(obj):1032 if ismethod(obj):
1028 for base_class in base_classes[1:]:1033 for base_class in base_classes[1:]:
1029 if name in base_class.__dict__:1034 if name in base_class.__dict__:
10301035
=== modified file 'lib/lp/testopenid/browser/server.py'
--- lib/lp/testopenid/browser/server.py 2010-08-20 20:31:18 +0000
+++ lib/lp/testopenid/browser/server.py 2010-09-02 12:57:56 +0000
@@ -32,7 +32,6 @@
32from zope.security.proxy import isinstance as zisinstance32from zope.security.proxy import isinstance as zisinstance
33from zope.session.interfaces import ISession33from zope.session.interfaces import ISession
3434
35from canonical.cachedproperty import cachedproperty
36from canonical.launchpad import _35from canonical.launchpad import _
37from canonical.launchpad.interfaces.account import (36from canonical.launchpad.interfaces.account import (
38 AccountStatus,37 AccountStatus,
@@ -61,6 +60,10 @@
61from lp.services.openid.browser.openiddiscovery import (60from lp.services.openid.browser.openiddiscovery import (
62 XRDSContentNegotiationMixin,61 XRDSContentNegotiationMixin,
63 )62 )
63from lp.services.propertycache import (
64 cachedproperty,
65 IPropertyCache,
66 )
64from lp.testopenid.interfaces.server import (67from lp.testopenid.interfaces.server import (
65 get_server_url,68 get_server_url,
66 ITestOpenIDApplication,69 ITestOpenIDApplication,
@@ -142,7 +145,7 @@
142 return (self.openid_request.idSelect() or145 return (self.openid_request.idSelect() or
143 self.openid_request.identity == self.user_identity_url)146 self.openid_request.identity == self.user_identity_url)
144147
145 @cachedproperty('_openid_parameters')148 @cachedproperty
146 def openid_parameters(self):149 def openid_parameters(self):
147 """A dictionary of OpenID query parameters from request."""150 """A dictionary of OpenID query parameters from request."""
148 query = {}151 query = {}
@@ -165,8 +168,9 @@
165 def restoreRequestFromSession(self):168 def restoreRequestFromSession(self):
166 """Get the OpenIDRequest from our session."""169 """Get the OpenIDRequest from our session."""
167 session = self.getSession()170 session = self.getSession()
171 cache = IPropertyCache(self)
168 try:172 try:
169 self._openid_parameters = session[OPENID_REQUEST_SESSION_KEY]173 cache.openid_parameters = session[OPENID_REQUEST_SESSION_KEY]
170 except KeyError:174 except KeyError:
171 raise UnexpectedFormData("No OpenID request in session")175 raise UnexpectedFormData("No OpenID request in session")
172176
173177
=== modified file 'lib/lp/translations/browser/distribution.py'
--- lib/lp/translations/browser/distribution.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/distribution.py 2010-09-02 12:57:56 +0000
@@ -13,7 +13,6 @@
1313
14import operator14import operator
1515
16from canonical.cachedproperty import cachedproperty
17from canonical.launchpad.webapp import (16from canonical.launchpad.webapp import (
18 action,17 action,
19 canonical_url,18 canonical_url,
@@ -26,6 +25,7 @@
26from lp.registry.browser.distribution import DistributionEditView25from lp.registry.browser.distribution import DistributionEditView
27from lp.registry.interfaces.distribution import IDistribution26from lp.registry.interfaces.distribution import IDistribution
28from lp.registry.interfaces.series import SeriesStatus27from lp.registry.interfaces.series import SeriesStatus
28from lp.services.propertycache import cachedproperty
29from lp.translations.browser.translations import TranslationsMixin29from lp.translations.browser.translations import TranslationsMixin
3030
3131
3232
=== modified file 'lib/lp/translations/browser/distroseries.py'
--- lib/lp/translations/browser/distroseries.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/distroseries.py 2010-09-02 12:57:56 +0000
@@ -16,7 +16,6 @@
1616
17from zope.component import getUtility17from zope.component import getUtility
1818
19from canonical.cachedproperty import cachedproperty
20from canonical.launchpad import helpers19from canonical.launchpad import helpers
21from canonical.launchpad.webapp import action20from canonical.launchpad.webapp import action
22from canonical.launchpad.webapp.authorization import check_permission21from canonical.launchpad.webapp.authorization import check_permission
@@ -33,6 +32,7 @@
33from lp.app.errors import TranslationUnavailable32from lp.app.errors import TranslationUnavailable
34from lp.registry.interfaces.distroseries import IDistroSeries33from lp.registry.interfaces.distroseries import IDistroSeries
35from lp.registry.interfaces.series import SeriesStatus34from lp.registry.interfaces.series import SeriesStatus
35from lp.services.propertycache import cachedproperty
36from lp.translations.browser.potemplate import BaseSeriesTemplatesView36from lp.translations.browser.potemplate import BaseSeriesTemplatesView
37from lp.translations.browser.translations import TranslationsMixin37from lp.translations.browser.translations import TranslationsMixin
38from lp.translations.interfaces.distroserieslanguage import (38from lp.translations.interfaces.distroserieslanguage import (
3939
=== modified file 'lib/lp/translations/browser/hastranslationimports.py'
--- lib/lp/translations/browser/hastranslationimports.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/hastranslationimports.py 2010-09-02 12:57:56 +0000
@@ -25,7 +25,6 @@
25 SimpleVocabulary,25 SimpleVocabulary,
26 )26 )
2727
28from canonical.cachedproperty import cachedproperty
29from canonical.launchpad import _28from canonical.launchpad import _
30from canonical.launchpad.webapp import (29from canonical.launchpad.webapp import (
31 action,30 action,
@@ -40,6 +39,7 @@
40from lp.app.errors import UnexpectedFormData39from lp.app.errors import UnexpectedFormData
41from lp.registry.interfaces.distribution import IDistribution40from lp.registry.interfaces.distribution import IDistribution
42from lp.registry.interfaces.pillar import IPillarNameSet41from lp.registry.interfaces.pillar import IPillarNameSet
42from lp.services.propertycache import cachedproperty
43from lp.translations.interfaces.translationimportqueue import (43from lp.translations.interfaces.translationimportqueue import (
44 IHasTranslationImports,44 IHasTranslationImports,
45 ITranslationImportQueue,45 ITranslationImportQueue,
4646
=== modified file 'lib/lp/translations/browser/language.py'
--- lib/lp/translations/browser/language.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/language.py 2010-09-02 12:57:56 +0000
@@ -21,7 +21,6 @@
21from zope.lifecycleevent import ObjectCreatedEvent21from zope.lifecycleevent import ObjectCreatedEvent
22from zope.schema import TextLine22from zope.schema import TextLine
2323
24from canonical.cachedproperty import cachedproperty
25from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities24from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
26from canonical.launchpad.webapp import (25from canonical.launchpad.webapp import (
27 action,26 action,
@@ -39,6 +38,7 @@
39from canonical.launchpad.webapp.breadcrumb import Breadcrumb38from canonical.launchpad.webapp.breadcrumb import Breadcrumb
40from canonical.launchpad.webapp.tales import LanguageFormatterAPI39from canonical.launchpad.webapp.tales import LanguageFormatterAPI
41from canonical.widgets import LabeledMultiCheckBoxWidget40from canonical.widgets import LabeledMultiCheckBoxWidget
41from lp.services.propertycache import cachedproperty
42from lp.services.worlddata.interfaces.language import (42from lp.services.worlddata.interfaces.language import (
43 ILanguage,43 ILanguage,
44 ILanguageSet,44 ILanguageSet,
4545
=== modified file 'lib/lp/translations/browser/person.py'
--- lib/lp/translations/browser/person.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/person.py 2010-09-02 12:57:56 +0000
@@ -25,7 +25,6 @@
25 Interface,25 Interface,
26 )26 )
2727
28from canonical.cachedproperty import cachedproperty
29from canonical.launchpad import _28from canonical.launchpad import _
30from canonical.launchpad.webapp import (29from canonical.launchpad.webapp import (
31 action,30 action,
@@ -40,6 +39,7 @@
40from canonical.launchpad.webapp.publisher import LaunchpadView39from canonical.launchpad.webapp.publisher import LaunchpadView
41from canonical.widgets import LaunchpadRadioWidget40from canonical.widgets import LaunchpadRadioWidget
42from lp.registry.interfaces.sourcepackage import ISourcePackage41from lp.registry.interfaces.sourcepackage import ISourcePackage
42from lp.services.propertycache import cachedproperty
43from lp.translations.browser.translationlinksaggregator import (43from lp.translations.browser.translationlinksaggregator import (
44 TranslationLinksAggregator,44 TranslationLinksAggregator,
45 )45 )
4646
=== modified file 'lib/lp/translations/browser/poexportrequest.py'
--- lib/lp/translations/browser/poexportrequest.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/poexportrequest.py 2010-09-02 12:57:56 +0000
@@ -11,13 +11,13 @@
1111
12from zope.component import getUtility12from zope.component import getUtility
1313
14from canonical.cachedproperty import cachedproperty
15from canonical.launchpad import _14from canonical.launchpad import _
16from canonical.launchpad.webapp import (15from canonical.launchpad.webapp import (
17 canonical_url,16 canonical_url,
18 LaunchpadView,17 LaunchpadView,
19 )18 )
20from canonical.launchpad.webapp.tales import DurationFormatterAPI19from canonical.launchpad.webapp.tales import DurationFormatterAPI
20from lp.services.propertycache import cachedproperty
21from lp.translations.interfaces.poexportrequest import IPOExportRequestSet21from lp.translations.interfaces.poexportrequest import IPOExportRequestSet
22from lp.translations.interfaces.potemplate import IHasTranslationTemplates22from lp.translations.interfaces.potemplate import IHasTranslationTemplates
23from lp.translations.interfaces.translationexporter import (23from lp.translations.interfaces.translationexporter import (
2424
=== modified file 'lib/lp/translations/browser/pofile.py'
--- lib/lp/translations/browser/pofile.py 2010-08-27 10:53:40 +0000
+++ lib/lp/translations/browser/pofile.py 2010-09-02 12:57:56 +0000
@@ -24,7 +24,6 @@
24from zope.component import getUtility24from zope.component import getUtility
25from zope.publisher.browser import FileUpload25from zope.publisher.browser import FileUpload
2626
27from canonical.cachedproperty import cachedproperty
28from canonical.config import config27from canonical.config import config
29from canonical.launchpad import _28from canonical.launchpad import _
30from canonical.launchpad.interfaces import ILaunchBag29from canonical.launchpad.interfaces import ILaunchBag
@@ -44,6 +43,7 @@
44 UnexpectedFormData,43 UnexpectedFormData,
45 )44 )
46from lp.registry.interfaces.person import IPersonSet45from lp.registry.interfaces.person import IPersonSet
46from lp.services.propertycache import cachedproperty
47from lp.translations.browser.poexportrequest import BaseExportView47from lp.translations.browser.poexportrequest import BaseExportView
48from lp.translations.browser.potemplate import POTemplateFacets48from lp.translations.browser.potemplate import POTemplateFacets
49from lp.translations.browser.translationmessage import (49from lp.translations.browser.translationmessage import (
5050
=== modified file 'lib/lp/translations/browser/product.py'
--- lib/lp/translations/browser/product.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/product.py 2010-09-02 12:57:56 +0000
@@ -11,7 +11,6 @@
11 'ProductView',11 'ProductView',
12 ]12 ]
1313
14from canonical.cachedproperty import cachedproperty
15from canonical.launchpad.webapp import (14from canonical.launchpad.webapp import (
16 canonical_url,15 canonical_url,
17 enabled_with_permission,16 enabled_with_permission,
@@ -24,6 +23,7 @@
24from lp.registry.interfaces.product import IProduct23from lp.registry.interfaces.product import IProduct
25from lp.registry.interfaces.productseries import IProductSeries24from lp.registry.interfaces.productseries import IProductSeries
26from lp.registry.interfaces.series import SeriesStatus25from lp.registry.interfaces.series import SeriesStatus
26from lp.services.propertycache import cachedproperty
27from lp.translations.browser.translations import TranslationsMixin27from lp.translations.browser.translations import TranslationsMixin
2828
2929
3030
=== modified file 'lib/lp/translations/browser/productseries.py'
--- lib/lp/translations/browser/productseries.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/productseries.py 2010-09-02 12:57:56 +0000
@@ -24,7 +24,6 @@
24from zope.component import getUtility24from zope.component import getUtility
25from zope.publisher.browser import FileUpload25from zope.publisher.browser import FileUpload
2626
27from canonical.cachedproperty import cachedproperty
28from canonical.launchpad import _27from canonical.launchpad import _
29from canonical.launchpad.helpers import is_tar_filename28from canonical.launchpad.helpers import is_tar_filename
30from canonical.launchpad.webapp import (29from canonical.launchpad.webapp import (
@@ -42,6 +41,7 @@
42from canonical.widgets.itemswidgets import LaunchpadRadioWidgetWithDescription41from canonical.widgets.itemswidgets import LaunchpadRadioWidgetWithDescription
43from lp.code.interfaces.branchjob import IRosettaUploadJobSource42from lp.code.interfaces.branchjob import IRosettaUploadJobSource
44from lp.registry.interfaces.productseries import IProductSeries43from lp.registry.interfaces.productseries import IProductSeries
44from lp.services.propertycache import cachedproperty
45from lp.translations.browser.poexportrequest import BaseExportView45from lp.translations.browser.poexportrequest import BaseExportView
46from lp.translations.browser.potemplate import BaseSeriesTemplatesView46from lp.translations.browser.potemplate import BaseSeriesTemplatesView
47from lp.translations.browser.translations import TranslationsMixin47from lp.translations.browser.translations import TranslationsMixin
4848
=== modified file 'lib/lp/translations/browser/serieslanguage.py'
--- lib/lp/translations/browser/serieslanguage.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/serieslanguage.py 2010-09-02 12:57:56 +0000
@@ -12,12 +12,12 @@
12 'ProductSeriesLanguageView',12 'ProductSeriesLanguageView',
13 ]13 ]
1414
15from canonical.cachedproperty import cachedproperty
16from canonical.launchpad.readonly import is_read_only15from canonical.launchpad.readonly import is_read_only
17from canonical.launchpad.webapp import LaunchpadView16from canonical.launchpad.webapp import LaunchpadView
18from canonical.launchpad.webapp.batching import BatchNavigator17from canonical.launchpad.webapp.batching import BatchNavigator
19from canonical.launchpad.webapp.publisher import Navigation18from canonical.launchpad.webapp.publisher import Navigation
20from canonical.launchpad.webapp.tales import PersonFormatterAPI19from canonical.launchpad.webapp.tales import PersonFormatterAPI
20from lp.services.propertycache import cachedproperty
21from lp.translations.interfaces.distroserieslanguage import (21from lp.translations.interfaces.distroserieslanguage import (
22 IDistroSeriesLanguage,22 IDistroSeriesLanguage,
23 )23 )
2424
=== modified file 'lib/lp/translations/browser/translationmessage.py'
--- lib/lp/translations/browser/translationmessage.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/translationmessage.py 2010-09-02 12:57:56 +0000
@@ -37,7 +37,6 @@
37from zope.interface import implements37from zope.interface import implements
38from zope.schema.vocabulary import getVocabularyRegistry38from zope.schema.vocabulary import getVocabularyRegistry
3939
40from canonical.cachedproperty import cachedproperty
41from canonical.launchpad.webapp import (40from canonical.launchpad.webapp import (
42 ApplicationMenu,41 ApplicationMenu,
43 canonical_url,42 canonical_url,
@@ -50,6 +49,7 @@
50from canonical.launchpad.webapp.interfaces import ILaunchBag49from canonical.launchpad.webapp.interfaces import ILaunchBag
51from canonical.launchpad.webapp.menu import structured50from canonical.launchpad.webapp.menu import structured
52from lp.app.errors import UnexpectedFormData51from lp.app.errors import UnexpectedFormData
52from lp.services.propertycache import cachedproperty
53from lp.translations.browser.browser_helpers import (53from lp.translations.browser.browser_helpers import (
54 contract_rosetta_escapes,54 contract_rosetta_escapes,
55 convert_newlines_to_web_form,55 convert_newlines_to_web_form,
5656
=== modified file 'lib/lp/translations/browser/translations.py'
--- lib/lp/translations/browser/translations.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/translations.py 2010-09-02 12:57:56 +0000
@@ -17,7 +17,6 @@
1717
18from zope.component import getUtility18from zope.component import getUtility
1919
20from canonical.cachedproperty import cachedproperty
21from canonical.config import config20from canonical.config import config
22from canonical.launchpad import helpers21from canonical.launchpad import helpers
23from canonical.launchpad.interfaces.geoip import IRequestPreferredLanguages22from canonical.launchpad.interfaces.geoip import IRequestPreferredLanguages
@@ -36,6 +35,7 @@
36from canonical.launchpad.webapp.interfaces import ILaunchpadRoot35from canonical.launchpad.webapp.interfaces import ILaunchpadRoot
37from lp.registry.interfaces.person import IPersonSet36from lp.registry.interfaces.person import IPersonSet
38from lp.registry.interfaces.product import IProductSet37from lp.registry.interfaces.product import IProductSet
38from lp.services.propertycache import cachedproperty
39from lp.services.worlddata.interfaces.country import ICountry39from lp.services.worlddata.interfaces.country import ICountry
40from lp.translations.publisher import TranslationsLayer40from lp.translations.publisher import TranslationsLayer
4141
4242
=== modified file 'lib/lp/translations/model/pofile.py'
--- lib/lp/translations/model/pofile.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/model/pofile.py 2010-09-02 12:57:56 +0000
@@ -44,7 +44,6 @@
44from zope.interface import implements44from zope.interface import implements
45from zope.security.proxy import removeSecurityProxy45from zope.security.proxy import removeSecurityProxy
4646
47from canonical.cachedproperty import cachedproperty
48from canonical.database.constants import UTC_NOW47from canonical.database.constants import UTC_NOW
49from canonical.database.datetimecol import UtcDateTimeCol48from canonical.database.datetimecol import UtcDateTimeCol
50from canonical.database.sqlbase import (49from canonical.database.sqlbase import (
@@ -66,6 +65,7 @@
66from canonical.launchpad.webapp.publisher import canonical_url65from canonical.launchpad.webapp.publisher import canonical_url
67from lp.registry.interfaces.person import validate_public_person66from lp.registry.interfaces.person import validate_public_person
68from lp.registry.model.person import Person67from lp.registry.model.person import Person
68from lp.services.propertycache import cachedproperty
69from lp.translations.interfaces.pofile import (69from lp.translations.interfaces.pofile import (
70 IPOFile,70 IPOFile,
71 IPOFileSet,71 IPOFileSet,
7272
=== modified file 'lib/lp/translations/model/potemplate.py'
--- lib/lp/translations/model/potemplate.py 2010-08-24 21:02:12 +0000
+++ lib/lp/translations/model/potemplate.py 2010-09-02 12:57:56 +0000
@@ -48,7 +48,6 @@
48from zope.interface import implements48from zope.interface import implements
49from zope.security.proxy import removeSecurityProxy49from zope.security.proxy import removeSecurityProxy
5050
51from canonical.cachedproperty import cachedproperty
52from canonical.database.constants import DEFAULT51from canonical.database.constants import DEFAULT
53from canonical.database.datetimecol import UtcDateTimeCol52from canonical.database.datetimecol import UtcDateTimeCol
54from canonical.database.enumcol import EnumCol53from canonical.database.enumcol import EnumCol
@@ -70,6 +69,7 @@
70from lp.registry.model.sourcepackagename import SourcePackageName69from lp.registry.model.sourcepackagename import SourcePackageName
71from lp.services.database.collection import Collection70from lp.services.database.collection import Collection
72from lp.services.database.prejoin import prejoin71from lp.services.database.prejoin import prejoin
72from lp.services.propertycache import cachedproperty
73from lp.services.worlddata.model.language import Language73from lp.services.worlddata.model.language import Language
74from lp.translations.interfaces.pofile import IPOFileSet74from lp.translations.interfaces.pofile import IPOFileSet
75from lp.translations.interfaces.potemplate import (75from lp.translations.interfaces.potemplate import (
7676
=== modified file 'lib/lp/translations/model/translationmessage.py'
--- lib/lp/translations/model/translationmessage.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/model/translationmessage.py 2010-09-02 12:57:56 +0000
@@ -24,7 +24,6 @@
24from storm.store import Store24from storm.store import Store
25from zope.interface import implements25from zope.interface import implements
2626
27from canonical.cachedproperty import cachedproperty
28from canonical.database.constants import (27from canonical.database.constants import (
29 DEFAULT,28 DEFAULT,
30 UTC_NOW,29 UTC_NOW,
@@ -37,6 +36,7 @@
37 sqlvalues,36 sqlvalues,
38 )37 )
39from lp.registry.interfaces.person import validate_public_person38from lp.registry.interfaces.person import validate_public_person
39from lp.services.propertycache import cachedproperty
40from lp.translations.interfaces.translationmessage import (40from lp.translations.interfaces.translationmessage import (
41 ITranslationMessage,41 ITranslationMessage,
42 ITranslationMessageSet,42 ITranslationMessageSet,
4343
=== modified file 'lib/lp/translations/utilities/translation_import.py'
--- lib/lp/translations/utilities/translation_import.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/utilities/translation_import.py 2010-09-02 12:57:56 +0000
@@ -21,7 +21,6 @@
21from zope.component import getUtility21from zope.component import getUtility
22from zope.interface import implements22from zope.interface import implements
2323
24from canonical.cachedproperty import cachedproperty
25from canonical.config import config24from canonical.config import config
26from canonical.database.sqlbase import (25from canonical.database.sqlbase import (
27 cursor,26 cursor,
@@ -33,6 +32,7 @@
33 IPersonSet,32 IPersonSet,
34 PersonCreationRationale,33 PersonCreationRationale,
35 )34 )
35from lp.services.propertycache import cachedproperty
36from lp.translations.interfaces.translationexporter import (36from lp.translations.interfaces.translationexporter import (
37 ITranslationExporter,37 ITranslationExporter,
38 )38 )
3939
=== modified file 'utilities/sourcedeps.conf'
--- utilities/sourcedeps.conf 2010-08-30 00:51:55 +0000
+++ utilities/sourcedeps.conf 2010-09-02 12:57:56 +0000
@@ -14,4 +14,4 @@
14subvertpy lp:~launchpad-pqm/subvertpy/trunk;revno=204214subvertpy lp:~launchpad-pqm/subvertpy/trunk;revno=2042
15python-debian lp:~launchpad-pqm/python-debian/devel;revno=18515python-debian lp:~launchpad-pqm/python-debian/devel;revno=185
16testresources lp:~launchpad-pqm/testresources/dev;revno=1616testresources lp:~launchpad-pqm/testresources/dev;revno=16
17shipit lp:~launchpad-pqm/shipit/trunk;revno=8910 optional17shipit lp:~launchpad-pqm/shipit/trunk;revno=8911 optional