[z3-checkins] r5483 - in z3/Five/trunk: demo/FiveDemo doc tests
philikon at codespeak.net
philikon at codespeak.net
Thu Jul 8 12:58:03 MEST 2004
Author: philikon
Date: Thu Jul 8 12:58:02 2004
New Revision: 5483
Modified:
z3/Five/trunk/demo/FiveDemo/__init__.py
z3/Five/trunk/doc/manual.txt
z3/Five/trunk/tests/test_five.py
Log:
getAdapter for simple adaption is not only deprecated but doesn't
work anymore as of a few days ago.
Modified: z3/Five/trunk/demo/FiveDemo/__init__.py
==============================================================================
--- z3/Five/trunk/demo/FiveDemo/__init__.py (original)
+++ z3/Five/trunk/demo/FiveDemo/__init__.py Thu Jul 8 12:58:02 2004
@@ -2,15 +2,9 @@
def initialize(context):
# after everything is configured, we can use adapters
-
- from zope.component import getAdapter
from classes import MyClass
from interfaces import INewInterface
object = MyClass()
- adapted = getAdapter(object, INewInterface)
- print adapted.anotherMethod()
-
- # shortcut
adapted = INewInterface(object)
print adapted.anotherMethod()
Modified: z3/Five/trunk/doc/manual.txt
==============================================================================
--- z3/Five/trunk/doc/manual.txt (original)
+++ z3/Five/trunk/doc/manual.txt Thu Jul 8 12:58:02 2004
@@ -210,18 +210,12 @@
the product's directory. Any object that provides ``INewInterface``
can now be adapted to ``INewInterface``, like this::
- from zope.component import getAdapter
from classes import MyClass
from interfaces import INewInterface
object = MyClass()
- adapted = getAdapter(object, INewInterface)
- print adapted.anotherMethod()
-
-A shortcut for ``getAdapter()`` is to call the interface directly,
-like this::
-
adapted = INewInterface(object)
+ print adapted.anotherMethod()
Views in Five
-------------
Modified: z3/Five/trunk/tests/test_five.py
==============================================================================
--- z3/Five/trunk/tests/test_five.py (original)
+++ z3/Five/trunk/tests/test_five.py Thu Jul 8 12:58:02 2004
@@ -12,7 +12,6 @@
ZopeTestCase.installProduct('FiveTest')
ZopeTestCase.installProduct('Five')
-from zope.component import getAdapter
from Products.FiveTest.classes import Adaptable, Origin
from Products.FiveTest.interfaces import IAdapted, IDestination
from Products.FiveTest.browser import SimpleContentView
@@ -28,7 +27,7 @@
def test_adapters(self):
obj = Adaptable()
- adapted = getAdapter(obj, IAdapted)
+ adapted = IAdapted(obj)
self.assertEquals(
"Adapted: The method",
adapted.adaptedMethod())
More information about the z3-checkins
mailing list