← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/launchpad/remove-propertycache-adapters-bug-628762 into lp:launchpad/devel

 

Gavin Panella has proposed merging lp:~allenap/launchpad/remove-propertycache-adapters-bug-628762 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #628762 propertycache adaption failures in test suite
  https://bugs.launchpad.net/bugs/628762


This removes the adapters from the propertycache module. They worked fine, but didn't work everywhere, so I'd had to work around them anyway. The IPropertyCache adapter is replaced with get_property_cache() and IPropertyCacheManager(thing).clear() is replaced by clear_property_cache().

At the bottom of shipit.py, IPropertyCache is created as an alias to get_property_cache. I have a related branch to update shipit so this will get removed as soon as that lands.

It passes in ec2.

-- 
https://code.launchpad.net/~allenap/launchpad/remove-propertycache-adapters-bug-628762/+merge/39249
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/remove-propertycache-adapters-bug-628762 into lp:launchpad/devel.
=== modified file 'lib/canonical/database/sqlbase.py'
--- lib/canonical/database/sqlbase.py	2010-10-03 15:30:06 +0000
+++ lib/canonical/database/sqlbase.py	2010-10-25 08:29:45 +0000
@@ -71,7 +71,7 @@
     dbconfig,
     )
 from canonical.database.interfaces import ISQLBase
-from lp.services.propertycache import IPropertyCacheManager
+from lp.services.propertycache import clear_property_cache
 
 # Default we want for scripts, and the PostgreSQL default. Note psycopg1 will
 # use SERIALIZABLE unless we override, but psycopg2 will not.
@@ -270,7 +270,7 @@
         # 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.
