diff options
| author | Jim Fulton <jim@jimfulton.info> | 2017-05-12 18:00:33 -0400 |
|---|---|---|
| committer | Jim Fulton <jim@jimfulton.info> | 2017-05-12 18:00:33 -0400 |
| commit | ca51b02adb512cab0dbc7a157e67ae7d63f4141d (patch) | |
| tree | 09de2eb2115e0741662f802730bb2b6ad4f0502b | |
| parent | c95f1e2e73136e08e586395f46d97bc2a23cc99c (diff) | |
| download | zope-interface-simplify-utility-registrations-cache.tar.gz | |
Added some comments to describe the management of _v_utility_registrations_cachesimplify-utility-registrations-cache
| -rw-r--r-- | src/zope/interface/registry.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/zope/interface/registry.py b/src/zope/interface/registry.py index 3251d81..8539d27 100644 --- a/src/zope/interface/registry.py +++ b/src/zope/interface/registry.py @@ -145,6 +145,9 @@ class Components(object): self._init_registrations() self.__bases__ = tuple(bases) + # __init__ is used for test cleanup as well as initialization. + # XXX add a separate API for test cleanup. + # See _utility_registrations below. if hasattr(self, '_v_utility_registrations_cache'): del self._v_utility_registrations_cache @@ -163,6 +166,10 @@ class Components(object): @property def _utility_registrations_cache(self): + # We use a _v_ attribute internally so that data aren't saved in ZODB. + # If data are pickled in other contexts, the data will be carried along. + # There's no harm in pickling the extra data othr than that it would + # be somewhat wasteful. It's doubtful that that's an issue anyway. try: return self._v_utility_registrations_cache except AttributeError: |
