[Checkins] SVN: five.localsitemanager/trunk/ Whitespace cleanup,
prepare for release
Hanno Schlichting
plone at hannosch.info
Sat Jun 30 07:25:43 EDT 2007
Log message for revision 77261:
Whitespace cleanup, prepare for release
Changed:
U five.localsitemanager/trunk/CHANGES.txt
D five.localsitemanager/trunk/MANIFEST.in
D five.localsitemanager/trunk/setup.cfg
U five.localsitemanager/trunk/setup.py
U five.localsitemanager/trunk/src/five/localsitemanager/__init__.py
U five.localsitemanager/trunk/src/five/localsitemanager/browser.py
U five.localsitemanager/trunk/src/five/localsitemanager/browser.txt
U five.localsitemanager/trunk/src/five/localsitemanager/localsitemanager.txt
-=-
Modified: five.localsitemanager/trunk/CHANGES.txt
===================================================================
--- five.localsitemanager/trunk/CHANGES.txt 2007-06-30 01:13:34 UTC (rev 77260)
+++ five.localsitemanager/trunk/CHANGES.txt 2007-06-30 11:25:42 UTC (rev 77261)
@@ -2,7 +2,7 @@
CHANGES
=======
-five.localsitemanager 0.1.3 (unreleased)
+five.localsitemanager 0.2.0 (2007-06-30)
========================================
* Refactored and fixed aq wrapping: Nested site managers now return utilities
Deleted: five.localsitemanager/trunk/MANIFEST.in
===================================================================
--- five.localsitemanager/trunk/MANIFEST.in 2007-06-30 01:13:34 UTC (rev 77260)
+++ five.localsitemanager/trunk/MANIFEST.in 2007-06-30 11:25:42 UTC (rev 77261)
@@ -1 +0,0 @@
-exclude setup.cfg
Deleted: five.localsitemanager/trunk/setup.cfg
===================================================================
--- five.localsitemanager/trunk/setup.cfg 2007-06-30 01:13:34 UTC (rev 77260)
+++ five.localsitemanager/trunk/setup.cfg 2007-06-30 11:25:42 UTC (rev 77261)
@@ -1,4 +0,0 @@
-
-[egg_info]
-tag_build = .dev
-tag_svn_revision = 1
Modified: five.localsitemanager/trunk/setup.py
===================================================================
--- five.localsitemanager/trunk/setup.py 2007-06-30 01:13:34 UTC (rev 77260)
+++ five.localsitemanager/trunk/setup.py 2007-06-30 11:25:42 UTC (rev 77261)
@@ -5,7 +5,7 @@
import os
from setuptools import setup, Extension
-version = '0.1.3'
+version = '0.2.0'
setup(name='five.localsitemanager',
version=version,
Modified: five.localsitemanager/trunk/src/five/localsitemanager/__init__.py
===================================================================
--- five.localsitemanager/trunk/src/five/localsitemanager/__init__.py 2007-06-30 01:13:34 UTC (rev 77260)
+++ five.localsitemanager/trunk/src/five/localsitemanager/__init__.py 2007-06-30 11:25:42 UTC (rev 77261)
@@ -7,12 +7,11 @@
from Products.Five.component.interfaces import IObjectManagerSite
from Products.Five.component import enableSite
+
def make_site(obj, iface=ISite):
"""Give the specified object required qualities to identify it as a proper
ISite.
"""
-
- # we intentionally test for ISite and not iface
if ISite.providedBy(obj):
raise ValueError('This is already a site')
@@ -31,11 +30,11 @@
obj.setSiteManager(components)
components.__parent__ = aq_base(obj)
+
def make_objectmanager_site(obj):
"""Just a bit of sugar coating to make an unnofficial objectmanager
based site.
"""
-
make_site(obj, IObjectManagerSite)
@@ -43,12 +42,11 @@
"""Find the closest sitemanager that is not the specified site's
sitemanager.
"""
-
container = site
sm = None
while sm is None:
if IContainmentRoot.providedBy(container):
- # we're the root site, return None
+ # We are at the root site, return None
return None
try:
@@ -56,25 +54,26 @@
if container is None:
return None
except TypeError:
- # there was not enough context; probably run from a test
+ # There was not enough context; probably run from a test
return None
if ISite.providedBy(container):
sm = container.getSiteManager()
return sm
+
def update_sitemanager_bases(site):
"""Formulate the most appropriate __bases__ value for a site's site manager
by asking find_next_sitemanager what the next appropriate site manager
is. After this call, the __bases__ is guaranteed to have one and only
one value in the __bases__ list/tuple.
"""
-
next = find_next_sitemanager(site)
if next is None:
next = base
sm = site.getSiteManager()
sm.__bases__ = (next, )
+
def update_sitemanager_bases_handler(site, event):
update_sitemanager_bases(site)
Modified: five.localsitemanager/trunk/src/five/localsitemanager/browser.py
===================================================================
--- five.localsitemanager/trunk/src/five/localsitemanager/browser.py 2007-06-30 01:13:34 UTC (rev 77260)
+++ five.localsitemanager/trunk/src/five/localsitemanager/browser.py 2007-06-30 11:25:42 UTC (rev 77261)
@@ -3,6 +3,7 @@
from Products.Five.component.browser import ObjectManagerSiteView
+
class ObjectManagerSiteView(ObjectManagerSiteView):
"""Configure the site setup for an ObjectManager.
"""
Modified: five.localsitemanager/trunk/src/five/localsitemanager/browser.txt
===================================================================
--- five.localsitemanager/trunk/src/five/localsitemanager/browser.txt 2007-06-30 01:13:34 UTC (rev 77260)
+++ five.localsitemanager/trunk/src/five/localsitemanager/browser.txt 2007-06-30 11:25:42 UTC (rev 77261)
@@ -46,8 +46,8 @@
>>> browser.getControl('Add').click()
>>> browser.getLink('folder').click()
-Look up the ``components.html`` view and make sure the
-``Make Site`` action still works.
+Look up the ``components.html`` view and make sure the ``Make Site`` action
+still works.
>>> browser.open('http://localhost/folder/components.html')
>>> browser.getControl('Make site').click()
Modified: five.localsitemanager/trunk/src/five/localsitemanager/localsitemanager.txt
===================================================================
--- five.localsitemanager/trunk/src/five/localsitemanager/localsitemanager.txt 2007-06-30 01:13:34 UTC (rev 77260)
+++ five.localsitemanager/trunk/src/five/localsitemanager/localsitemanager.txt 2007-06-30 11:25:42 UTC (rev 77261)
@@ -1,7 +1,7 @@
Local Site Manager
==================
-We start from an empty folder. Since ``OFS.Folder``'s extend
+We start from an empty folder. Since ``OFS.Folder``'s extend
``ObjectSiteManager`` they all get to be ``IPossibleSite``'s.
>>> from OFS.Folder import Folder
@@ -27,8 +27,8 @@
Utilities
---------
-Utilities can now be registered with our site manager. We can confirm this
-by setting up a test utility.
+Utilities can now be registered with our site manager. We can confirm this by
+setting up a test utility.
>>> from OFS.SimpleItem import SimpleItem
>>> from zope import interface
@@ -61,8 +61,8 @@
Adapters
---------
-Adapters can now be registered with our site manager. We can confirm this
-by setting up a test adapter.
+Adapters can now be registered with our site manager. We can confirm this by
+setting up a test adapter.
>>> from OFS.SimpleItem import SimpleItem
>>> from zope import interface
@@ -105,37 +105,37 @@
-----------
Now to mix a little required Zope 2 confusion into everything, we must ensure
-that the aq chain is predictable. And based on consensus we decided that
-the acquired parent of a returned utility should be the ``ISite`` that
-owns the ``ISiteManager`` that returned the utility. We need to ensure
-all the ways of getting a utility have been covered. Of course this should
-only happen if the utility is acquisition aware to begin with.
+that the aq chain is predictable. And based on consensus we decided that the
+acquired parent of a returned utility should be the ``ISite`` that owns the
+``ISiteManager`` that returned the utility. We need to ensure all the ways of
+getting a utility have been covered. Of course this should only happen if the
+utility is acquisition aware to begin with.
>>> import Acquisition
>>> from Acquisition.interfaces import IAcquirer
First off, our utility isn't aq-wrapped so asking it what is aq_parent is
should return None.
-
+
>>> comp = sitemanager.queryUtility(ITestUtility, name=u'hello_world')
>>> Acquisition.aq_parent(comp) is None
True
-So now we setup a utility that is aq aware.
+So now we setup a utility that is aq-aware.
>>> class AQTestUtility(Acquisition.Explicit, TestUtility): pass
>>> sitemanager.registerUtility(AQTestUtility('test'),
... name=u'aq_wrapped',
... provided=ITestUtility)
-And of course the aq parents should be the site now.
+And of course the aq parent should be the site now.
>>> comp = sitemanager.getUtility(ITestUtility, name=u'aq_wrapped')
>>> Acquisition.aq_parent(comp) is site
True
-And just to mix things up a bit. Getting back multiple utilities should
-allow us to test both aq and non-aq based components.
+And just to mix things up a bit. Getting back multiple utilities should allow
+us to test both aq and non-aq based components.
We start with getUtilitiesFor():
@@ -161,7 +161,8 @@
And then getAllUtilitiesRegisteredFor():
- >>> utils = [x for x in sitemanager.getAllUtilitiesRegisteredFor(ITestUtility)]
+ >>> utils = [x for x in
+ ... sitemanager.getAllUtilitiesRegisteredFor(ITestUtility)]
>>> len(utils)
2
@@ -203,12 +204,12 @@
------------
Whenever a component is queried using the component registry, the active
-component registry (ie site manager) needs to be smart enough to check
-all *parent* component registries as well.
+component registry (ie site manager) needs to be smart enough to check all
+*parent* component registries as well.
-Implementation-wise this means that each component registry needs to have
-an appropriate ``__bases__`` attribute configured that is aware of
-containment and (in the case of Zope 2) acquisition to some respect.
+Implementation-wise this means that each component registry needs to have an
+appropriate ``__bases__`` attribute configured that is aware of containment
+and (in the case of Zope 2) acquisition to some respect.
Start by creating some nested sites.
@@ -301,7 +302,7 @@
<Utility AQTestUtility "util1">
We expect to get wrapped in the context of the site manager the utility is
-registered for:
+registered with:
>>> util1.aq_chain
[<Utility AQTestUtility "util1">, <Folder at folder1>]
@@ -353,7 +354,7 @@
>>> globalutil1
<Utility AQTestUtility "globalutil1">
-We don't expect the global utility to get any Acquisition context:
+We expect the global utility to get no Acquisition context:
>>> getattr(globalutil1, 'aq_chain', None) is None
True
@@ -368,3 +369,9 @@
>>> localutil1.aq_chain
[<Utility AQTestUtility "localutil1">, <Folder at folder1>]
+Clean up
+--------
+
+ >>> from zope.testing.cleanup import cleanUp
+ >>> clearSite()
+ >>> cleanUp()
More information about the Checkins
mailing list