-        IPropertyCacheManager(self).clear()
+        clear_property_cache(self)
 
 
 alreadyInstalledMsg = ("A ZopelessTransactionManager with these settings is "

=== modified file 'lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt'
--- lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt	2010-10-25 08:29:45 +0000
@@ -122,8 +122,8 @@
 Instead of issuing one request per bug watch, like was done before,
 updateBugWatches() issues only one request to update all watches:
 
-    >>> from lp.services.propertycache import IPropertyCache
-    >>> del IPropertyCache(example_ext_bug_tracker).csv_data
+    >>> from lp.services.propertycache import get_property_cache
+    >>> del get_property_cache(example_ext_bug_tracker).csv_data
 
     >>> example_ext_bug_tracker.trace_calls = True
     >>> bug_watch_updater.updateBugWatches(

=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py	2010-10-19 21:30:53 +0000
+++ lib/lp/bugs/model/bug.py	2010-10-25 08:29:45 +0000
@@ -189,8 +189,8 @@
 from lp.services.fields import DuplicateBug
 from lp.services.propertycache import (
     cachedproperty,
-    IPropertyCache,
-    IPropertyCacheManager,
+    clear_property_cache,
+    get_property_cache,
     )
 
 
@@ -483,7 +483,7 @@
             for message in messages:
                 if message.id not in chunk_map:
                     continue
-                cache = IPropertyCache(message)
+                cache = get_property_cache(message)
                 cache.text_contents = Message.chunks_text(
                     chunk_map[message.id])
         def eager_load(rows, slice_info):
@@ -741,7 +741,7 @@
     def unsubscribe(self, person, unsubscribed_by):
         """See `IBug`."""
         # Drop cached subscription info.
-        IPropertyCacheManager(self).clear()
+        clear_property_cache(self)
         if person is None:
             person = unsubscribed_by
 
@@ -763,7 +763,7 @@
                 # disabled see the change.
                 store.flush()
                 self.updateHeat()
-                del IPropertyCache(self)._known_viewers
+                del get_property_cache(self)._known_viewers
                 return
 
     def unsubscribeFromDupes(self, person, unsubscribed_by):
@@ -1426,7 +1426,7 @@
         question_target = IQuestionTarget(bugtask.target)
         question = question_target.createQuestionFromBug(self)
         self.addChange(BugConvertedToQuestion(UTC_NOW, person, question))
-        IPropertyCache(self)._question_from_bug = question
+        get_property_cache(self)._question_from_bug = question
 
         notify(BugBecameQuestionEvent(self, question, person))
         return question
@@ -1761,7 +1761,7 @@
         # and insert the new ones.
         new_tags = set([tag.lower() for tag in tags])
         old_tags = set(self.tags)
-        del IPropertyCache(self)._cached_tags
+        del get_property_cache(self)._cached_tags
         added_tags = new_tags.difference(old_tags)
         removed_tags = old_tags.difference(new_tags)
         for removed_tag in removed_tags:
@@ -2012,7 +2012,7 @@
             # will be found without a query when dereferenced.
             indexed_message = message_to_indexed.get(attachment._messageID)
             if indexed_message is not None:
-                IPropertyCache(attachment).message = indexed_message
+                get_property_cache(attachment).message = indexed_message
             return attachment
         rawresults = self._attachments_query()
         return DecoratedResultSet(rawresults, set_indexed_message)

=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py	2010-10-22 19:56:26 +0000
+++ lib/lp/bugs/model/bugtask.py	2010-10-25 08:29:45 +0000
@@ -157,7 +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.services.propertycache import get_property_cache
 from lp.soyuz.enums import PackagePublishingStatus
 from lp.soyuz.model.publishing import SourcePackagePublishingHistory
 from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
@@ -1347,7 +1347,7 @@
     """
     userid = user.id
     def cache_user_can_view_bug(bugtask):
-        IPropertyCache(bugtask.bug)._known_viewers = set([userid])
+        get_property_cache(bugtask.bug)._known_viewers = set([userid])
         return bugtask
     return cache_user_can_view_bug
 
@@ -2377,7 +2377,7 @@
             bugtask._syncFromConjoinedSlave()
 
         bugtask.updateTargetNameCache()
-        del IPropertyCache(bug).bugtasks
+        del get_property_cache(bug).bugtasks
         # Because of block_implicit_flushes, it is possible for a new bugtask
         # to be queued in appropriately, which leads to Bug.bugtasks not
         # finding the bugtask.

=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2010-10-14 20:20:47 +0000
+++ lib/lp/registry/browser/person.py	2010-10-25 08:29:45 +0000
@@ -206,10 +206,6 @@
 from canonical.launchpad.webapp.login import logoutPerson
 from canonical.launchpad.webapp.menu import get_current_view
 from canonical.launchpad.webapp.publisher import LaunchpadView
-from lp.app.browser.tales import (
-    DateTimeFormatterAPI,
-    PersonFormatterAPI,
-    )
 from canonical.lazr.utils import smartquote
 from canonical.widgets import (
     LaunchpadDropdownWidget,
@@ -226,6 +222,10 @@
 from lp.answers.interfaces.questionenums import QuestionParticipation
 from lp.answers.interfaces.questionsperson import IQuestionsPerson
 from lp.app.browser.stringformatter import FormattersAPI
+from lp.app.browser.tales import (
+    DateTimeFormatterAPI,
+    PersonFormatterAPI,
+    )
 from lp.app.errors import (
     NotFoundError,
     UnexpectedFormData,
@@ -311,7 +311,7 @@
 from lp.services.openid.interfaces.openidrpsummary import IOpenIDRPSummarySet
 from lp.services.propertycache import (
     cachedproperty,
-    IPropertyCache,
+    get_property_cache,
     )
 from lp.services.salesforce.interfaces import (
     ISalesforceVoucherProxy,
@@ -5736,7 +5736,7 @@
     def _reset_state(self):
         """Reset the cache because the recipients changed."""
         self._count_recipients = None
-        del IPropertyCache(self)._all_recipients
+        del get_property_cache(self)._all_recipients
 
     def _getPrimaryReason(self, person_or_team):
         """Return the primary reason enumeration.

=== modified file 'lib/lp/registry/doc/personlocation.txt'
--- lib/lp/registry/doc/personlocation.txt	2010-10-17 15:44:08 +0000
+++ lib/lp/registry/doc/personlocation.txt	2010-10-25 08:29:45 +0000
@@ -120,9 +120,9 @@
 have been pre-cached so that we don't hit the database everytime we
 access a person's .location property.
 
-    >>> from lp.services.propertycache import IPropertyCache
+    >>> from lp.services.propertycache import get_property_cache
     >>> for mapped in guadamen.getMappedParticipants():
-    ...     cache = IPropertyCache(mapped)
+    ...     cache = get_property_cache(mapped)
     ...     if ("location" not in cache or
     ...         not verifyObject(IPersonLocation, cache.location)):
     ...         print 'No cached location on %s' % mapped.name

=== modified file 'lib/lp/registry/doc/teammembership.txt'
--- lib/lp/registry/doc/teammembership.txt	2010-10-19 18:44:31 +0000
+++ lib/lp/registry/doc/teammembership.txt	2010-10-25 08:29:45 +0000
@@ -983,8 +983,8 @@
     >>> from canonical.launchpad.interfaces.lpstorm import IMasterObject
     >>> IMasterObject(bad_user.account).status = AccountStatus.SUSPENDED
     >>> IMasterObject(bad_user.preferredemail).status = EmailAddressStatus.OLD
-    >>> from lp.services.propertycache import IPropertyCache
-    >>> del IPropertyCache(removeSecurityProxy(bad_user)).preferredemail
+    >>> from lp.services.propertycache import get_property_cache
+    >>> del get_property_cache(removeSecurityProxy(bad_user)).preferredemail
     >>> transaction.commit()
 
     >>> [m.displayname for m in t3.allmembers]

=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py	2010-10-17 09:03:43 +0000
+++ lib/lp/registry/model/distribution.py	2010-10-25 08:29:45 +0000
@@ -151,7 +151,7 @@
     )
 from lp.services.propertycache import (
     cachedproperty,
-    IPropertyCache,
+    get_property_cache,
     )
 from lp.soyuz.enums import (
     ArchivePurpose,
@@ -1752,7 +1752,7 @@
 
         # May wish to add this to the series rather than clearing the cache --
         # RBC 20100816.
-        del IPropertyCache(self).series
+        del get_property_cache(self).series
 
         return series
 

=== modified file 'lib/lp/registry/model/distroseriesdifference.py'
--- lib/lp/registry/model/distroseriesdifference.py	2010-09-28 14:42:41 +0000
+++ lib/lp/registry/model/distroseriesdifference.py	2010-10-25 08:29:45 +0000
@@ -41,11 +41,12 @@
     IDistroSeriesDifferenceCommentSource,
     )
 from lp.registry.model.distroseriesdifferencecomment import (
-    DistroSeriesDifferenceComment)
+    DistroSeriesDifferenceComment,
+    )
 from lp.registry.model.sourcepackagename import SourcePackageName
 from lp.services.propertycache import (
     cachedproperty,
-    IPropertyCacheManager,
+    clear_property_cache,
     )
 
 
