Commit 7fa6b98a authored by Hanno Schlichting's avatar Hanno Schlichting

More Five avoidance

parent b96b2151
......@@ -152,9 +152,6 @@ class ObjectManager(CopyContainer,
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()
......
......@@ -183,8 +183,7 @@ subscribe to them.
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.
......
......@@ -117,7 +117,7 @@ def _registerClass(class_, meta_type, permission, addview, icon, global_):
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,
......
import unittest
from zope.component.testing import PlacelessSetup
from zope.interface import implements
from AccessControl.Owned import EmergencyUserCannotOwn
from AccessControl.SecurityManagement import newSecurityManager
......@@ -11,6 +12,7 @@ from Acquisition import aq_base
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
......@@ -61,12 +63,12 @@ class ItemForDeletion(SimpleItem):
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 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
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 ):
......
......@@ -186,8 +186,7 @@ class TestTraverse( unittest.TestCase ):
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 @@ class SimpleClass(object):
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
......@@ -435,7 +433,7 @@ def test_traversable():
... 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 @@ def test_traversable():
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(
......
......@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test events triggered by Five
"""Test events
$Id$
"""
......
......@@ -62,7 +62,7 @@ def test_registerClass():
... if info['name'] == 'Foo Type':
... break
>>> info['product']
'Five'
'OFS'
>>> info['permission']
'Add Foo'
>>> ISimpleContent in info['interfaces']
......@@ -113,7 +113,7 @@ def test_registerClass():
... if info['name'] == 'Bar Type':
... break
>>> info['product']
'Five'
'OFS'
>>> info['permission']
'Add Bar'
>>> ISimpleContent in info['interfaces']
......
......@@ -719,6 +719,14 @@ class HTTPRequestTests(unittest.TestCase):
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 @@ class HTTPRequestTests(unittest.TestCase):
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 @@ class HTTPRequestTests(unittest.TestCase):
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')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment