launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00731
[Merge] lp:~allenap/launchpad/cache-experiment-roll-out into lp:launchpad/devel
Gavin Panella has proposed merging lp:~allenap/launchpad/cache-experiment-roll-out into lp:launchpad/devel with lp:~allenap/launchpad/cache-experiment as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#623421 Implement new cachedproperty API
https://bugs.launchpad.net/bugs/623421
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.
--
https://code.launchpad.net/~allenap/launchpad/cache-experiment-roll-out/+merge/33542
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/cache-experiment-roll-out into lp:launchpad/devel.
=== 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 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Cached properties for situations where a property is computed once and
-then returned each time it is asked for.
-
-The clear_cachedproperties function can be used to wipe the cache of properties
-from an instance.
-"""
-
-__metaclass__ = type
-
-__all__ = [
- 'cache_property',
- 'cachedproperty',
- 'clear_cachedproperties',
- 'clear_property',
- ]
-
-from zope.security.proxy import removeSecurityProxy
-
-from canonical.lazr.utils import safe_hasattr
-
-# XXX: JonathanLange 2010-01-11 bug=505731: Move this to lp.services.
-
-def cachedproperty(attrname_or_fn):
- """A decorator for methods that makes them properties with their return
- value cached.
-
- The value is cached on the instance, using the attribute name provided.
-
- If you don't provide a name, the mangled name of the property is used.
-
- cachedproperty is not threadsafe - it should not be used on objects which
- are shared across threads / external locking should be used on those
- objects.
-
- >>> class CachedPropertyTest(object):
- ...
- ... @cachedproperty('_foo_cache')
- ... def foo(self):
- ... print 'foo computed'
- ... return 23
- ...
- ... @cachedproperty
- ... def bar(self):
- ... print 'bar computed'
- ... return 69
-
- >>> cpt = CachedPropertyTest()
- >>> getattr(cpt, '_foo_cache', None) is None
- True
- >>> cpt.foo
- foo computed
- 23
- >>> cpt.foo
- 23
- >>> cpt._foo_cache
- 23
- >>> cpt.bar
- bar computed
- 69
- >>> cpt._bar_cached_value
- 69
-
- Cached properties are listed on instances.
- >>> sorted(cpt._cached_properties)
- ['_bar_cached_value', '_foo_cache']
-
- """
- if isinstance(attrname_or_fn, basestring):
- attrname = attrname_or_fn
- return CachedPropertyForAttr(attrname)
- else:
- fn = attrname_or_fn
- attrname = '_%s_cached_value' % fn.__name__
- return CachedProperty(attrname, fn)
-
-def cache_property(instance, attrname, value):
- """Cache value on instance as attrname.
-
- instance._cached_properties is updated with attrname.
-
- >>> class CachedPropertyTest(object):
- ...
- ... @cachedproperty('_foo_cache')
- ... def foo(self):
- ... return 23
- ...
- >>> instance = CachedPropertyTest()
- >>> cache_property(instance, '_foo_cache', 42)
- >>> instance.foo
- 42
- >>> instance._cached_properties
- ['_foo_cache']
-
- Caching a new value does not duplicate the cache keys.
-
- >>> cache_property(instance, '_foo_cache', 84)
- >>> instance._cached_properties
- ['_foo_cache']
-
- And does update the cached value.
-
- >>> instance.foo
- 84
- """
- naked_instance = removeSecurityProxy(instance)
- clear_property(naked_instance, attrname)
- setattr(naked_instance, attrname, value)
- cached_properties = getattr(naked_instance, '_cached_properties', [])
- cached_properties.append(attrname)
- naked_instance._cached_properties = cached_properties
-
-
-def clear_property(instance, attrname):
- """Remove a cached attribute from instance.
-
- The attribute name is removed from instance._cached_properties.
-
- If the property is not cached, nothing happens.
-
- :seealso clear_cachedproperties: For clearing all cached items at once.
-
- >>> class CachedPropertyTest(object):
- ...
- ... @cachedproperty('_foo_cache')
- ... def foo(self):
- ... return 23
- ...
- >>> instance = CachedPropertyTest()
- >>> instance.foo
- 23
- >>> clear_property(instance, '_foo_cache')
- >>> instance._cached_properties
- []
- >>> is_cached(instance, '_foo_cache')
- False
- >>> clear_property(instance, '_foo_cache')
- """
- naked_instance = removeSecurityProxy(instance)
- if not is_cached(naked_instance, attrname):
- return
- delattr(naked_instance, attrname)
- naked_instance._cached_properties.remove(attrname)
-
-
-def clear_cachedproperties(instance):
- """Clear cached properties from an object.
-
- >>> class CachedPropertyTest(object):
- ...
- ... @cachedproperty('_foo_cache')
- ... def foo(self):
- ... return 23
- ...
- >>> instance = CachedPropertyTest()
- >>> instance.foo
- 23
- >>> instance._cached_properties
- ['_foo_cache']
- >>> clear_cachedproperties(instance)
- >>> instance._cached_properties
- []
- >>> hasattr(instance, '_foo_cache')
- False
- """
- naked_instance = removeSecurityProxy(instance)
- cached_properties = getattr(naked_instance, '_cached_properties', [])
- for property_name in cached_properties:
- delattr(naked_instance, property_name)
- naked_instance._cached_properties = []
-
-
-def is_cached(instance, attrname):
- """Return True if attrname is cached on instance.
-
- >>> class CachedPropertyTest(object):
- ...
- ... @cachedproperty('_foo_cache')
- ... def foo(self):
- ... return 23
- ...
- >>> instance = CachedPropertyTest()
- >>> instance.foo
- 23
- >>> is_cached(instance, '_foo_cache')
- True
- >>> is_cached(instance, '_var_cache')
- False
- """
- naked_instance = removeSecurityProxy(instance)
- return safe_hasattr(naked_instance, attrname)
-
-
-class CachedPropertyForAttr:
- """Curry a decorator to provide arguments to the CachedProperty."""
-
- def __init__(self, attrname):
- self.attrname = attrname
-
- def __call__(self, fn):
- return CachedProperty(self.attrname, fn)
-
-
-class CachedProperty:
-
- # Used to detect not-yet-cached properties.
- sentinel = object()
-
- def __init__(self, attrname, fn):
- self.fn = fn
- self.attrname = attrname
-
- def __get__(self, inst, cls=None):
- if inst is None:
- return self
- cachedresult = getattr(inst, self.attrname, CachedProperty.sentinel)
- if cachedresult is CachedProperty.sentinel:
- result = self.fn(inst)
- cache_property(inst, self.attrname, result)
- return result
- else:
- return cachedresult
-
-
-if __name__ == '__main__':
- import doctest
- doctest.testmod()
=== modified file 'lib/canonical/database/sqlbase.py'
--- lib/canonical/database/sqlbase.py 2010-08-24 15:58:28 +0000
+++ lib/canonical/database/sqlbase.py 2010-08-24 15:58:30 +0000
@@ -65,7 +65,6 @@
from zope.interface import implements
from zope.security.proxy import removeSecurityProxy
-from canonical.cachedproperty import clear_cachedproperties
from canonical.config import (
config,
dbconfig,
@@ -73,7 +72,6 @@
from canonical.database.interfaces import ISQLBase
from lp.services.propertycache import IPropertyCacheManager
-
# Default we want for scripts, and the PostgreSQL default. Note psycopg1 will
# use SERIALIZABLE unless we override, but psycopg2 will not.
ISOLATION_LEVEL_DEFAULT = ISOLATION_LEVEL_READ_COMMITTED
@@ -271,10 +269,6 @@
# XXX: RobertCollins 2010-08-16 bug=622648: Note this is not directly
# tested, but the entire test suite blows up awesomely if it's broken.
# It's entirely unclear where tests for this should be.
-
- # While canonical.cachedproperty and lp.services.propertycache are
- # both in use, we must clear the caches for both.
- clear_cachedproperties(self)
IPropertyCacheManager(self).clear()
=== 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-08-24 15:58:30 +0000
@@ -53,7 +53,6 @@
from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest
from zope.security.interfaces import Unauthorized
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad.helpers import intOrZero
from canonical.launchpad.interfaces.account import AccountStatus
@@ -142,6 +141,7 @@
)
from lp.registry.interfaces.projectgroup import IProjectGroupSet
from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
+from lp.services.propertycache import cachedproperty
from lp.services.worlddata.interfaces.country import ICountrySet
from lp.services.worlddata.interfaces.language import ILanguageSet
from lp.soyuz.interfaces.binarypackagename import IBinaryPackageNameSet
=== 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-08-24 15:58:30 +0000
@@ -15,7 +15,6 @@
from zope.i18n.interfaces import IUserPreferredLanguages
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad.components.request_country import (
ipaddress_from_request,
@@ -26,6 +25,7 @@
IRequestLocalLanguages,
IRequestPreferredLanguages,
)
+from lp.services.propertycache import cachedproperty
from lp.services.worlddata.interfaces.country import ICountrySet
from lp.services.worlddata.interfaces.language import ILanguageSet
=== 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-08-24 15:58:30 +0000
@@ -22,7 +22,6 @@
from zope.exceptions.exceptionformatter import format_exception
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
import canonical.launchpad.layers
from canonical.launchpad.webapp.adapter import (
@@ -31,6 +30,7 @@
)
from canonical.launchpad.webapp.interfaces import ILaunchBag
from canonical.launchpad.webapp.publisher import LaunchpadView
+from lp.services.propertycache import cachedproperty
class SystemErrorView(LaunchpadView):
=== 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-08-24 15:58:30 +0000
@@ -42,7 +42,6 @@
ISession,
)
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad import _
from canonical.launchpad.interfaces.account import AccountSuspendedError
@@ -65,6 +64,7 @@
IPersonSet,
PersonCreationRationale,
)
+from lp.services.propertycache import cachedproperty
class UnauthorizedView(SystemErrorView):
=== modified file 'lib/canonical/launchpad/webapp/servers.py'
--- lib/canonical/launchpad/webapp/servers.py 2010-08-20 20:31:18 +0000
+++ lib/canonical/launchpad/webapp/servers.py 2010-08-24 15:58:30 +0000
@@ -61,7 +61,6 @@
from zope.server.http.wsgihttpserver import PMDBWSGIHTTPServer
from zope.session.interfaces import ISession
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad.interfaces.launchpad import (
IFeedsApplication,
@@ -116,6 +115,7 @@
from canonical.lazr.timeout import set_default_timeout_function
from lp.app.errors import UnexpectedFormData
from lp.services.features.flags import NullFeatureController
+from lp.services.propertycache import cachedproperty
from lp.testopenid.interfaces.server import ITestOpenIDApplication
=== 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-08-24 15:58:30 +0000
@@ -17,32 +17,41 @@
'MINUTES',
]
-from BeautifulSoup import BeautifulSoup
from datetime import datetime
-import pytz
import operator
import os
import time
from urlparse import urljoin
from xml.sax.saxutils import escape as xml_escape
+from BeautifulSoup import BeautifulSoup
+import pytz
+from z3c.ptcompat import ViewPageTemplateFile
+from zope.component import getUtility
from zope.datetime import rfc1123_date
-from zope.component import getUtility
from zope.interface import implements
-from z3c.ptcompat import ViewPageTemplateFile
-
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
# XXX: bac 2007-09-20 bug=153795: modules in canonical.lazr should not import
# from canonical.launchpad, but we're doing it here as an expediency to get a
# working prototype.
from canonical.launchpad.interfaces import ILaunchpadRoot
from canonical.launchpad.webapp import (
- LaunchpadView, canonical_url, urlappend, urlparse)
+ canonical_url,
+ LaunchpadView,
+ urlappend,
+ urlparse,
+ )
from canonical.launchpad.webapp.vhosts import allvhosts
from canonical.lazr.interfaces import (
- IFeed, IFeedEntry, IFeedPerson, IFeedTypedData, UnsupportedFeedFormat)
+ IFeed,
+ IFeedEntry,
+ IFeedPerson,
+ IFeedTypedData,
+ UnsupportedFeedFormat,
+ )
+from lp.services.propertycache import cachedproperty
+
SUPPORTED_FEEDS = ('.atom', '.html')
MINUTES = 60 # Seconds in a minute.
=== 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 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-from doctest import DocTestSuite, ELLIPSIS
-import unittest
-
-import canonical.cachedproperty
-
-def test_suite():
- suite = DocTestSuite(canonical.cachedproperty, optionflags=ELLIPSIS)
- return suite
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
=== 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-08-24 15:58:30 +0000
@@ -7,18 +7,19 @@
__metaclass__ = type
+import cgi
import os
-import cgi
+
import simplejson
-
+from z3c.ptcompat import ViewPageTemplateFile
+from zope.app.form.browser.itemswidgets import (
+ ItemsWidgetBase,
+ SingleDataHelper,
+ )
from zope.schema.interfaces import IChoice
-from zope.app.form.browser.itemswidgets import (
- ItemsWidgetBase, SingleDataHelper)
-
-from z3c.ptcompat import ViewPageTemplateFile
from canonical.launchpad.webapp import canonical_url
-from canonical.cachedproperty import cachedproperty
+from lp.services.propertycache import cachedproperty
class VocabularyPickerWidget(SingleDataHelper, ItemsWidgetBase):
=== 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-08-24 15:58:30 +0000
@@ -12,7 +12,6 @@
from urllib import urlencode
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
action,
@@ -34,6 +33,7 @@
)
from lp.answers.interfaces.questionenums import QuestionSort
from lp.registry.interfaces.projectgroup import IProjectGroup
+from lp.services.propertycache import cachedproperty
class FAQCollectionMenu(NavigationMenu):
=== 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-08-24 15:58:30 +0000
@@ -55,7 +55,6 @@
)
import zope.security
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.helpers import (
is_english_variant,
@@ -116,6 +115,7 @@
UnexpectedFormData,
)
from lp.registry.interfaces.projectgroup import IProjectGroup
+from lp.services.propertycache import cachedproperty
class QuestionLinksMixin:
=== modified file 'lib/lp/answers/browser/questiontarget.py'
--- lib/lp/answers/browser/questiontarget.py 2010-08-20 20:31:18 +0000
+++ lib/lp/answers/browser/questiontarget.py 2010-08-24 15:58:30 +0000
@@ -42,7 +42,6 @@
SimpleVocabulary,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.helpers import (
browserLanguages,
@@ -81,6 +80,7 @@
from lp.registry.interfaces.distribution import IDistribution
from lp.registry.interfaces.projectgroup import IProjectGroup
from lp.services.fields import PublicPersonChoice
+from lp.services.propertycache import cachedproperty
from lp.services.worlddata.interfaces.language import ILanguageSet
=== 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-08-24 15:58:30 +0000
@@ -10,7 +10,6 @@
import os
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad.mail import (
format_address,
@@ -21,6 +20,7 @@
from lp.registry.interfaces.person import IPerson
from lp.services.mail.mailwrapper import MailWrapper
from lp.services.mail.notificationrecipientset import NotificationRecipientSet
+from lp.services.propertycache import cachedproperty
def get_email_template(filename):
=== 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-08-24 15:58:30 +0000
@@ -20,7 +20,6 @@
from zope.schema.interfaces import TooLong
from zope.schema.vocabulary import getVocabularyRegistry
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad.interfaces.launchpad import (
ILaunchpadCelebrities,
@@ -54,6 +53,7 @@
from lp.registry.interfaces.person import IPersonSet
from lp.registry.interfaces.pillar import IPillarNameSet
from lp.registry.interfaces.product import IProductSet
+from lp.services.propertycache import cachedproperty
shipit_faq_url = 'http://www.ubuntu.com/getubuntu/shipit-faq'
=== 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-08-24 15:58:30 +0000
@@ -6,12 +6,12 @@
import os
import tempfile
-from canonical.cachedproperty import cachedproperty
from canonical.librarian.utils import (
copy_and_close,
sha1_from_path,
)
from lp.archivepublisher import HARDCODED_COMPONENT_ORDER
+from lp.services.propertycache import cachedproperty
from lp.soyuz.interfaces.publishing import (
MissingSymlinkInPool,
NotInPool,
=== 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-08-24 15:58:30 +0000
@@ -61,7 +61,6 @@
SimpleVocabulary,
)
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad import _
from canonical.launchpad.browser.launchpad import AppFrontPageSearchView
@@ -100,6 +99,7 @@
from lp.code.interfaces.branchnamespace import IBranchNamespaceSet
from lp.registry.interfaces.distribution import IDistribution
from lp.registry.interfaces.product import IProduct
+from lp.services.propertycache import cachedproperty
class NewSpecificationView(LaunchpadFormView):
=== 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-08-24 15:58:30 +0000
@@ -12,7 +12,6 @@
from zope.component import getUtility
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp import (
canonical_url,
LaunchpadView,
@@ -20,6 +19,7 @@
from canonical.launchpad.webapp.interfaces import ILaunchBag
from lp.blueprints.browser.specificationtarget import HasSpecificationsView
from lp.blueprints.interfaces.specification import SpecificationFilter
+from lp.services.propertycache import cachedproperty
class GoalDecideView(HasSpecificationsView, LaunchpadView):
=== 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-08-24 15:58:30 +0000
@@ -17,7 +17,6 @@
from zope.component import queryMultiAdapter
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad import _
from canonical.launchpad.helpers import shortlist
@@ -48,6 +47,7 @@
IProjectGroup,
IProjectGroupSeries,
)
+from lp.services.propertycache import cachedproperty
class HasSpecificationsMenuMixin:
=== 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-08-24 15:58:30 +0000
@@ -30,7 +30,6 @@
from zope.component import getUtility
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.helpers import shortlist
from canonical.launchpad.webapp import (
@@ -71,6 +70,7 @@
IRegistryCollectionNavigationMenu,
RegistryCollectionActionMenuBase,
)
+from lp.services.propertycache import cachedproperty
class SprintFacets(StandardLaunchpadFacets):
=== modified file 'lib/lp/bugs/browser/bug.py'
--- lib/lp/bugs/browser/bug.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/browser/bug.py 2010-08-24 15:58:30 +0000
@@ -63,7 +63,6 @@
from zope.schema.interfaces import IText
from zope.security.interfaces import Unauthorized
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.browser.librarian import ProxiedLibraryFileAlias
from canonical.launchpad.mailnotification import MailWrapper
@@ -115,6 +114,7 @@
from lp.bugs.interfaces.cve import ICveSet
from lp.bugs.mail.bugnotificationbuilder import format_rfc2822_date
from lp.services.fields import DuplicateBug
+from lp.services.propertycache import cachedproperty
class BugNavigation(Navigation):
=== 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-08-24 15:58:30 +0000
@@ -29,7 +29,6 @@
SimpleVocabulary,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.browser.multistep import (
MultiStepView,
@@ -85,6 +84,7 @@
License,
)
from lp.services.fields import StrippedTextLine
+from lp.services.propertycache import cachedproperty
class BugAlsoAffectsProductMetaView(MultiStepView):
=== 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-08-24 15:58:30 +0000
@@ -22,7 +22,6 @@
Interface,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
action,
@@ -38,6 +37,7 @@
latest_proposals_for_each_branch,
)
from lp.code.enums import BranchLifecycleStatus
+from lp.services.propertycache import cachedproperty
class BugBranchPrimaryContext:
=== 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-08-24 15:58:30 +0000
@@ -50,7 +50,6 @@
from zope.schema.vocabulary import SimpleVocabulary
from zope.security.proxy import removeSecurityProxy
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad import _
from canonical.launchpad.browser.feeds import (
@@ -137,6 +136,7 @@
from lp.registry.interfaces.sourcepackage import ISourcePackage
from lp.registry.vocabularies import ValidPersonOrTeamVocabulary
from lp.services.job.interfaces.job import JobStatus
+from lp.services.propertycache import cachedproperty
# A simple vocabulary for the subscribe_to_existing_bug form field.
SUBSCRIBE_TO_BUG_VOCABULARY = SimpleVocabulary.fromItems(
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2010-08-22 18:31:30 +0000
+++ lib/lp/bugs/browser/bugtask.py 2010-08-24 15:58:30 +0000
@@ -125,7 +125,6 @@
)
from zope.traversing.interfaces import IPathAdapter
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.database.sqlbase import cursor
from canonical.launchpad import (
@@ -260,6 +259,7 @@
from lp.registry.interfaces.sourcepackage import ISourcePackage
from lp.registry.vocabularies import MilestoneVocabulary
from lp.services.fields import PersonChoice
+from lp.services.propertycache import cachedproperty
@component.adapter(IBugTask, IReferenceChoice, IWebServiceClientRequest)
=== modified file 'lib/lp/bugs/browser/bugtracker.py'
--- lib/lp/bugs/browser/bugtracker.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/browser/bugtracker.py 2010-08-24 15:58:30 +0000
@@ -28,7 +28,6 @@
from zope.schema import Choice
from zope.schema.vocabulary import SimpleVocabulary
-from canonical.cachedproperty import cachedproperty
from canonical.database.sqlbase import flush_database_updates
from canonical.launchpad import _
from canonical.launchpad.helpers import (
@@ -68,6 +67,7 @@
IBugTrackerSet,
IRemoteBug,
)
+from lp.services.propertycache import cachedproperty
# A set of bug tracker types for which there can only ever be one bug
# tracker.
=== 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-08-24 15:58:30 +0000
@@ -11,7 +11,6 @@
from zope.component import getUtility
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.helpers import shortlist
from canonical.launchpad.searchbuilder import any
from canonical.launchpad.webapp import LaunchpadView
@@ -23,6 +22,7 @@
UNRESOLVED_BUGTASK_STATUSES,
)
from lp.bugs.interfaces.cve import ICveSet
+from lp.services.propertycache import cachedproperty
class BugTaskCve:
=== 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-08-24 15:58:30 +0000
@@ -11,13 +11,13 @@
from operator import attrgetter
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp.publisher import (
canonical_url,
LaunchpadView,
)
from canonical.launchpad.webapp.url import urlappend
from lp.bugs.browser.bugtask import get_buglisting_search_filter_url
+from lp.services.propertycache import cachedproperty
# TODO: fix column sorting to work for the different colspans, or
# alternatively implement a sort option box.
=== 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-08-24 15:58:30 +0000
@@ -18,7 +18,6 @@
SoupStrainer,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp.url import urlparse
from lp.bugs.externalbugtracker import (
BugNotFound,
@@ -37,6 +36,7 @@
BugTaskStatus,
)
from lp.bugs.interfaces.externalbugtracker import UNKNOWN_REMOTE_IMPORTANCE
+from lp.services.propertycache import cachedproperty
class MantisLoginHandler(urllib2.HTTPRedirectHandler):
=== 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-08-24 15:58:30 +0000
@@ -10,7 +10,6 @@
import urllib
import urllib2
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad.webapp.url import urlparse
from lp.bugs.externalbugtracker import (
@@ -24,6 +23,7 @@
from lp.bugs.externalbugtracker.isolation import ensure_no_transaction
from lp.bugs.interfaces.bugtask import BugTaskStatus
from lp.bugs.interfaces.externalbugtracker import UNKNOWN_REMOTE_IMPORTANCE
+from lp.services.propertycache import cachedproperty
class RequestTracker(ExternalBugTracker):
=== 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 15:58:30 +0000
@@ -70,10 +70,6 @@
providedBy,
)
-from canonical.cachedproperty import (
- cachedproperty,
- clear_property,
- )
from canonical.config import config
from canonical.database.constants import UTC_NOW
from canonical.database.datetimecol import UtcDateTimeCol
@@ -186,6 +182,10 @@
)
from lp.registry.model.pillar import pillar_sort_key
from lp.services.fields import DuplicateBug
+from lp.services.propertycache import (
+ cachedproperty,
+ IPropertyCache,
+ )
_bug_tag_query_template = """
@@ -633,7 +633,7 @@
# disabled see the change.
store.flush()
self.updateHeat()
- clear_property(self, '_cached_viewers')
+ del IPropertyCache(self)._known_viewers
return
def unsubscribeFromDupes(self, person, unsubscribed_by):
@@ -1626,7 +1626,7 @@
self, self.messages[comment_number])
bug_message.visible = visible
- @cachedproperty('_cached_viewers')
+ @cachedproperty
def _known_viewers(self):
"""A dict of of known persons able to view this bug."""
return set()
=== 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 15:58:30 +0000
@@ -21,7 +21,10 @@
import datetime
-from operator import attrgetter, itemgetter
+from operator import (
+ attrgetter,
+ itemgetter,
+ )
from lazr.enum import DBItem
import pytz
@@ -59,7 +62,6 @@
removeSecurityProxy,
)
-from canonical.cachedproperty import cache_property
from canonical.config import config
from canonical.database.constants import UTC_NOW
from canonical.database.datetimecol import UtcDateTimeCol
@@ -74,7 +76,9 @@
SQLBase,
sqlvalues,
)
-from canonical.launchpad.components.decoratedresultset import DecoratedResultSet
+from canonical.launchpad.components.decoratedresultset import (
+ DecoratedResultSet,
+ )
from canonical.launchpad.helpers import shortlist
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.interfaces.lpstorm import IStore
@@ -153,6 +157,7 @@
from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
from lp.registry.model.pillar import pillar_sort_key
from lp.registry.model.sourcepackagename import SourcePackageName
+from lp.services.propertycache import IPropertyCache
from lp.soyuz.interfaces.publishing import PackagePublishingStatus
from lp.soyuz.model.publishing import SourcePackagePublishingHistory
from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
@@ -1324,7 +1329,7 @@
"""
userid = user.id
def cache_user_can_view_bug(bugtask):
- cache_property(bugtask.bug, '_cached_viewers', set([userid]))
+ IPropertyCache(bugtask.bug)._known_viewers = set([userid])
return bugtask
return cache_user_can_view_bug
=== 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-08-24 15:58:30 +0000
@@ -38,7 +38,6 @@
from zope.interface import implements
from canonical.buildd.slave import BuilderStatus
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.database.sqlbase import (
SQLBase,
@@ -80,6 +79,7 @@
from lp.services.job.interfaces.job import JobStatus
from lp.services.job.model.job import Job
from lp.services.osutils import until_no_eintr
+from lp.services.propertycache import cachedproperty
# XXX Michael Nelson 2010-01-13 bug=491330
# These dependencies on soyuz will be removed when getBuildRecords()
# is moved.
=== modified file 'lib/lp/code/browser/bazaar.py'
--- lib/lp/code/browser/bazaar.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/browser/bazaar.py 2010-08-24 15:58:30 +0000
@@ -15,7 +15,6 @@
import bzrlib
from zope.component import getUtility
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad.webapp import (
canonical_url,
@@ -32,6 +31,7 @@
from lp.code.interfaces.branchcollection import IAllBranches
from lp.code.interfaces.codeimport import ICodeImportSet
from lp.registry.interfaces.product import IProductSet
+from lp.services.propertycache import cachedproperty
class BazaarApplicationView(LaunchpadView):
=== 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-08-24 15:58:30 +0000
@@ -72,7 +72,6 @@
)
from zope.traversing.interfaces import IPathAdapter
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.database.constants import UTC_NOW
from canonical.launchpad import _
@@ -145,6 +144,7 @@
)
from lp.registry.interfaces.productseries import IProductSeries
from lp.registry.vocabularies import UserTeamsParticipationPlusSelfVocabulary
+from lp.services.propertycache import cachedproperty
def quote(text):
=== 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-08-24 15:58:30 +0000
@@ -52,7 +52,6 @@
)
from zope.schema import Choice
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad import _
from canonical.launchpad.browser.feeds import (
@@ -131,6 +130,7 @@
from lp.registry.interfaces.sourcepackage import ISourcePackageFactory
from lp.registry.model.sourcepackage import SourcePackage
from lp.services.browser_helpers import get_plural_text
+from lp.services.propertycache import cachedproperty
class CodeVHostBreadcrumb(Breadcrumb):
=== 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-08-24 15:58:30 +0000
@@ -68,7 +68,6 @@
SimpleVocabulary,
)
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad import _
from canonical.launchpad.interfaces.message import IMessageSet
@@ -122,6 +121,7 @@
Summary,
Whiteboard,
)
+from lp.services.propertycache import cachedproperty
def latest_proposals_for_each_branch(proposals):
=== 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-08-24 15:58:30 +0000
@@ -29,7 +29,6 @@
)
from zope.schema import Choice
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad import _
from canonical.launchpad.webapp import (
@@ -53,6 +52,7 @@
IBranchMergeProposalListingBatchNavigator,
)
from lp.code.interfaces.hasbranches import IHasMergeProposals
+from lp.services.propertycache import cachedproperty
class BranchMergeProposalListingItem:
=== 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-08-24 15:58:30 +0000
@@ -22,7 +22,6 @@
SimpleVocabulary,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
action,
@@ -42,6 +41,7 @@
from lp.code.interfaces.branchvisibilitypolicy import (
IBranchVisibilityTeamPolicy,
)
+from lp.services.propertycache import cachedproperty
class BaseBranchVisibilityTeamPolicyView(LaunchpadFormView):
=== 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-08-24 15:58:30 +0000
@@ -29,7 +29,6 @@
from zope.interface import Interface
from zope.schema import Choice
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.webapp import (
@@ -75,6 +74,7 @@
from lp.code.interfaces.codeimportmachine import ICodeImportMachineSet
from lp.registry.interfaces.product import IProduct
from lp.services.fields import URIField
+from lp.services.propertycache import cachedproperty
class CodeImportSetNavigation(Navigation):
=== 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-08-24 15:58:30 +0000
@@ -19,7 +19,6 @@
from zope.interface import Interface
from zope.schema import TextLine
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
action,
@@ -35,6 +34,7 @@
)
from lp.code.interfaces.codeimportevent import ICodeImportEvent
from lp.code.interfaces.codeimportmachine import ICodeImportMachineSet
+from lp.services.propertycache import cachedproperty
class CodeImportMachineBreadcrumb(Breadcrumb):
=== 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-08-24 15:58:30 +0000
@@ -24,7 +24,6 @@
)
from zope.schema import Text
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad import _
from canonical.launchpad.interfaces import ILibraryFileAlias
@@ -41,6 +40,7 @@
from lp.code.interfaces.codereviewcomment import ICodeReviewComment
from lp.code.interfaces.codereviewvote import ICodeReviewVoteReference
from lp.services.comments.interfaces.conversation import IComment
+from lp.services.propertycache import cachedproperty
class CodeReviewDisplayComment:
=== 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-08-24 15:58:30 +0000
@@ -14,13 +14,13 @@
from lazr.delegates import delegates
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp.authorization import check_permission
from lp.bugs.interfaces.bug import IBug
from lp.code.interfaces.branch import (
BzrIdentityMixin,
IBranch,
)
+from lp.services.propertycache import cachedproperty
class DecoratedBug:
=== 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-08-24 15:58:30 +0000
@@ -9,13 +9,13 @@
]
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp.publisher import LaunchpadView
from lp.code.interfaces.branch import DEFAULT_BRANCH_STATUS_IN_LISTING
from lp.code.interfaces.branchcollection import IBranchCollection
from lp.code.interfaces.revisioncache import IRevisionCache
from lp.services.browser_helpers import get_plural_text
+from lp.services.propertycache import cachedproperty
class BranchCountSummaryView(LaunchpadView):
=== 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-08-24 15:58:30 +0000
@@ -24,7 +24,6 @@
from zope.interface import implements
from zope.security.interfaces import Unauthorized
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad.webapp import (
canonical_url,
@@ -49,6 +48,7 @@
from lp.registry.interfaces.person import IPerson
from lp.registry.interfaces.product import IProduct
from lp.registry.interfaces.projectgroup import IProjectGroup
+from lp.services.propertycache import cachedproperty
def revision_feed_id(revision):
=== 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-08-24 15:58:30 +0000
@@ -15,7 +15,6 @@
from sqlobject import ForeignKey
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.database.enumcol import EnumCol
from canonical.database.sqlbase import SQLBase
from canonical.launchpad.helpers import shortlist
@@ -27,6 +26,7 @@
from lp.registry.interfaces.person import validate_person
from lp.registry.interfaces.product import IProduct
from lp.registry.interfaces.projectgroup import IProjectGroup
+from lp.services.propertycache import cachedproperty
class BranchVisibilityTeamPolicy(SQLBase):
=== 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-08-24 15:58:30 +0000
@@ -45,7 +45,6 @@
import CVS
import SCM
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from lp.code.enums import RevisionControlSystems
from lp.codehosting.codeimport.foreigntree import (
@@ -57,6 +56,7 @@
extract_tarball,
)
from lp.codehosting.codeimport.uifactory import LoggingUIFactory
+from lp.services.propertycache import cachedproperty
class CodeImportWorkerExitCode:
=== 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-08-24 15:58:30 +0000
@@ -34,12 +34,12 @@
log,
)
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad.webapp import errorlog
from lp.code.interfaces.codehosting import LAUNCHPAD_SERVICES
from lp.codehosting.puller import get_lock_id_for_branch_id
from lp.codehosting.puller.worker import get_canonical_url_for_branch_name
+from lp.services.propertycache import cachedproperty
from lp.services.twistedsupport.processmonitor import (
ProcessMonitorProtocolWithTimeout,
)
=== 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-08-24 15:58:30 +0000
@@ -35,7 +35,7 @@
from canonical.lazr.xml import RelaxNGValidator
-from canonical.cachedproperty import cachedproperty
+from lp.services.propertycache import cachedproperty
from canonical.config import config
from canonical.librarian.interfaces import LibrarianServerError
from lp.hardwaredb.interfaces.hwdb import (
=== 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-08-24 15:58:30 +0000
@@ -26,7 +26,6 @@
TextLine,
)
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad import _
from canonical.launchpad.browser.feeds import (
@@ -58,6 +57,7 @@
Summary,
Title,
)
+from lp.services.propertycache import cachedproperty
class AnnouncementMenuMixin:
=== modified file 'lib/lp/registry/browser/distribution.py'
--- lib/lp/registry/browser/distribution.py 2010-08-23 09:10:10 +0000
+++ lib/lp/registry/browser/distribution.py 2010-08-24 15:58:30 +0000
@@ -44,7 +44,6 @@
from zope.lifecycleevent import ObjectCreatedEvent
from zope.security.interfaces import Unauthorized
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.browser.feeds import FeedsMixin
from canonical.launchpad.components.decoratedresultset import (
DecoratedResultSet,
@@ -108,6 +107,7 @@
)
from lp.registry.interfaces.product import IProduct
from lp.registry.interfaces.series import SeriesStatus
+from lp.services.propertycache import cachedproperty
from lp.soyuz.browser.packagesearch import PackageSearchViewBase
from lp.soyuz.interfaces.archive import (
ArchivePurpose,
=== 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-08-24 15:58:30 +0000
@@ -22,7 +22,6 @@
from zope.interface import implements
from zope.lifecycleevent import ObjectCreatedEvent
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
action,
@@ -40,6 +39,7 @@
from lp.registry.browser.objectreassignment import ObjectReassignmentView
from lp.registry.interfaces.distribution import IDistributionMirrorMenuMarker
from lp.registry.interfaces.distributionmirror import IDistributionMirror
+from lp.services.propertycache import cachedproperty
from lp.soyuz.browser.sourceslist import (
SourcesListEntries,
SourcesListEntriesView,
=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
--- lib/lp/registry/browser/distributionsourcepackage.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/distributionsourcepackage.py 2010-08-24 15:58:30 +0000
@@ -26,7 +26,6 @@
Interface,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp import (
action,
canonical_url,
@@ -60,6 +59,7 @@
IDistributionSourcePackage,
)
from lp.registry.interfaces.pocket import pocketsuffix
+from lp.services.propertycache import cachedproperty
from lp.soyuz.browser.sourcepackagerelease import (
extract_bug_numbers,
extract_email_addresses,
=== 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-08-24 15:58:30 +0000
@@ -27,7 +27,6 @@
SimpleVocabulary,
)
-from canonical.cachedproperty import cachedproperty
from canonical.database.constants import UTC_NOW
from canonical.launchpad import (
_,
@@ -72,6 +71,7 @@
)
from lp.registry.interfaces.distroseries import IDistroSeries
from lp.registry.interfaces.series import SeriesStatus
+from lp.services.propertycache import cachedproperty
from lp.services.worlddata.interfaces.country import ICountry
from lp.services.worlddata.interfaces.language import ILanguageSet
from lp.soyuz.browser.packagesearch import PackageSearchViewBase
=== 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-08-24 15:58:30 +0000
@@ -13,7 +13,6 @@
from zope.component import getUtility
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
action,
@@ -29,6 +28,7 @@
)
from lp.registry.interfaces.product import IProduct
from lp.registry.interfaces.projectgroup import IProjectGroup
+from lp.services.propertycache import cachedproperty
TOP_CONTRIBUTORS_LIMIT = 20
=== 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-08-24 15:58:30 +0000
@@ -20,7 +20,6 @@
from zope.interface import Interface
from zope.security.proxy import removeSecurityProxy
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
action,
@@ -37,6 +36,7 @@
MailingListStatus,
)
from lp.registry.interfaces.person import ITeam
+from lp.services.propertycache import cachedproperty
class ReviewForm(Interface):
=== 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-08-24 15:58:30 +0000
@@ -29,7 +29,6 @@
)
from zope.schema import Choice
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
action,
@@ -75,6 +74,7 @@
IProjectGroupMilestone,
)
from lp.registry.interfaces.product import IProduct
+from lp.services.propertycache import cachedproperty
class MilestoneSetNavigation(GetitemNavigation):
=== 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 15:58:30 +0000
@@ -141,7 +141,6 @@
from zope.security.interfaces import Unauthorized
from zope.security.proxy import removeSecurityProxy
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.database.sqlbase import flush_database_updates
from canonical.launchpad import (
@@ -304,6 +303,10 @@
)
from lp.services.openid.interfaces.openid import IOpenIDPersistentIdentity
from lp.services.openid.interfaces.openidrpsummary import IOpenIDRPSummarySet
+from lp.services.propertycache import (
+ cachedproperty,
+ IPropertyCache,
+ )
from lp.services.salesforce.interfaces import (
ISalesforceVoucherProxy,
SalesforceVoucherProxyException,
@@ -5693,10 +5696,7 @@
def _reset_state(self):
"""Reset the cache because the recipients changed."""
self._count_recipients = None
- if safe_hasattr(self, '_all_recipients_cached'):
- # The clear the cache of _all_recipients. The caching will fail
- # if this method creates the attribute before _all_recipients.
- del self._all_recipients_cached
+ del IPropertyCache(self)._all_recipients
def _getPrimaryReason(self, person_or_team):
"""Return the primary reason enumeration.
@@ -5804,7 +5804,7 @@
'You are contacting %s of the %s (%s) team directly.'
% (text, person_or_team.displayname, person_or_team.name))
- @cachedproperty('_all_recipients_cached')
+ @cachedproperty
def _all_recipients(self):
"""Set the cache of all recipients."""
all_recipients = {}
=== modified file 'lib/lp/registry/browser/pillar.py'
--- lib/lp/registry/browser/pillar.py 2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/pillar.py 2010-08-24 15:58:30 +0000
@@ -19,7 +19,6 @@
Interface,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp.menu import (
ApplicationMenu,
enabled_with_permission,
@@ -40,6 +39,7 @@
from lp.registry.interfaces.distroseries import IDistroSeries
from lp.registry.interfaces.pillar import IPillar
from lp.registry.interfaces.projectgroup import IProjectGroup
+from lp.services.propertycache import cachedproperty
class IInvolved(Interface):
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py 2010-08-24 10:45:23 +0000
+++ lib/lp/registry/browser/product.py 2010-08-24 15:58:30 +0000
@@ -50,6 +50,8 @@
)
from operator import attrgetter
+from lazr.delegates import delegates
+from lazr.restful.interface import copy_field
import pytz
from z3c.ptcompat import ViewPageTemplateFile
from zope.app.form.browser import (
@@ -75,10 +77,7 @@
)
from zope.security.proxy import removeSecurityProxy
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
-from lazr.delegates import delegates
-from lazr.restful.interface import copy_field
from canonical.launchpad import (
_,
helpers,
@@ -190,6 +189,7 @@
PillarAliases,
PublicPersonChoice,
)
+from lp.services.propertycache import cachedproperty
from lp.services.worlddata.interfaces.country import ICountry
from lp.translations.browser.customlanguagecode import (
HasCustomLanguageCodesTraversalMixin,
=== modified file 'lib/lp/registry/browser/productseries.py'
--- lib/lp/registry/browser/productseries.py 2010-08-23 04:48:17 +0000
+++ lib/lp/registry/browser/productseries.py 2010-08-24 15:58:30 +0000
@@ -54,7 +54,6 @@
SimpleVocabulary,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.helpers import browserLanguages
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
@@ -136,6 +135,7 @@
from lp.registry.interfaces.productseries import IProductSeries
from lp.registry.interfaces.series import SeriesStatus
from lp.services.fields import URIField
+from lp.services.propertycache import cachedproperty
from lp.services.worlddata.interfaces.country import ICountry
from lp.services.worlddata.interfaces.language import ILanguageSet
from lp.translations.interfaces.potemplate import IPOTemplateSet
=== 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-08-24 15:58:30 +0000
@@ -42,7 +42,6 @@
from zope.lifecycleevent import ObjectCreatedEvent
from zope.schema import Choice
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.browser.feeds import FeedsMixin
from canonical.launchpad.webapp import (
@@ -98,6 +97,7 @@
PillarAliases,
PublicPersonChoice,
)
+from lp.services.propertycache import cachedproperty
class ProjectNavigation(Navigation,
=== 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-08-24 15:58:30 +0000
@@ -22,7 +22,6 @@
SimpleVocabulary,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp import (
action,
canonical_url,
@@ -43,6 +42,7 @@
IStructuralSubscriptionForm,
IStructuralSubscriptionTarget,
)
+from lp.services.propertycache import cachedproperty
class StructuralSubscriptionView(LaunchpadFormView):
=== modified file 'lib/lp/registry/browser/team.py'
--- lib/lp/registry/browser/team.py 2010-08-22 19:14:23 +0000
+++ lib/lp/registry/browser/team.py 2010-08-24 15:58:30 +0000
@@ -41,7 +41,6 @@
SimpleVocabulary,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.interfaces.authtoken import LoginTokenType
from canonical.launchpad.interfaces.emailaddress import IEmailAddressSet
@@ -91,6 +90,7 @@
)
from lp.registry.interfaces.teammembership import TeamMembershipStatus
from lp.services.fields import PublicPersonChoice
+from lp.services.propertycache import cachedproperty
class TeamPrivacyAdapter:
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2010-08-23 09:10:10 +0000
+++ lib/lp/registry/model/distroseries.py 2010-08-24 15:58:30 +0000
@@ -33,7 +33,6 @@
from zope.component import getUtility
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.database.constants import (
DEFAULT,
UTC_NOW,
@@ -112,6 +111,7 @@
from lp.registry.model.structuralsubscription import (
StructuralSubscriptionTargetMixin,
)
+from lp.services.propertycache import cachedproperty
from lp.services.worlddata.model.language import Language
from lp.soyuz.interfaces.archive import (
ALLOW_RELEASE_BUILDS,
@@ -547,7 +547,7 @@
orderBy=["Language.englishname"])
return result
- @cachedproperty('_previous_series_cached')
+ @cachedproperty
def previous_series(self):
"""See `IDistroSeries`."""
# This property is cached because it is used intensely inside
=== 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-08-24 15:58:30 +0000
@@ -51,7 +51,6 @@
)
from zope.security.proxy import removeSecurityProxy
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.database.constants import (
DEFAULT,
@@ -95,6 +94,7 @@
from lp.registry.interfaces.person import validate_public_person
from lp.registry.model.person import Person
from lp.registry.model.teammembership import TeamParticipation
+from lp.services.propertycache import cachedproperty
EMAIL_ADDRESS_STATUSES = (
=== 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 15:58:30 +0000
@@ -38,7 +38,6 @@
from zope.interface import implements
from zope.security.proxy import removeSecurityProxy
-from canonical.cachedproperty import cachedproperty
from canonical.database.constants import UTC_NOW
from canonical.database.datetimecol import UtcDateTimeCol
from canonical.database.enumcol import EnumCol
@@ -150,6 +149,10 @@
StructuralSubscriptionTargetMixin,
)
from lp.services.database.prejoin import prejoin
+from lp.services.propertycache import (
+ cachedproperty,
+ IPropertyCache,
+ )
from lp.translations.interfaces.customlanguagecode import (
IHasCustomLanguageCodes,
)
@@ -428,7 +431,7 @@
notNull=True, default=False,
storm_validator=_validate_license_approved)
- @cachedproperty('_commercial_subscription_cached')
+ @cachedproperty
def commercial_subscription(self):
return CommercialSubscription.selectOneBy(product=self)
@@ -475,7 +478,7 @@
purchaser=purchaser,
sales_system_id=voucher,
whiteboard=whiteboard)
- self._commercial_subscription_cached = subscription
+ IPropertyCache(self).commercial_subscription = subscription
else:
if current_datetime <= self.commercial_subscription.date_expires:
# Extend current subscription.
=== 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-08-24 15:58:30 +0000
@@ -88,7 +88,6 @@
removeSecurityProxy,
)
-from canonical.cachedproperty import cachedproperty
from canonical.database.sqlbase import (
quote,
quote_like,
@@ -169,6 +168,7 @@
from lp.registry.model.projectgroup import ProjectGroup
from lp.registry.model.sourcepackagename import SourcePackageName
from lp.registry.model.teammembership import TeamParticipation
+from lp.services.propertycache import cachedproperty
class BasePersonVocabulary:
=== 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-08-24 15:58:30 +0000
@@ -14,9 +14,9 @@
YADIS_HEADER_NAME,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp import canonical_url
from lp.services.openid.adapters.openid import CurrentOpenIDEndPoint
+from lp.services.propertycache import cachedproperty
class XRDSContentNegotiationMixin:
=== 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-08-24 15:58:30 +0000
@@ -20,10 +20,10 @@
from zope.component import getUtility
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.lazr.timeout import SafeTransportWithTimeout
from lp.registry.interfaces.product import IProductSet
+from lp.services.propertycache import cachedproperty
from lp.services.salesforce.interfaces import (
ISalesforceVoucher,
ISalesforceVoucherProxy,
=== modified file 'lib/lp/services/tests/test_doc.py'
--- lib/lp/services/tests/test_doc.py 2010-08-24 15:58:28 +0000
+++ lib/lp/services/tests/test_doc.py 2010-08-24 15:58:30 +0000
@@ -8,8 +8,10 @@
import os
from canonical.launchpad.testing.systemdocs import LayeredDocFileSuite
-from canonical.testing import BaseLayer
-from canonical.testing import LaunchpadZopelessLayer
+from canonical.testing import (
+ BaseLayer,
+ LaunchpadZopelessLayer,
+ )
from lp.services.testing import build_test_suite
=== 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:58:30 +0000
@@ -106,6 +106,10 @@
from lp.registry.model.person import Person
from lp.services.mail import stub
from lp.services.mail.sendmail import simple_sendmail
+from lp.services.propertycache import (
+ cachedproperty,
+ IPropertyCache,
+ )
from lp.services.scripts.base import (
LaunchpadCronScript,
LaunchpadScript,
=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/browser/archive.py 2010-08-24 15:58:30 +0000
@@ -56,7 +56,6 @@
from zope.security.interfaces import Unauthorized
from zope.security.proxy import removeSecurityProxy
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.browser.librarian import FileNavigationMixin
from canonical.launchpad.components.tokens import create_token
@@ -107,6 +106,7 @@
from lp.registry.interfaces.series import SeriesStatus
from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
from lp.services.browser_helpers import get_user_agent_distroseries
+from lp.services.propertycache import cachedproperty
from lp.services.worlddata.interfaces.country import ICountrySet
from lp.soyuz.adapters.archivedependencies import (
default_component_dependency_name,
=== 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-08-24 15:58:30 +0000
@@ -30,7 +30,6 @@
Text,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp.launchpadform import (
action,
@@ -45,6 +44,7 @@
from canonical.widgets import DateWidget
from canonical.widgets.popup import PersonPickerWidget
from lp.services.fields import PersonChoice
+from lp.services.propertycache import cachedproperty
from lp.soyuz.browser.sourceslist import (
SourcesListEntries,
SourcesListEntriesView,
=== modified file 'lib/lp/soyuz/browser/build.py'
--- lib/lp/soyuz/browser/build.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/browser/build.py 2010-08-24 15:58:30 +0000
@@ -19,7 +19,6 @@
from zope.component import getUtility
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.browser.librarian import (
FileNavigationMixin,
@@ -44,6 +43,7 @@
from lp.app.errors import UnexpectedFormData
from lp.buildmaster.interfaces.buildbase import BuildStatus
from lp.services.job.interfaces.job import JobStatus
+from lp.services.propertycache import cachedproperty
from lp.soyuz.interfaces.binarypackagebuild import (
IBinaryPackageBuild,
IBinaryPackageBuildSet,
=== 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-08-24 15:58:30 +0000
@@ -28,7 +28,6 @@
from zope.event import notify
from zope.lifecycleevent import ObjectCreatedEvent
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
action,
@@ -53,6 +52,7 @@
IBuilder,
IBuilderSet,
)
+from lp.services.propertycache import cachedproperty
from lp.soyuz.browser.build import BuildRecordsView
from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
=== modified file 'lib/lp/soyuz/browser/distributionsourcepackagerelease.py'
--- lib/lp/soyuz/browser/distributionsourcepackagerelease.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/browser/distributionsourcepackagerelease.py 2010-08-24 15:58:30 +0000
@@ -14,7 +14,6 @@
from zope.component import getUtility
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.browser.librarian import ProxiedLibraryFileAlias
from canonical.launchpad.webapp import (
LaunchpadView,
@@ -25,6 +24,7 @@
from canonical.lazr.utils import smartquote
from lp.app.errors import NotFoundError
from lp.archivepublisher.debversion import Version
+from lp.services.propertycache import cachedproperty
from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
from lp.soyuz.interfaces.distributionsourcepackagerelease import (
IDistributionSourcePackageRelease,
=== 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-08-24 15:58:30 +0000
@@ -7,9 +7,9 @@
'PackageSearchViewBase'
]
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp.batching import BatchNavigator
from canonical.launchpad.webapp.publisher import LaunchpadView
+from lp.services.propertycache import cachedproperty
class PackageSearchViewBase(LaunchpadView):
=== modified file 'lib/lp/soyuz/browser/publishing.py'
--- lib/lp/soyuz/browser/publishing.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/browser/publishing.py 2010-08-24 15:58:30 +0000
@@ -17,11 +17,11 @@
from lazr.delegates import delegates
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.browser.librarian import ProxiedLibraryFileAlias
from canonical.launchpad.webapp.authorization import check_permission
from canonical.launchpad.webapp.interfaces import ICanonicalUrlData
from canonical.launchpad.webapp.publisher import LaunchpadView
+from lp.services.propertycache import cachedproperty
from lp.soyuz.interfaces.binarypackagebuild import BuildSetStatus
from lp.soyuz.interfaces.packagediff import IPackageDiff
from lp.soyuz.interfaces.publishing import (
=== modified file 'lib/lp/soyuz/model/distroarchseriesbinarypackage.py'
--- lib/lp/soyuz/model/distroarchseriesbinarypackage.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/model/distroarchseriesbinarypackage.py 2010-08-24 15:58:30 +0000
@@ -17,10 +17,10 @@
)
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.database.sqlbase import sqlvalues
from canonical.launchpad.interfaces import IStore
from lp.app.errors import NotFoundError
+from lp.services.propertycache import cachedproperty
from lp.soyuz.interfaces.distroarchseriesbinarypackage import (
IDistroArchSeriesBinaryPackage,
)
=== 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 15:58:30 +0000
@@ -12,8 +12,11 @@
from storm.store import Store
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.database.sqlbase import sqlvalues
+from lp.services.propertycache import (
+ cachedproperty,
+ IPropertyCache,
+ )
from lp.soyuz.interfaces.distroseriesbinarypackage import (
IDistroSeriesBinaryPackage,
)
@@ -40,7 +43,7 @@
self.distroseries = distroseries
self.binarypackagename = binarypackagename
if cache is not None:
- self._cache = cache
+ IPropertyCache(self).cache = cache
@property
def name(self):
@@ -58,7 +61,7 @@
"""See IDistroSeriesBinaryPackage."""
return self.distroseries.distribution
- @cachedproperty('_cache')
+ @cachedproperty
def cache(self):
"""See IDistroSeriesBinaryPackage."""
store = Store.of(self.distroseries)
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/model/queue.py 2010-08-24 15:58:30 +0000
@@ -33,7 +33,6 @@
from zope.component import getUtility
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.database.constants import UTC_NOW
from canonical.database.datetimecol import UtcDateTimeCol
@@ -72,6 +71,7 @@
PackagePublishingPocket,
pocketsuffix,
)
+from lp.services.propertycache import cachedproperty
from lp.soyuz.interfaces.archive import MAIN_ARCHIVE_PURPOSES
from lp.soyuz.interfaces.binarypackagerelease import BinaryPackageFormat
from lp.soyuz.interfaces.publishing import (
=== modified file 'lib/lp/soyuz/model/sourcepackagerelease.py'
--- lib/lp/soyuz/model/sourcepackagerelease.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/model/sourcepackagerelease.py 2010-08-24 15:58:30 +0000
@@ -30,7 +30,6 @@
from zope.component import getUtility
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.database.constants import (
DEFAULT,
UTC_NOW,
@@ -59,6 +58,7 @@
SourcePackageType,
SourcePackageUrgency,
)
+from lp.services.propertycache import cachedproperty
from lp.soyuz.interfaces.archive import (
IArchiveSet,
MAIN_ARCHIVE_PURPOSES,
=== modified file 'lib/lp/soyuz/scripts/ppareport.py'
--- lib/lp/soyuz/scripts/ppareport.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/scripts/ppareport.py 2010-08-24 15:58:30 +0000
@@ -19,11 +19,11 @@
from storm.store import Store
from zope.component import getUtility
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad.helpers import emailPeople
from canonical.launchpad.webapp import canonical_url
from lp.registry.interfaces.distribution import IDistributionSet
+from lp.services.propertycache import cachedproperty
from lp.services.scripts.base import (
LaunchpadScript,
LaunchpadScriptFailure,
=== modified file 'lib/lp/soyuz/scripts/queue.py'
--- lib/lp/soyuz/scripts/queue.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/scripts/queue.py 2010-08-24 15:58:30 +0000
@@ -24,11 +24,11 @@
import pytz
from zope.component import getUtility
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad.webapp.tales import DurationFormatterAPI
from canonical.librarian.utils import filechunks
from lp.app.errors import NotFoundError
+from lp.services.propertycache import cachedproperty
from lp.soyuz.interfaces.component import IComponentSet
from lp.soyuz.interfaces.queue import (
IPackageUploadSet,
=== 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 15:58:30 +0000
@@ -32,7 +32,6 @@
from zope.security.proxy import isinstance as zisinstance
from zope.session.interfaces import ISession
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.interfaces.account import (
AccountStatus,
@@ -61,6 +60,10 @@
from lp.services.openid.browser.openiddiscovery import (
XRDSContentNegotiationMixin,
)
+from lp.services.propertycache import (
+ cachedproperty,
+ IPropertyCache,
+ )
from lp.testopenid.interfaces.server import (
get_server_url,
ITestOpenIDApplication,
@@ -142,7 +145,7 @@
return (self.openid_request.idSelect() or
self.openid_request.identity == self.user_identity_url)
- @cachedproperty('_openid_parameters')
+ @cachedproperty
def openid_parameters(self):
"""A dictionary of OpenID query parameters from request."""
query = {}
@@ -165,8 +168,9 @@
def restoreRequestFromSession(self):
"""Get the OpenIDRequest from our session."""
session = self.getSession()
+ cache = IPropertyCache(self)
try:
- self._openid_parameters = session[OPENID_REQUEST_SESSION_KEY]
+ cache.openid_parameters = session[OPENID_REQUEST_SESSION_KEY]
except KeyError:
raise UnexpectedFormData("No OpenID request in session")
=== 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-08-24 15:58:30 +0000
@@ -13,7 +13,6 @@
import operator
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp import (
action,
canonical_url,
@@ -26,6 +25,7 @@
from lp.registry.browser.distribution import DistributionEditView
from lp.registry.interfaces.distribution import IDistribution
from lp.registry.interfaces.series import SeriesStatus
+from lp.services.propertycache import cachedproperty
from lp.translations.browser.translations import TranslationsMixin
=== 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-08-24 15:58:30 +0000
@@ -16,7 +16,6 @@
from zope.component import getUtility
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import helpers
from canonical.launchpad.webapp import action
from canonical.launchpad.webapp.authorization import check_permission
@@ -33,6 +32,7 @@
from lp.app.errors import TranslationUnavailable
from lp.registry.interfaces.distroseries import IDistroSeries
from lp.registry.interfaces.series import SeriesStatus
+from lp.services.propertycache import cachedproperty
from lp.translations.browser.potemplate import BaseSeriesTemplatesView
from lp.translations.browser.translations import TranslationsMixin
from lp.translations.interfaces.distroserieslanguage import (
=== 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-08-24 15:58:30 +0000
@@ -25,7 +25,6 @@
SimpleVocabulary,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
action,
@@ -40,6 +39,7 @@
from lp.app.errors import UnexpectedFormData
from lp.registry.interfaces.distribution import IDistribution
from lp.registry.interfaces.pillar import IPillarNameSet
+from lp.services.propertycache import cachedproperty
from lp.translations.interfaces.translationimportqueue import (
IHasTranslationImports,
ITranslationImportQueue,
=== 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-08-24 15:58:30 +0000
@@ -21,7 +21,6 @@
from zope.lifecycleevent import ObjectCreatedEvent
from zope.schema import TextLine
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.webapp import (
action,
@@ -39,6 +38,7 @@
from canonical.launchpad.webapp.breadcrumb import Breadcrumb
from canonical.launchpad.webapp.tales import LanguageFormatterAPI
from canonical.widgets import LabeledMultiCheckBoxWidget
+from lp.services.propertycache import cachedproperty
from lp.services.worlddata.interfaces.language import (
ILanguage,
ILanguageSet,
=== 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-08-24 15:58:30 +0000
@@ -25,7 +25,6 @@
Interface,
)
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
action,
@@ -40,6 +39,7 @@
from canonical.launchpad.webapp.publisher import LaunchpadView
from canonical.widgets import LaunchpadRadioWidget
from lp.registry.interfaces.sourcepackage import ISourcePackage
+from lp.services.propertycache import cachedproperty
from lp.translations.browser.translationlinksaggregator import (
TranslationLinksAggregator,
)
=== 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-08-24 15:58:30 +0000
@@ -11,13 +11,13 @@
from zope.component import getUtility
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.webapp import (
canonical_url,
LaunchpadView,
)
from canonical.launchpad.webapp.tales import DurationFormatterAPI
+from lp.services.propertycache import cachedproperty
from lp.translations.interfaces.poexportrequest import IPOExportRequestSet
from lp.translations.interfaces.potemplate import IHasTranslationTemplates
from lp.translations.interfaces.translationexporter import (
=== modified file 'lib/lp/translations/browser/pofile.py'
--- lib/lp/translations/browser/pofile.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/browser/pofile.py 2010-08-24 15:58:30 +0000
@@ -24,7 +24,6 @@
from zope.component import getUtility
from zope.publisher.browser import FileUpload
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad import _
from canonical.launchpad.webapp import (
@@ -43,6 +42,7 @@
UnexpectedFormData,
)
from lp.registry.interfaces.person import IPersonSet
+from lp.services.propertycache import cachedproperty
from lp.translations.browser.poexportrequest import BaseExportView
from lp.translations.browser.potemplate import POTemplateFacets
from lp.translations.browser.translationmessage import (
=== 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-08-24 15:58:30 +0000
@@ -11,7 +11,6 @@
'ProductView',
]
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp import (
canonical_url,
enabled_with_permission,
@@ -24,6 +23,7 @@
from lp.registry.interfaces.product import IProduct
from lp.registry.interfaces.productseries import IProductSeries
from lp.registry.interfaces.series import SeriesStatus
+from lp.services.propertycache import cachedproperty
from lp.translations.browser.translations import TranslationsMixin
=== 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-08-24 15:58:30 +0000
@@ -24,7 +24,6 @@
from zope.component import getUtility
from zope.publisher.browser import FileUpload
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad import _
from canonical.launchpad.helpers import is_tar_filename
from canonical.launchpad.webapp import (
@@ -42,6 +41,7 @@
from canonical.widgets.itemswidgets import LaunchpadRadioWidgetWithDescription
from lp.code.interfaces.branchjob import IRosettaUploadJobSource
from lp.registry.interfaces.productseries import IProductSeries
+from lp.services.propertycache import cachedproperty
from lp.translations.browser.poexportrequest import BaseExportView
from lp.translations.browser.potemplate import BaseSeriesTemplatesView
from lp.translations.browser.translations import TranslationsMixin
=== 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-08-24 15:58:30 +0000
@@ -12,12 +12,12 @@
'ProductSeriesLanguageView',
]
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.readonly import is_read_only
from canonical.launchpad.webapp import LaunchpadView
from canonical.launchpad.webapp.batching import BatchNavigator
from canonical.launchpad.webapp.publisher import Navigation
from canonical.launchpad.webapp.tales import PersonFormatterAPI
+from lp.services.propertycache import cachedproperty
from lp.translations.interfaces.distroserieslanguage import (
IDistroSeriesLanguage,
)
=== 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-08-24 15:58:30 +0000
@@ -37,7 +37,6 @@
from zope.interface import implements
from zope.schema.vocabulary import getVocabularyRegistry
-from canonical.cachedproperty import cachedproperty
from canonical.launchpad.webapp import (
ApplicationMenu,
canonical_url,
@@ -50,6 +49,7 @@
from canonical.launchpad.webapp.interfaces import ILaunchBag
from canonical.launchpad.webapp.menu import structured
from lp.app.errors import UnexpectedFormData
+from lp.services.propertycache import cachedproperty
from lp.translations.browser.browser_helpers import (
contract_rosetta_escapes,
convert_newlines_to_web_form,
=== 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-08-24 15:58:30 +0000
@@ -17,7 +17,6 @@
from zope.component import getUtility
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.launchpad import helpers
from canonical.launchpad.interfaces.geoip import IRequestPreferredLanguages
@@ -36,6 +35,7 @@
from canonical.launchpad.webapp.interfaces import ILaunchpadRoot
from lp.registry.interfaces.person import IPersonSet
from lp.registry.interfaces.product import IProductSet
+from lp.services.propertycache import cachedproperty
from lp.services.worlddata.interfaces.country import ICountry
from lp.translations.publisher import TranslationsLayer
=== 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-08-24 15:58:30 +0000
@@ -44,7 +44,6 @@
from zope.interface import implements
from zope.security.proxy import removeSecurityProxy
-from canonical.cachedproperty import cachedproperty
from canonical.database.constants import UTC_NOW
from canonical.database.datetimecol import UtcDateTimeCol
from canonical.database.sqlbase import (
@@ -66,6 +65,7 @@
from canonical.launchpad.webapp.publisher import canonical_url
from lp.registry.interfaces.person import validate_public_person
from lp.registry.model.person import Person
+from lp.services.propertycache import cachedproperty
from lp.translations.interfaces.pofile import (
IPOFile,
IPOFileSet,
=== modified file 'lib/lp/translations/model/potemplate.py'
--- lib/lp/translations/model/potemplate.py 2010-08-20 20:31:18 +0000
+++ lib/lp/translations/model/potemplate.py 2010-08-24 15:58:30 +0000
@@ -48,7 +48,6 @@
from zope.interface import implements
from zope.security.proxy import removeSecurityProxy
-from canonical.cachedproperty import cachedproperty
from canonical.database.constants import DEFAULT
from canonical.database.datetimecol import UtcDateTimeCol
from canonical.database.enumcol import EnumCol
@@ -70,6 +69,7 @@
from lp.registry.model.sourcepackagename import SourcePackageName
from lp.services.database.collection import Collection
from lp.services.database.prejoin import prejoin
+from lp.services.propertycache import cachedproperty
from lp.services.worlddata.model.language import Language
from lp.translations.interfaces.pofile import IPOFileSet
from lp.translations.interfaces.potemplate import (
=== 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-08-24 15:58:30 +0000
@@ -24,7 +24,6 @@
from storm.store import Store
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.database.constants import (
DEFAULT,
UTC_NOW,
@@ -37,6 +36,7 @@
sqlvalues,
)
from lp.registry.interfaces.person import validate_public_person
+from lp.services.propertycache import cachedproperty
from lp.translations.interfaces.translationmessage import (
ITranslationMessage,
ITranslationMessageSet,
=== 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-08-24 15:58:30 +0000
@@ -21,7 +21,6 @@
from zope.component import getUtility
from zope.interface import implements
-from canonical.cachedproperty import cachedproperty
from canonical.config import config
from canonical.database.sqlbase import (
cursor,
@@ -33,6 +32,7 @@
IPersonSet,
PersonCreationRationale,
)
+from lp.services.propertycache import cachedproperty
from lp.translations.interfaces.translationexporter import (
ITranslationExporter,
)
Follow ups