@@ -189,7 +190,7 @@
         # won't cause a hard-to find bug if a script ever creates a
         # difference, copies/publishes a new version and then calls
         # update() (like the tests for this method do).
-        IPropertyCacheManager(self).clear()
+        clear_property_cache(self)
         self._updateType()
         updated = self._updateVersionsAndStatus()
         return updated

=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py	2010-10-19 20:54:44 +0000
+++ lib/lp/registry/model/person.py	2010-10-25 08:29:45 +0000
@@ -264,7 +264,7 @@
 from lp.services.openid.model.openididentifier import OpenIdIdentifier
 from lp.services.propertycache import (
     cachedproperty,
-    IPropertyCache,
+    get_property_cache,
     )
 from lp.services.salesforce.interfaces import (
     ISalesforceVoucherProxy,
@@ -511,19 +511,19 @@
 
         :raises AttributeError: If the cache doesn't exist.
         """
-        return IPropertyCache(self).languages
+        return get_property_cache(self).languages
 
     def setLanguagesCache(self, languages):
         """Set this person's cached languages.
 
         Order them by name if necessary.
         """
-        IPropertyCache(self).languages = sorted(
+        get_property_cache(self).languages = sorted(
             languages, key=attrgetter('englishname'))
 
     def deleteLanguagesCache(self):
         """Delete this person's cached languages, if it exists."""
-        del IPropertyCache(self).languages
+        del get_property_cache(self).languages
 
     def addLanguage(self, language):
         """See `IPerson`."""
@@ -626,7 +626,7 @@
         """See `ISetLocation`."""
         assert not self.is_team, 'Cannot edit team location.'
         if self.location is None:
-            IPropertyCache(self).location = PersonLocation(
+            get_property_cache(self).location = PersonLocation(
                 person=self, visible=visible)
         else:
             self.location.visible = visible
@@ -645,7 +645,7 @@
             self.location.last_modified_by = user
             self.location.date_last_modified = UTC_NOW
         else:
-            IPropertyCache(self).location = PersonLocation(
+            get_property_cache(self).location = PersonLocation(
                 person=self, time_zone=time_zone, latitude=latitude,
                 longitude=longitude, last_modified_by=user)
 
@@ -1633,7 +1633,7 @@
             if not person:
                 return
             email = column
-            IPropertyCache(person).preferredemail = email
+            get_property_cache(person).preferredemail = email
 
         decorators.append(handleemail)
 
@@ -1647,7 +1647,7 @@
                 column is not None
                 # -- preferred email found
                 and person.preferredemail is not None)
-            IPropertyCache(person).is_valid_person = valid
+            get_property_cache(person).is_valid_person = valid
         decorators.append(handleaccount)
         return dict(
             joins=origins,
@@ -1737,7 +1737,7 @@
 
         def prepopulate_person(row):
             result = row[0]
-            cache = IPropertyCache(result)
+            cache = get_property_cache(result)
             index = 1
             #-- karma caching
             if need_karma:
@@ -1799,7 +1799,7 @@
         result = self._getMembersWithPreferredEmails()
         person_list = []
         for person, email in result:
-            IPropertyCache(person).preferredemail = email
+            get_property_cache(person).preferredemail = email
             person_list.append(person)
         return person_list
 
@@ -1934,7 +1934,7 @@
         # fetches the rows when they're needed.
         locations = self._getMappedParticipantsLocations(limit=limit)
         for location in locations:
-            IPropertyCache(location.person).location = location
+            get_property_cache(location.person).location = location
         participants = set(location.person for location in locations)
         # Cache the ValidPersonCache query for all mapped participants.
         if len(participants) > 0:
@@ -2076,7 +2076,7 @@
         self.account_status = AccountStatus.DEACTIVATED
         self.account_status_comment = comment
         IMasterObject(self.preferredemail).status = EmailAddressStatus.NEW
-        del IPropertyCache(self).preferredemail
+        del get_property_cache(self).preferredemail
         base_new_name = self.name + '-deactivatedaccount'
         self.name = self._ensureNewName(base_new_name)
 
@@ -2466,7 +2466,7 @@
         if email_address is not None:
             email_address.status = EmailAddressStatus.VALIDATED
             email_address.syncUpdate()
-        del IPropertyCache(self).preferredemail
+        del get_property_cache(self).preferredemail
 
     def setPreferredEmail(self, email):
         """See `IPerson`."""
@@ -2503,7 +2503,7 @@
         IMasterObject(email).syncUpdate()
 
         # Now we update our cache of the preferredemail.
-        IPropertyCache(self).preferredemail = email
+        get_property_cache(self).preferredemail = email
 
     @cachedproperty
     def preferredemail(self):
@@ -3077,7 +3077,7 @@
                 # Populate the previously empty 'preferredemail' cached
                 # property, so the Person record is up-to-date.
                 if master_email.status == EmailAddressStatus.PREFERRED:
-                    cache = IPropertyCache(account_person)
+                    cache = get_property_cache(account_person)
                     cache.preferredemail = master_email
                 return account_person
             # There is no associated `Person` to the email `Account`.

=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py	2010-10-07 22:14:07 +0000
+++ lib/lp/registry/model/product.py	2010-10-25 08:29:45 +0000
@@ -71,7 +71,6 @@
     MAIN_STORE,
     )
 from canonical.launchpad.webapp.sorting import sorted_version_numbers
-
 from lp.answers.interfaces.faqtarget import IFAQTarget
 from lp.answers.interfaces.questioncollection import (
     QUESTION_STATUS_DEFAULT_SEARCH,
@@ -161,7 +160,7 @@
 from lp.services.database.prejoin import prejoin
 from lp.services.propertycache import (
     cachedproperty,
-    IPropertyCache,
+    get_property_cache,
     )
 from lp.translations.interfaces.customlanguagecode import (
     IHasCustomLanguageCodes,
@@ -538,7 +537,7 @@
                 purchaser=purchaser,
                 sales_system_id=voucher,
                 whiteboard=whiteboard)
-            IPropertyCache(self).commercial_subscription = subscription
+            get_property_cache(self).commercial_subscription = subscription
         else:
             if current_datetime <= self.commercial_subscription.date_expires:
                 # Extend current subscription.

=== modified file 'lib/lp/registry/tests/test_distribution.py'
--- lib/lp/registry/tests/test_distribution.py	2010-09-29 14:16:22 +0000
+++ lib/lp/registry/tests/test_distribution.py	2010-10-25 08:29:45 +0000
@@ -18,7 +18,7 @@
 from lp.registry.tests.test_distroseries import (
     TestDistroSeriesCurrentSourceReleases,
     )
-from lp.services.propertycache import IPropertyCache
+from lp.services.propertycache import get_property_cache
 from lp.soyuz.interfaces.distributionsourcepackagerelease import (
     IDistributionSourcePackageRelease,
     )
@@ -84,7 +84,7 @@
         distribution = removeSecurityProxy(
             self.factory.makeDistribution('foo'))
 
-        cache = IPropertyCache(distribution)
+        cache = get_property_cache(distribution)
 
         # Not yet cached.
         self.assertNotIn("series", cache)

=== modified file 'lib/lp/registry/tests/test_distroseriesdifference.py'
--- lib/lp/registry/tests/test_distroseriesdifference.py	2010-10-06 18:53:53 +0000
+++ lib/lp/registry/tests/test_distroseriesdifference.py	2010-10-25 08:29:45 +0000
@@ -26,7 +26,7 @@
     IDistroSeriesDifference,
     IDistroSeriesDifferenceSource,
     )
-from lp.services.propertycache import IPropertyCacheManager
+from lp.services.propertycache import get_property_cache
 from lp.soyuz.interfaces.publishing import PackagePublishingStatus
 from lp.testing import (
     person_logged_in,
@@ -419,7 +419,7 @@
         ds_diff.source_pub
         ds_diff.parent_source_pub
 
-        cache = IPropertyCacheManager(ds_diff).cache
+        cache = get_property_cache(ds_diff)
 
         self.assertContentEqual(
             ['source_pub', 'parent_source_pub'], cache)

=== modified file 'lib/lp/services/configure.zcml'
--- lib/lp/services/configure.zcml	2010-09-12 15:15:16 +0000
+++ lib/lp/services/configure.zcml	2010-10-25 08:29:45 +0000
@@ -3,9 +3,6 @@
 -->
 
 <configure xmlns="http://namespaces.zope.org/zope";>
-  <adapter factory=".propertycache.get_default_cache"/>
-  <adapter factory=".propertycache.PropertyCacheManager"/>
-  <adapter factory=".propertycache.DefaultPropertyCacheManager"/>
   <include package=".comments" />
   <include package=".database" />
   <include package=".features" />

=== modified file 'lib/lp/services/doc/propertycache.txt'
--- lib/lp/services/doc/propertycache.txt	2010-09-06 09:11:43 +0000
+++ lib/lp/services/doc/propertycache.txt	2010-10-25 08:29:45 +0000
@@ -3,8 +3,9 @@
 
     >>> from lp.services.propertycache import (
     ...     cachedproperty,
+    ...     clear_property_cache,
+    ...     get_property_cache,
     ...     IPropertyCache,
-    ...     IPropertyCacheManager,
     ...     )
 
 Cached properties are for situations where a property is computed once
@@ -20,9 +21,19 @@
 
     >>> foo = Foo()
 
-The property cache can be obtained via adaption.
-
-    >>> cache = IPropertyCache(foo)
+The property cache can be obtained with `get_property_cache()`.
+
+    >>> cache = get_property_cache(foo)
+
+Calling `get_property_cache()` on a cache returns the cache:
+
+    >>> get_property_cache(cache) is cache
+    True
+
+Caches provide the `IPropertyCache` interface.
+
+    >>> IPropertyCache.providedBy(cache)
+    True
 
 Initially it is empty. Caches can be iterated over to reveal the names
 of the values cached within.
@@ -82,25 +93,28 @@
     >>> del cache.bar
     >>> del cache.bar
 
-A cache manager can be used to empty the cache.
-
-    >>> manager = IPropertyCacheManager(cache)
-
-    >>> cache.bar = 123
-    >>> cache.baz = 456
-    >>> sorted(cache)
-    ['bar', 'baz']
-
-    >>> manager.clear()
-    >>> list(cache)
-    []
-
-A cache manager can be obtained by adaption from non-cache objects
-too.
-
-    >>> manager = IPropertyCacheManager(foo)
-    >>> manager.cache is cache
-    True
+The cache can be cleared with `clear_property_cache()`.
+
+    >>> cache.bar = 123
+    >>> cache.baz = 456
+    >>> sorted(cache)
+    ['bar', 'baz']
+
+    >>> clear_property_cache(cache)
+    >>> list(cache)
+    []
+
+The property cache for an object can be cleared by passing in the
+object to `clear_property_cache()`.
+
+    >>> cache.bar = 123
+    >>> cache.baz = 456
+    >>> sorted(cache)
+    ['bar', 'baz']
+
+    >>> clear_property_cache(foo)
+    >>> list(cache)
+    []
 
 
 The cachedproperty decorator
@@ -134,7 +148,7 @@
 
     >>> foo.a
     1234
-    >>> IPropertyCache(foo).a_in_cache
+    >>> get_property_cache(foo).a_in_cache
     1234
 
 `b` was defined without an explicit name so it is known as "b" in the
@@ -149,5 +163,5 @@
 
     >>> foo.b
     5678
-    >>> IPropertyCache(foo).b
+    >>> get_property_cache(foo).b
     5678

=== modified file 'lib/lp/services/propertycache.py'
--- lib/lp/services/propertycache.py	2010-09-02 12:54:05 +0000
+++ lib/lp/services/propertycache.py	2010-10-25 08:29:45 +0000
@@ -10,24 +10,17 @@
 
 __metaclass__ = type
 __all__ = [
-    'IPropertyCache',
-    'IPropertyCacheManager',
     'cachedproperty',
+    'clear_property_cache',
+    'get_property_cache',
     ]
 
 from functools import partial
 
-from zope.component import (
-    adapter,
-    adapts,
-    getGlobalSiteManager,
-    )
 from zope.interface import (
-    implementer,
     implements,
     Interface,
     )
-from zope.schema import Object
 from zope.security.proxy import removeSecurityProxy
 
 
@@ -55,19 +48,6 @@
         """Iterate over the cached names."""
 
 
-class IPropertyCacheManager(Interface):
-
-    cache = Object(IPropertyCache)
-
-    def clear():
-        """Empty the cache."""
-
-
-# Register adapters with the global site manager so that they work even when
-# ZCML has not been executed.
-registerAdapter = getGlobalSiteManager().registerAdapter
-
-
 class DefaultPropertyCache:
     """A simple cache."""
 
@@ -89,56 +69,22 @@
         return iter(self.__dict__)
 
 
-@adapter(Interface)
-@implementer(IPropertyCache)
-def get_default_cache(target):
-    """Adapter to obtain a `DefaultPropertyCache` for any object."""
-    naked_target = removeSecurityProxy(target)
-    try:
-        return naked_target._property_cache
-    except AttributeError:
-        naked_target._property_cache = DefaultPropertyCache()
-        return naked_target._property_cache
-
-registerAdapter(get_default_cache)
-
-
-class PropertyCacheManager:
-    """A simple `IPropertyCacheManager`.
-
-    Should work for any `IPropertyCache` instance.
-    """
-
-    implements(IPropertyCacheManager)
-    adapts(Interface)
-
-    def __init__(self, target):
-        self.cache = IPropertyCache(target)
-
-    def clear(self):
-        """See `IPropertyCacheManager`."""
-        for name in list(self.cache):
-            delattr(self.cache, name)
-
-registerAdapter(PropertyCacheManager)
-
-
-class DefaultPropertyCacheManager:
-    """A `IPropertyCacheManager` specifically for `DefaultPropertyCache`.
-
-    The implementation of `clear` is more efficient.
-    """
-
-    implements(IPropertyCacheManager)
-    adapts(DefaultPropertyCache)
-
-    def __init__(self, cache):
-        self.cache = cache
-
-    def clear(self):
-        self.cache.__dict__.clear()
-
-registerAdapter(DefaultPropertyCacheManager)
+def get_property_cache(target):
+    """Obtain a `DefaultPropertyCache` for any object."""
+    if IPropertyCache.providedBy(target):
+        return target
+    else:
+        naked_target = removeSecurityProxy(target)
+        try:
+            return naked_target._property_cache
+        except AttributeError:
+            naked_target._property_cache = DefaultPropertyCache()
+            return naked_target._property_cache
+
+
+def clear_property_cache(target):
+    """Clear the property cache."""
+    get_property_cache(target).__dict__.clear()
 
 
 class CachedProperty:
@@ -163,7 +109,7 @@
     def __get__(self, instance, cls):
         if instance is None:
             return self
-        cache = IPropertyCache(instance)
+        cache = get_property_cache(instance)
         try:
             return getattr(cache, self.name)
         except AttributeError:
@@ -184,32 +130,3 @@
         name = name_or_function.__name__
         populate = name_or_function
         return CachedProperty(name=name, populate=populate)
-
-
-# XXX: GavinPanella 2010-09-02 bug=628762: There are some weird adaption
-# failures when running the full test suite. All that follows is a temporary,
-# mostly non-Zope, workaround.
-
-_IPropertyCache = IPropertyCache
-_IPropertyCacheManager = IPropertyCacheManager
-
-def IPropertyCache(target):
-    """Return the `IPropertyCache` for `target`.
-
-    Note: this is a workaround; see bug 628762.
-    """
-    if _IPropertyCache.providedBy(target):
-        return target
-    else:
-        return get_default_cache(target)
-
-def IPropertyCacheManager(target):
-    """Return the `IPropertyCacheManager` for `target`.
-
-    Note: this is a workaround; see bug 628762.
-    """
-    cache = IPropertyCache(target)
-    if isinstance(cache, DefaultPropertyCache):
-        return DefaultPropertyCacheManager(cache)
-    else:
-        return PropertyCacheManager(cache)

=== modified file 'lib/lp/shipit.py'
--- lib/lp/shipit.py	2010-08-24 15:28:02 +0000
+++ lib/lp/shipit.py	2010-10-25 08:29:45 +0000
@@ -108,7 +108,7 @@
 from lp.services.mail.sendmail import simple_sendmail
 from lp.services.propertycache import (
     cachedproperty,
-    IPropertyCache,
+    get_property_cache,
     )
 from lp.services.scripts.base import (
     LaunchpadCronScript,
@@ -128,3 +128,6 @@
 from lp.testing.publication import get_request_and_publication
 
 
+# XXX: GavinPanella 2010-10-24 bug=628762: Transitional change to allow this
+# branch to run against an unmodified shipit.
+IPropertyCache = get_property_cache

=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py	2010-10-03 15:30:06 +0000
+++ lib/lp/soyuz/model/archive.py	2010-10-25 08:29:45 +0000
@@ -88,7 +88,7 @@
 from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
 from lp.registry.model.teammembership import TeamParticipation
 from lp.services.job.interfaces.job import JobStatus
-from lp.services.propertycache import IPropertyCache
+from lp.services.propertycache import get_property_cache
 from lp.soyuz.adapters.archivedependencies import expand_dependencies
 from lp.soyuz.adapters.packagelocation import PackageLocation
 from lp.soyuz.enums import (
@@ -1839,7 +1839,7 @@
                 signing_key = owner.archive.signing_key
             else:
                 # owner.archive is a cached property and we've just cached it.
-                del IPropertyCache(owner).archive
+                del get_property_cache(owner).archive
 
         new_archive = Archive(
             owner=owner, distribution=distribution, name=name,

=== modified file 'lib/lp/soyuz/model/distroseriesbinarypackage.py'
--- lib/lp/soyuz/model/distroseriesbinarypackage.py	2010-08-24 10:45:57 +0000
+++ lib/lp/soyuz/model/distroseriesbinarypackage.py	2010-10-25 08:29:45 +0000
@@ -15,7 +15,7 @@
 from canonical.database.sqlbase import sqlvalues
 from lp.services.propertycache import (
     cachedproperty,
-    IPropertyCache,
+    get_property_cache,
     )
 from lp.soyuz.interfaces.distroseriesbinarypackage import (
     IDistroSeriesBinaryPackage,
@@ -43,7 +43,7 @@
         self.distroseries = distroseries
         self.binarypackagename = binarypackagename
         if cache is not None:
-            IPropertyCache(self).cache = cache
+            get_property_cache(self).cache = cache
 
     @property
     def name(self):

=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py	2010-10-22 21:04:06 +0000
+++ lib/lp/testing/factory.py	2010-10-25 08:29:45 +0000
@@ -82,10 +82,10 @@
     EmailAddressStatus,
     IEmailAddressSet,
     )
-from canonical.launchpad.interfaces.oauth import IOAuthConsumerSet
 from canonical.launchpad.interfaces.gpghandler import IGPGHandler
 from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
 from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
+from canonical.launchpad.interfaces.oauth import IOAuthConsumerSet
 from canonical.launchpad.interfaces.temporaryblobstorage import (
     ITemporaryStorageManager,
     )
@@ -220,7 +220,7 @@
 from lp.registry.model.suitesourcepackage import SuiteSourcePackage
 from lp.services.mail.signedmessage import SignedMessage
 from lp.services.openid.model.openididentifier import OpenIdIdentifier
-from lp.services.propertycache import IPropertyCacheManager
+from lp.services.propertycache import clear_property_cache
 from lp.services.worlddata.interfaces.country import ICountrySet
 from lp.services.worlddata.interfaces.language import ILanguageSet
 from lp.soyuz.adapters.packagelocation import PackageLocation
@@ -1947,7 +1947,7 @@
 
         # We clear the cache on the diff, returning the object as if it
         # was just loaded from the store.
-        IPropertyCacheManager(diff).clear()
+        clear_property_cache(diff)
         return diff
 
     def makeDistroSeriesDifferenceComment(

=== modified file 'lib/lp/testopenid/browser/server.py'
--- lib/lp/testopenid/browser/server.py	2010-08-24 10:45:57 +0000
+++ lib/lp/testopenid/browser/server.py	2010-10-25 08:29:45 +0000
@@ -62,7 +62,7 @@
     )
 from lp.services.propertycache import (
     cachedproperty,
-    IPropertyCache,
+    get_property_cache,
     )
 from lp.testopenid.interfaces.server import (
     get_server_url,
@@ -168,7 +168,7 @@
     def restoreRequestFromSession(self):
         """Get the OpenIDRequest from our session."""
         session = self.getSession()
-        cache = IPropertyCache(self)
+        cache = get_property_cache(self)
         try:
             cache.openid_parameters = session[OPENID_REQUEST_SESSION_KEY]
         except KeyError: