[Zope3-checkins] CVS: Zope3/src/zope/app/pythonpage -
__init__.py:1.4 tests.py:1.3
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Mar 2 10:50:05 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/pythonpage
In directory cvs.zope.org:/tmp/cvs-serv5794/src/zope/app/pythonpage
Modified Files:
__init__.py tests.py
Log Message:
Updated other code to use interpreter utilities instead of interpreter
service.
=== Zope3/src/zope/app/pythonpage/__init__.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/pythonpage/__init__.py:1.3 Tue Mar 2 09:24:30 2004
+++ Zope3/src/zope/app/pythonpage/__init__.py Tue Mar 2 10:50:04 2004
@@ -19,6 +19,8 @@
from persistent import Persistent
from zope.app import zapi
from zope.app.container.contained import Contained
+from zope.app.interpreter.interfaces import IInterpreter
+from zope.component.servicenames import Utilities
from zope.interface import Interface, implements
from zope.schema import SourceText, TextLine
from zope.app.i18n import ZopeMessageIDFactory as _
@@ -61,8 +63,7 @@
Examples::
- >>> from tests import setUp, tearDown, Root
- >>> setUp()
+ >>> from tests import Root
>>> pp = PythonPage()
>>> pp.__parent__ = Root()
@@ -100,8 +101,6 @@
... except SyntaxError, err:
... print err
invalid syntax (pp, line 1)
-
- >>> tearDown()
"""
implements(IPythonPage)
@@ -177,6 +176,7 @@
kw['script'] = self
kw['context'] = zapi.getParent(self)
- service = zapi.getService(self, 'Interpreter')
- interpreter = service.queryInterpreter('text/server-python')
+ service = zapi.getService(self, Utilities)
+ interpreter = service.queryUtility(IInterpreter,
+ name='text/server-python')
return interpreter.evaluate(self._v_compiled, kw)
=== Zope3/src/zope/app/pythonpage/tests.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/pythonpage/tests.py:1.2 Tue Feb 24 11:50:28 2004
+++ Zope3/src/zope/app/pythonpage/tests.py Tue Mar 2 10:50:04 2004
@@ -18,15 +18,14 @@
import unittest
from zope.app import zapi
from zope.app.container.contained import Contained
-from zope.app.interfaces.interpreter import IInterpreter, IInterpreterService
from zope.app.interfaces.traversing import IContainmentRoot
from zope.app.interfaces.traversing import IPhysicallyLocatable
-from zope.app.interpreter import interpreterService
+from zope.app.interpreter.interfaces import IInterpreter
from zope.app.interpreter.python import PythonInterpreter
from zope.app.location import LocationPhysicallyLocatable
from zope.app.tests import placelesssetup, ztapi
from zope.app.traversing.adapters import RootPhysicallyLocatable
-from zope.component.servicenames import Services
+from zope.component.servicenames import Utilities
from zope.interface import implements
from zope.testing.doctestunit import DocTestSuite
@@ -39,11 +38,9 @@
def setUp():
placelesssetup.setUp()
- interpreterService.provideInterpreter('text/server-python',
- PythonInterpreter)
- services = zapi.getService(None, Services)
- services.defineService('Interpreter', IInterpreterService)
- services.provideService('Interpreter', interpreterService)
+ service = zapi.getService(None, Utilities)
+ service.provideUtility(IInterpreter, PythonInterpreter,
+ 'text/server-python')
ztapi.provideAdapter(None, IPhysicallyLocatable,
LocationPhysicallyLocatable)
@@ -57,7 +54,7 @@
def test_suite():
return unittest.TestSuite((
- DocTestSuite('zope.app.pythonpage'),
+ DocTestSuite('zope.app.pythonpage', setUp, tearDown),
))
if __name__ == '__main__':
More information about the Zope3-Checkins
mailing list