[Zope-Checkins] SVN: Zope/trunk/src/ More Five avoidance
Hanno Schlichting
hannosch at hannosch.eu
Tue Mar 30 18:29:41 EDT 2010
Log message for revision 110343:
More Five avoidance
Changed:
U Zope/trunk/src/OFS/ObjectManager.py
U Zope/trunk/src/OFS/event.txt
U Zope/trunk/src/OFS/metaconfigure.py
U Zope/trunk/src/OFS/tests/testObjectManager.py
U Zope/trunk/src/OFS/tests/testTraverse.py
U Zope/trunk/src/OFS/tests/test_event.py
U Zope/trunk/src/OFS/tests/test_registerclass.py
U Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py
-=-
Modified: Zope/trunk/src/OFS/ObjectManager.py
===================================================================
--- Zope/trunk/src/OFS/ObjectManager.py 2010-03-30 22:12:41 UTC (rev 110342)
+++ Zope/trunk/src/OFS/ObjectManager.py 2010-03-30 22:29:41 UTC (rev 110343)
@@ -152,9 +152,6 @@
This class provides core behavior for collections of heterogeneous objects.
"""
- # The claim to implement IContainer has been made during the Zope3
- # integration project called Five but hasn't been completed in full.
-
implements(IObjectManager)
security = ClassSecurityInfo()
Modified: Zope/trunk/src/OFS/event.txt
===================================================================
--- Zope/trunk/src/OFS/event.txt 2010-03-30 22:12:41 UTC (rev 110342)
+++ Zope/trunk/src/OFS/event.txt 2010-03-30 22:29:41 UTC (rev 110343)
@@ -183,8 +183,7 @@
so it doesn't have a location.
There are only a few basic use cases about what one wants to do with
-respect to events (but you might want to read the full story in
-Five/tests/event.txt).
+respect to events.
The first use case is the one where the object has to be aware of its
path, like in the CoolDocument example above.
Modified: Zope/trunk/src/OFS/metaconfigure.py
===================================================================
--- Zope/trunk/src/OFS/metaconfigure.py 2010-03-30 22:12:41 UTC (rev 110342)
+++ Zope/trunk/src/OFS/metaconfigure.py 2010-03-30 22:29:41 UTC (rev 110343)
@@ -117,7 +117,7 @@
info = {'name': meta_type,
'action': addview and ('+/%s' % addview) or '',
- 'product': 'Five',
+ 'product': 'OFS',
'permission': str(permission_obj.title),
'visibility': global_ and 'Global' or None,
'interfaces': interfaces,
Modified: Zope/trunk/src/OFS/tests/testObjectManager.py
===================================================================
--- Zope/trunk/src/OFS/tests/testObjectManager.py 2010-03-30 22:12:41 UTC (rev 110342)
+++ Zope/trunk/src/OFS/tests/testObjectManager.py 2010-03-30 22:29:41 UTC (rev 110343)
@@ -1,6 +1,7 @@
import unittest
from zope.component.testing import PlacelessSetup
+from zope.interface import implements
from AccessControl.Owned import EmergencyUserCannotOwn
from AccessControl.SecurityManagement import newSecurityManager
@@ -11,13 +12,14 @@
from Acquisition import Implicit
from App.config import getConfiguration
from logging import getLogger
+from OFS.interfaces import IItem
from OFS.metaconfigure import setDeprecatedManageAddDelete
from OFS.ObjectManager import ObjectManager
from OFS.SimpleItem import SimpleItem
from Zope2.App import zcml
from zExceptions import BadRequest
-logger = getLogger('OFS.subscribers')
+logger = getLogger('OFS.subscribers')
class FauxRoot( Implicit ):
@@ -61,12 +63,12 @@
def manage_afterClone(self, item):
pass
-from zope.interface import implements
-from OFS.interfaces import IItem
+
class ObjectManagerWithIItem(ObjectManager):
"""The event subscribers work on IItem."""
implements(IItem)
+
class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
def setUp(self):
@@ -92,11 +94,13 @@
def _makeOne( self, *args, **kw ):
return self._getTargetClass()( *args, **kw ).__of__( FauxRoot() )
- def test_z3interfaces(self):
+ def test_interfaces(self):
from OFS.interfaces import IObjectManager
from OFS.ObjectManager import ObjectManager
+ from zope.container.interfaces import IContainer
from zope.interface.verify import verifyClass
+ verifyClass(IContainer, ObjectManager)
verifyClass(IObjectManager, ObjectManager)
def test_setObject_set_owner_with_no_user( self ):
Modified: Zope/trunk/src/OFS/tests/testTraverse.py
===================================================================
--- Zope/trunk/src/OFS/tests/testTraverse.py 2010-03-30 22:12:41 UTC (rev 110342)
+++ Zope/trunk/src/OFS/tests/testTraverse.py 2010-03-30 22:29:41 UTC (rev 110343)
@@ -186,8 +186,7 @@
class BoboTraversableWithAcquisition(SimpleItem):
""" A BoboTraversable which may use acquisition to find objects.
- This is similar to how the __bobo_traverse__ added by Five
- behaves).
+ This is similar to how the __bobo_traverse__ behaves).
"""
def __bobo_traverse__(self, request, name):
@@ -409,9 +408,8 @@
def test_traversable():
"""
- Test the behaviour of unrestrictedTraverse and views. The tests are
- copies from Five.browser.tests.test_traversable, but instead of
- publishing they do unrestrictedTraverse.
+ Test the behaviour of unrestrictedTraverse and views. The tests don't
+ use publishing but do unrestrictedTraverse instead.
>>> import Products.Five
>>> from Zope2.App import zcml
@@ -433,9 +431,9 @@
... self.folder.testoid.unrestrictedTraverse('doesntexist')
... except NotFound:
... pass
-
+
Now let's take class which already has a __bobo_traverse__ method.
- Five should correctly use that as a fallback.
+ We should correctly use that as a fallback.
>>> configure_zcml = '''
... <configure xmlns="http://namespaces.zope.org/zope"
@@ -527,7 +525,7 @@
Without a __bobo_traverse__ method this would have returned the attribute
value 'This is an attribute'. Let's make sure the same thing happens for
- an object that has been marked traversable by Five:
+ an object that has been marked traversable:
>>> self.folder.fancy.an_attribute = 'This is an attribute'
>>> self.folder.fancy.unrestrictedTraverse(
Modified: Zope/trunk/src/OFS/tests/test_event.py
===================================================================
--- Zope/trunk/src/OFS/tests/test_event.py 2010-03-30 22:12:41 UTC (rev 110342)
+++ Zope/trunk/src/OFS/tests/test_event.py 2010-03-30 22:29:41 UTC (rev 110343)
@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Test events triggered by Five
+"""Test events
$Id$
"""
Modified: Zope/trunk/src/OFS/tests/test_registerclass.py
===================================================================
--- Zope/trunk/src/OFS/tests/test_registerclass.py 2010-03-30 22:12:41 UTC (rev 110342)
+++ Zope/trunk/src/OFS/tests/test_registerclass.py 2010-03-30 22:29:41 UTC (rev 110343)
@@ -62,7 +62,7 @@
... if info['name'] == 'Foo Type':
... break
>>> info['product']
- 'Five'
+ 'OFS'
>>> info['permission']
'Add Foo'
>>> ISimpleContent in info['interfaces']
@@ -113,7 +113,7 @@
... if info['name'] == 'Bar Type':
... break
>>> info['product']
- 'Five'
+ 'OFS'
>>> info['permission']
'Add Bar'
>>> ISimpleContent in info['interfaces']
Modified: Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py
===================================================================
--- Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py 2010-03-30 22:12:41 UTC (rev 110342)
+++ Zope/trunk/src/ZPublisher/tests/testHTTPRequest.py 2010-03-30 22:29:41 UTC (rev 110343)
@@ -604,19 +604,19 @@
self.assertEquals(req.cookies['hmm'], '')
self.assertEquals(req.cookies['baz'], 'gee')
- # Unquoted multi-space cookies
+ # Unquoted multi-space cookies
env['HTTP_COOKIE'] = 'single=cookie data; ' \
- 'quoted="cookie data with unquoted spaces"; ' \
- 'multi=cookie data with unquoted spaces; ' \
- 'multi2=cookie data with unquoted spaces'
+ 'quoted="cookie data with unquoted spaces"; ' \
+ 'multi=cookie data with unquoted spaces; ' \
+ 'multi2=cookie data with unquoted spaces'
req = self._makeOne(environ=env)
self.assertEquals(req.cookies['single'], 'cookie data')
self.assertEquals(req.cookies['quoted'],
- 'cookie data with unquoted spaces')
+ 'cookie data with unquoted spaces')
self.assertEquals(req.cookies['multi'],
- 'cookie data with unquoted spaces')
+ 'cookie data with unquoted spaces')
self.assertEquals(req.cookies['multi2'],
- 'cookie data with unquoted spaces')
+ 'cookie data with unquoted spaces')
@@ -719,6 +719,14 @@
request['debug'] = '2'
self.assertEqual(request.debug, '2')
+ def test_interfaces(self):
+ from zope.publisher.interfaces.browser import IBrowserRequest
+ from zope.interface.verify import verifyClass
+ klass = self._getTargetClass()
+
+ # TODO
+ # verifyClass(IBrowserRequest, klass)
+
def test_locale_property_accessor(self):
from zope.component import provideAdapter
from zope.publisher.browser import BrowserLanguages
@@ -751,7 +759,6 @@
from zope.publisher.browser import BrowserLanguages
from zope.publisher.interfaces.http import IHTTPRequest
from zope.i18n.interfaces import IUserPreferredLanguages
- from zope.i18n.interfaces.locales import ILocale
provideAdapter(BrowserLanguages, [IHTTPRequest],
IUserPreferredLanguages)
@@ -844,7 +851,7 @@
request = self._makeOne(environ=env)
self.assertEqual(request.method, 'GET')
- def test_method_GET(self):
+ def test_method_POST(self):
env = {'REQUEST_METHOD': 'POST'}
request = self._makeOne(environ=env)
self.assertEqual(request.method, 'POST')
More information about the Zope-Checkins
mailing list