[Checkins] SVN: zope.preference/trunk/ minimized dependencies

Michael Howitz mh at gocept.com
Sat Jun 12 06:04:58 EDT 2010


Log message for revision 113372:
  minimized dependencies
  
  

Changed:
  U   zope.preference/trunk/CHANGES.txt
  U   zope.preference/trunk/setup.py
  U   zope.preference/trunk/src/zope/preference/README.txt
  U   zope.preference/trunk/src/zope/preference/default.py
  U   zope.preference/trunk/src/zope/preference/preference.py

-=-
Modified: zope.preference/trunk/CHANGES.txt
===================================================================
--- zope.preference/trunk/CHANGES.txt	2010-06-11 21:18:17 UTC (rev 113371)
+++ zope.preference/trunk/CHANGES.txt	2010-06-12 10:04:58 UTC (rev 113372)
@@ -7,3 +7,8 @@
 
 - Split out from `zope.app.preference`.
 
+- Removed dependency on `zope.app.component.hooks` by using
+  `zope.component.hooks`.
+
+- Removed dependency on `zope.app.container` by using
+  `zope.container`.
\ No newline at end of file

Modified: zope.preference/trunk/setup.py
===================================================================
--- zope.preference/trunk/setup.py	2010-06-11 21:18:17 UTC (rev 113371)
+++ zope.preference/trunk/setup.py	2010-06-12 10:04:58 UTC (rev 113372)
@@ -59,27 +59,12 @@
       namespace_packages=['zope'],
       extras_require=dict(test=[
           'zope.app.testing',
-          'zope.app.zcmlfiles',
-          'zope.securitypolicy',
-          'zope.testbrowser',
-          'zope.testing',
           ]),
       install_requires = ['setuptools',
                           'ZODB3',
                           'zope.annotation',
-                          'zope.app.basicskin',
-                          'zope.app.component',
-                          'zope.app.form',
-                          'zope.app.pagetemplate',
-                          'zope.app.renderer',
-                          'zope.app.tree',
-                          'zope.component',
-                          'zope.configuration',
+                          'zope.component >= 3.8.0',
                           'zope.container',
-                          'zope.i18n',
-                          'zope.i18nmessageid',
-                          'zope.interface',
-                          'zope.location',
                           'zope.schema',
                           'zope.security',
                           'zope.traversing',

Modified: zope.preference/trunk/src/zope/preference/README.txt
===================================================================
--- zope.preference/trunk/src/zope/preference/README.txt	2010-06-11 21:18:17 UTC (rev 113371)
+++ zope.preference/trunk/src/zope/preference/README.txt	2010-06-12 10:04:58 UTC (rev 113372)
@@ -15,8 +15,8 @@
 
   >>> from zope.app.testing import setup
 
-  >>> import zope.app.component.hooks
-  >>> zope.app.component.hooks.setHooks()
+  >>> import zope.component.hooks
+  >>> zope.component.hooks.setHooks()
   >>> setup.setUpTraversal()
   >>> setup.setUpSiteManagerLookup()
 
@@ -116,9 +116,9 @@
   ...     def __init__(self, principal, context):
   ...         pass
 
-  >>> from zope.app.testing import ztapi
-  >>> ztapi.provideAdapter((Principal, zope.interface.Interface), IAnnotations,
-  ...                      PrincipalAnnotations)
+  >>> from zope.component import provideAdapter
+  >>> provideAdapter(PrincipalAnnotations,
+  ...                (Principal, zope.interface.Interface), IAnnotations)
 
 Let's now try to access the settings again:
 
@@ -180,12 +180,12 @@
 ... but not before we register the groups as utilities:
 
   >>> from zope.preference import interfaces
-  >>> from zope.app.testing import ztapi
+  >>> from zope.component import provideUtility
 
-  >>> ztapi.provideUtility(interfaces.IPreferenceGroup, settings,
-  ...                      name='ZMISettings')
-  >>> ztapi.provideUtility(interfaces.IPreferenceGroup, folderSettings,
-  ...                      name='ZMISettings.Folder')
+  >>> provideUtility(settings, interfaces.IPreferenceGroup,
+  ...                name='ZMISettings')
+  >>> provideUtility(folderSettings, interfaces.IPreferenceGroup,
+  ...                name='ZMISettings.Folder')
 
 If we now try to lookup the sub-group again, we should be successful:
 
@@ -279,7 +279,7 @@
 
 Of course, once the root site becomes our active site again
 
-  >>> zope.app.component.hooks.setSite(root)
+  >>> zope.component.hooks.setSite(root)
 
 the default value of the root provider is used:
 
@@ -409,8 +409,7 @@
 This function is also commonly registered as an adapter,
 
   >>> from zope.location.interfaces import ILocation
-  >>> ztapi.provideAdapter(ILocation, interfaces.IUserPreferences,
-  ...                      UserPreferences)
+  >>> provideAdapter(UserPreferences, [ILocation], interfaces.IUserPreferences)
 
 so that you can adapt any location to the user preferences:
 
@@ -430,9 +429,8 @@
 namespace:
 
   >>> import zope.traversing.interfaces
-  >>> ztapi.provideAdapter(None,
+  >>> provideAdapter(preference.preferencesNamespace, [None],
   ...                      zope.traversing.interfaces.ITraversable,
-  ...                      preference.preferencesNamespace,
   ...                      'preferences')
 
 We can now access the preferences as follows:

Modified: zope.preference/trunk/src/zope/preference/default.py
===================================================================
--- zope.preference/trunk/src/zope/preference/default.py	2010-06-11 21:18:17 UTC (rev 113371)
+++ zope.preference/trunk/src/zope/preference/default.py	2010-06-12 10:04:58 UTC (rev 113372)
@@ -25,8 +25,8 @@
 from zope.traversing.interfaces import IContainmentRoot
 from zope.location import locate
 
-import zope.app.component
-from zope.app.container.contained import Contained
+import zope.component
+from zope.container.contained import Contained
 from zope.preference import preference, interfaces
 
 class DefaultPreferenceProvider(persistent.Persistent, Contained):
@@ -90,7 +90,7 @@
 
             # There is currently no local entry, so let's go to the next
             # provider and lookup the group and value there.
-            nextProvider = zope.app.component.queryNextUtility(
+            nextProvider = zope.component.queryNextUtility(
                 self.provider, interfaces.IDefaultPreferenceProvider)
 
             # No more providers found, so return the schema's default

Modified: zope.preference/trunk/src/zope/preference/preference.py
===================================================================
--- zope.preference/trunk/src/zope/preference/preference.py	2010-06-11 21:18:17 UTC (rev 113371)
+++ zope.preference/trunk/src/zope/preference/preference.py	2010-06-12 10:04:58 UTC (rev 113372)
@@ -27,7 +27,7 @@
 from zope.location import LocationProxy, locate, Location
 from zope.annotation.interfaces import IAnnotations
 
-import zope.app.component.hooks
+import zope.component.hooks
 from zope.container.contained import Contained
 from zope.container.interfaces import IReadContainer
 
@@ -74,7 +74,7 @@
     # ``__setattr__`` this is not possible anymore.
     __parent = None
     def __parent__(self):
-        return self.__parent or zope.app.component.hooks.getSite()
+        return self.__parent or zope.component.hooks.getSite()
     __parent__ = property(__parent__)
 
 



More information about the checkins mailing list