[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests - test_add.py:1.20.16.1 test_editview.py:1.13.12.1 test_objectwidget.py:1.4.12.1 test_sequencewidget.py:1.4.12.1 test_vocabularywidget.py:1.25.4.1

Jim Fulton cvs-admin at zope.org
Sun Nov 9 11:08:40 EST 2003


Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv15349/src/zope/app/browser/form/tests

Modified Files:
      Tag: adaptergeddon-branch
	test_add.py test_editview.py test_objectwidget.py 
	test_sequencewidget.py test_vocabularywidget.py 
Log Message:
Created a global presentation service that replaces the 
global view, resource, and skin services.

Now look up presentation components by adapting from a request type,
rather than adapting to a presentation type.





=== Zope3/src/zope/app/browser/form/tests/test_add.py 1.20 => 1.20.16.1 ===
--- Zope3/src/zope/app/browser/form/tests/test_add.py:1.20	Mon Aug  4 10:52:49 2003
+++ Zope3/src/zope/app/browser/form/tests/test_add.py	Sun Nov  9 11:08:07 2003
@@ -19,7 +19,7 @@
 import unittest
 
 from zope.interface import Interface, implements
-from zope.publisher.interfaces.browser import IBrowserPresentation
+from zope.publisher.interfaces.browser import IBrowserRequest
 from zope.publisher.browser import TestRequest
 from zope.schema import TextLine, accessors
 from zope.component import getView
@@ -143,7 +143,7 @@
         (descriminator, callable, args, kw) = self._context.last_action
 
         self.assertEqual(descriminator,
-                         ('view', IAdding, "addthis", IBrowserPresentation,
+                         ('view', IAdding, "addthis", IBrowserRequest,
                           "default"))
         self.assertEqual(callable, AddViewFactory)
 


=== Zope3/src/zope/app/browser/form/tests/test_editview.py 1.13 => 1.13.12.1 ===
--- Zope3/src/zope/app/browser/form/tests/test_editview.py:1.13	Wed Aug 13 17:28:04 2003
+++ Zope3/src/zope/app/browser/form/tests/test_editview.py	Sun Nov  9 11:08:07 2003
@@ -15,15 +15,14 @@
 """
 import unittest
 
+from zope.app.tests import ztapi
 from zope.app.tests.placelesssetup import PlacelessSetup
 from zope.app.event.tests.placelesssetup import getEvents
 from zope.interface import Interface, implements
 from zope.schema import TextLine, accessors
 from zope.schema.interfaces import ITextLine
 from zope.publisher.browser import TestRequest
-from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.app.browser.form.editview import EditView
-from zope.component.view import provideView, setDefaultViewName
 from zope.component.adapter import provideAdapter
 from zope.app.browser.form.widget import TextWidget
 from zope.app.browser.form.submit import Update
@@ -81,8 +80,8 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        provideView(ITextLine, 'edit', IBrowserPresentation, TextWidget)
-        setDefaultViewName(ITextLine, IBrowserPresentation, "edit")
+        ztapi.browserView(ITextLine, 'edit', TextWidget)
+        ztapi.setDefaultViewName(ITextLine, "edit")
         provideAdapter(IFoo, IBar, FooBarAdapter)
 
     def test_setPrefix_and_widgets(self):


=== Zope3/src/zope/app/browser/form/tests/test_objectwidget.py 1.4 => 1.4.12.1 ===
--- Zope3/src/zope/app/browser/form/tests/test_objectwidget.py:1.4	Wed Aug 13 17:28:04 2003
+++ Zope3/src/zope/app/browser/form/tests/test_objectwidget.py	Sun Nov  9 11:08:07 2003
@@ -17,10 +17,9 @@
 
 import unittest
 
+from zope.app.tests import ztapi
 from zope.interface import Interface, implements
-from zope.component.view import provideView
 from zope.schema.interfaces import ITextLine
-from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.publisher.browser import TestRequest
 from zope.schema import Object, TextLine
 from zope.app.browser.form.widget import TextWidget, ObjectWidget
@@ -40,7 +39,7 @@
         return ObjectWidget(context, request, **kw)
 
     def setUpContent(self, desc=u''):
-        provideView(ITextLine, 'edit', IBrowserPresentation, [TextWidget])
+        ztapi.browserView(ITextLine, 'edit', TextWidget)
 
         class ITestContent(Interface):
             foo = self._FieldFactory(
@@ -68,7 +67,7 @@
     def setUp(self):
         BrowserWidgetTest.setUp(self)
         self.field = Object(ITestContact, __name__=u'foo')
-        provideView(ITextLine, 'edit', IBrowserPresentation, [TextWidget])
+        ztapi.browserView(ITextLine, 'edit', [TextWidget])
 
     def test_applyChanges(self):
         self.request.form['field.foo.name'] = u'Foo Name'


=== Zope3/src/zope/app/browser/form/tests/test_sequencewidget.py 1.4 => 1.4.12.1 ===
--- Zope3/src/zope/app/browser/form/tests/test_sequencewidget.py:1.4	Wed Aug 13 17:28:04 2003
+++ Zope3/src/zope/app/browser/form/tests/test_sequencewidget.py	Sun Nov  9 11:08:07 2003
@@ -17,10 +17,9 @@
 
 import unittest
 
-from zope.component.view import provideView
+from zope.app.tests import ztapi
 from zope.app.browser.form.widget import TextWidget
 from zope.schema.interfaces import ITextLine, ValidationError
-from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.publisher.browser import TestRequest
 from zope.schema import Tuple, List, TextLine
 from zope.app.browser.form.widget import TupleSequenceWidget, \
@@ -42,7 +41,7 @@
         BrowserWidgetTest.setUp(self)
         self.field = Tuple(__name__=u'foo',
             value_type=TextLine(__name__=u'bar'))
-        provideView(ITextLine, 'edit', IBrowserPresentation, [TextWidget])
+        ztapi.browserView(ITextLine, 'edit', TextWidget)
 
     def test_haveNoData(self):
         self.failIf(self._widget.hasInput())


=== Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py 1.25 => 1.25.4.1 ===
--- Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py:1.25	Mon Sep 29 16:13:13 2003
+++ Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py	Sun Nov  9 11:08:07 2003
@@ -16,16 +16,15 @@
 
 import unittest
 
+from zope.app.tests import ztapi
 from zope.app.browser.form import vocabularywidget
 from zope.app.browser.form.tests import support
 from zope.app.interfaces.browser.form import IBrowserWidget
 from zope.app.interfaces.browser.form import IVocabularyQueryView
 from zope.app.tests.placelesssetup import PlacelessSetup
 from zope.component import getView
-from zope.component.view import provideView
 from zope.interface.declarations import implements
 from zope.publisher.browser import TestRequest
-from zope.publisher.interfaces.browser import IBrowserPresentation
 
 from zope.schema.interfaces import IVocabulary, IVocabularyQuery
 from zope.schema.interfaces import IVocabularyField, IVocabularyListField
@@ -151,36 +150,35 @@
         # This is equivalent to the default configuration for
         # vocabulary field view registration from configure.zcml.
         # Single-selection views only.
-        provideView(IVocabularyField,
-                    "display",
-                    IBrowserPresentation,
-                    vocabularywidget.VocabularyFieldDisplayWidget)
-        provideView(IVocabularyField,
-                    "edit",
-                    IBrowserPresentation,
-                    vocabularywidget.VocabularyFieldEditWidget)
+        ztapi.browserView(
+            IVocabularyField,
+            "display",
+            vocabularywidget.VocabularyFieldDisplayWidget)
+        ztapi.browserView(
+            IVocabularyField,
+            "edit",
+            vocabularywidget.VocabularyFieldEditWidget)
         # Register the "basic" widgets:
-        provideView(IVocabularyTokenized,
-                    "field-display-widget",
-                    IBrowserPresentation,
-                    vocabularywidget.VocabularyDisplayWidget)
-        provideView(IVocabularyTokenized,
-                    "field-edit-widget",
-                    IBrowserPresentation,
-                    # XXX indirect through a derived class to allow
-                    # testing of multiple concrete widgets
-                    self.singleSelectionEditWidget)
-        provideView(IIterableVocabularyQuery,
-                    "widget-query-helper",
-                    IBrowserPresentation,
-                    vocabularywidget.IterableVocabularyQueryView)
+        ztapi.browserView(
+            IVocabularyTokenized,
+            "field-display-widget",
+            vocabularywidget.VocabularyDisplayWidget)
+        ztapi.browserView(
+            IVocabularyTokenized,
+            "field-edit-widget",
+            # XXX indirect through a derived class to allow
+            # testing of multiple concrete widgets
+            self.singleSelectionEditWidget)
+        ztapi.browserView(
+            IIterableVocabularyQuery,
+            "widget-query-helper",
+            vocabularywidget.IterableVocabularyQueryView)
         # The following widget registration supports the specific
         # sample vocabulary we're using, used to demonstrate how to
         # override widget selection based on vocabulary:
-        provideView(ISampleVocabulary,
+        ztapi.browserView(ISampleVocabulary,
                     "field-display-widget",
-                    IBrowserPresentation,
-                    SampleDisplayWidget)
+                                        SampleDisplayWidget)
 
 
 class MultiSelectionViews:
@@ -189,34 +187,33 @@
         # This is equivalent to the default configuration for
         # vocabulary field view registration from configure.zcml.
         # Multi-selection views only.
-        provideView(IVocabularyListField,
-                    "display",
-                    IBrowserPresentation,
-                    vocabularywidget.VocabularyListFieldDisplayWidget)
-        provideView(IVocabularyListField,
-                    "edit",
-                    IBrowserPresentation,
-                    vocabularywidget.VocabularyListFieldEditWidget)
+        ztapi.browserView(
+            IVocabularyListField,
+            "display",
+            vocabularywidget.VocabularyListFieldDisplayWidget)
+        ztapi.browserView(
+            IVocabularyListField,
+            "edit",
+            vocabularywidget.VocabularyListFieldEditWidget)
         # Bind widgets to the vocabulary fields:
-        provideView(IVocabularyTokenized,
-                    "field-display-list-widget",
-                    IBrowserPresentation,
-                    vocabularywidget.VocabularyListDisplayWidget)
-        provideView(IVocabularyTokenized,
-                    "field-edit-list-widget",
-                    IBrowserPresentation,
-                    vocabularywidget.VocabularyMultiEditWidget)
-        provideView(IIterableVocabularyQuery,
-                    "widget-query-list-helper",
-                    IBrowserPresentation,
-                    vocabularywidget.IterableVocabularyQueryMultiView)
+        ztapi.browserView(
+            IVocabularyTokenized,
+            "field-display-list-widget",
+            vocabularywidget.VocabularyListDisplayWidget)
+        ztapi.browserView(
+            IVocabularyTokenized,
+            "field-edit-list-widget",
+            vocabularywidget.VocabularyMultiEditWidget)
+        ztapi.browserView(
+            IIterableVocabularyQuery,
+            "widget-query-list-helper",
+            vocabularywidget.IterableVocabularyQueryMultiView)
         # The following widget registration supports the specific
         # sample vocabulary we're using, used to demonstrate how to
         # override widget selection based on vocabulary:
-        provideView(ISampleVocabulary,
+        ztapi.browserView(ISampleVocabulary,
                     "field-display-list-widget",
-                    IBrowserPresentation,
-                    SampleDisplayWidget)
+                                        SampleDisplayWidget)
 
 
 class SelectionTestBase(VocabularyWidgetTestBase):
@@ -502,10 +499,9 @@
 
     def registerViews(self):
         SingleSelectionViews.registerViews(self)
-        provideView(IMyVocabularyQuery,
-                    "widget-query-helper",
-                    IBrowserPresentation,
-                    MyQueryViewSingle)
+        ztapi.browserView(IMyVocabularyQuery,
+                          "widget-query-helper",
+                          MyQueryViewSingle)
 
 
 class MultiSelectionQuerySupportTests(MultiSelectionViews,
@@ -518,10 +514,9 @@
 
     def registerViews(self):
         MultiSelectionViews.registerViews(self)
-        provideView(IMyVocabularyQuery,
-                    "widget-query-list-helper",
-                    IBrowserPresentation,
-                    MyQueryViewMulti)
+        ztapi.browserView(IMyVocabularyQuery,
+                          "widget-query-list-helper",
+                          MyQueryViewMulti)
 
 
 def test_suite():




More information about the Zope3-Checkins mailing list