[Zope3-checkins] SVN: Zope3/trunk/src/zope/testbrowser/ make
zope.testbrowser dependency on zope.schema optional
Benji York
benji at zope.com
Sat Nov 12 11:27:26 EST 2005
Log message for revision 40059:
make zope.testbrowser dependency on zope.schema optional
Changed:
U Zope3/trunk/src/zope/testbrowser/browser.py
U Zope3/trunk/src/zope/testbrowser/interfaces.py
-=-
Modified: Zope3/trunk/src/zope/testbrowser/browser.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/browser.py 2005-11-12 16:21:43 UTC (rev 40058)
+++ Zope3/trunk/src/zope/testbrowser/browser.py 2005-11-12 16:27:25 UTC (rev 40059)
@@ -24,8 +24,12 @@
import re
import StringIO
import urllib2
-import zope.interface
+try:
+ from zope import interface
+except ImportError:
+ from dummymodules import interface
+
RegexType = type(re.compile(''))
_compress_re = re.compile(r"\s+")
compressText = lambda text: _compress_re.sub(' ', text.strip())
@@ -134,7 +138,7 @@
class Browser(SetattrErrorsMixin):
"""A web user agent."""
- zope.interface.implements(interfaces.IBrowser)
+ interface.implements(interfaces.IBrowser)
_contents = None
_counter = 0
@@ -341,7 +345,7 @@
class Link(SetattrErrorsMixin):
- zope.interface.implements(interfaces.ILink)
+ interface.implements(interfaces.ILink)
def __init__(self, link, browser):
self.mech_link = link
@@ -380,7 +384,7 @@
class Control(SetattrErrorsMixin):
"""A control of a form."""
- zope.interface.implements(interfaces.IControl)
+ interface.implements(interfaces.IControl)
_enable_setattr_errors = False
@@ -445,7 +449,7 @@
class ListControl(Control):
- zope.interface.implements(interfaces.IListControl)
+ interface.implements(interfaces.IListControl)
@apply
def displayValue():
@@ -515,7 +519,7 @@
class SubmitControl(Control):
- zope.interface.implements(interfaces.ISubmitControl)
+ interface.implements(interfaces.ISubmitControl)
def click(self):
if self._browser_counter != self.browser._counter:
@@ -525,7 +529,7 @@
class ImageControl(Control):
- zope.interface.implements(interfaces.IImageSubmitControl)
+ interface.implements(interfaces.IImageSubmitControl)
def click(self, coord=(1,1)):
if self._browser_counter != self.browser._counter:
@@ -535,7 +539,7 @@
class ItemControl(SetattrErrorsMixin):
- zope.interface.implements(interfaces.IItemControl)
+ interface.implements(interfaces.IItemControl)
def __init__(self, item, form, browser):
self.mech_item = item
@@ -588,7 +592,7 @@
class Form(SetattrErrorsMixin):
"""HTML Form"""
- zope.interface.implements(interfaces.IForm)
+ interface.implements(interfaces.IForm)
def __init__(self, browser, form):
"""Initialize the Form
Modified: Zope3/trunk/src/zope/testbrowser/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/interfaces.py 2005-11-12 16:21:43 UTC (rev 40058)
+++ Zope3/trunk/src/zope/testbrowser/interfaces.py 2005-11-12 16:27:25 UTC (rev 40059)
@@ -17,19 +17,19 @@
"""
__docformat__ = "reStructuredText"
-from zope import interface
+try:
+ # zope.interface isn't included in the stand-alone version
+ from zope import interface
+except ImportError:
+ from dummymodules import interface
try:
- # zope.schema isn't included in the stand-alone version of zope.testbrowser
+ # zope.schema isn't included in the stand-alone version
from zope import schema
except ImportError:
- class DummySchemaModule(object):
- def __getattr__(self, name):
- return lambda *args, **kws: interface.Attribute('')
+ from dummymodules import schema
- schema = DummySchemaModule()
-
class ExpiredError(Exception):
"""The browser page to which this was attached is no longer active"""
More information about the Zope3-Checkins
mailing list