[Zope3-checkins] SVN: Zope3/trunk/src/zope/testbrowser/ Sigh,
I had to fix client cookie quiet a bit to make it work for people
Stephan Richter
srichter at cosmos.phy.tufts.edu
Fri Oct 7 05:40:49 EDT 2005
Log message for revision 38851:
Sigh, I had to fix client cookie quiet a bit to make it work for people
that do not have the ClientCookie package installed.
Changed:
U Zope3/trunk/src/zope/testbrowser/ClientCookie/_ClientCookie.py
U Zope3/trunk/src/zope/testbrowser/ClientCookie/_Debug.py
U Zope3/trunk/src/zope/testbrowser/ClientCookie/__init__.py
U Zope3/trunk/src/zope/testbrowser/ClientCookie/_urllib2_support.py
U Zope3/trunk/src/zope/testbrowser/__init__.py
-=-
Modified: Zope3/trunk/src/zope/testbrowser/ClientCookie/_ClientCookie.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/ClientCookie/_ClientCookie.py 2005-10-07 09:31:24 UTC (rev 38850)
+++ Zope3/trunk/src/zope/testbrowser/ClientCookie/_ClientCookie.py 2005-10-07 09:40:49 UTC (rev 38851)
@@ -67,7 +67,6 @@
except NameError:
class StopIteration(Exception): pass
-import ClientCookie
from _HeadersUtil import split_header_words, parse_ns_headers
from _Util import startswith, endswith, isstringlike, getheaders
from _Debug import warn, getLogger
@@ -90,6 +89,7 @@
# There are a few catch-all except: statements in this module, for
# catching input that's bad in unexpected ways.
# This function re-raises some exceptions we don't want to trap.
+ import ClientCookie
if not ClientCookie.USE_BARE_EXCEPT:
raise
unmasked = unmasked + (KeyboardInterrupt, SystemExit, MemoryError)
Modified: Zope3/trunk/src/zope/testbrowser/ClientCookie/_Debug.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/ClientCookie/_Debug.py 2005-10-07 09:31:24 UTC (rev 38850)
+++ Zope3/trunk/src/zope/testbrowser/ClientCookie/_Debug.py 2005-10-07 09:40:49 UTC (rev 38851)
@@ -1,11 +1,10 @@
import sys
-import ClientCookie
-
try:
import warnings
except ImportError:
def warn(text):
+ import ClientCookie
ClientCookie.WARNINGS_STREAM.write("WARNING: "+text)
else:
def warn(text):
Modified: Zope3/trunk/src/zope/testbrowser/ClientCookie/__init__.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/ClientCookie/__init__.py 2005-10-07 09:31:24 UTC (rev 38850)
+++ Zope3/trunk/src/zope/testbrowser/ClientCookie/__init__.py 2005-10-07 09:40:49 UTC (rev 38851)
@@ -38,11 +38,11 @@
except ImportError:
pass
else:
- from ClientCookie._urllib2_support import \
+ from _urllib2_support import \
Request, \
OpenerDirector, build_opener, install_opener, urlopen, \
OpenerFactory, urlretrieve, BaseHandler
- from ClientCookie._urllib2_support import \
+ from _urllib2_support import \
HTTPHandler, HTTPRedirectHandler, \
HTTPRequestUpgradeProcessor, \
HTTPEquivProcessor, SeekableProcessor, HTTPCookieProcessor, \
@@ -55,13 +55,13 @@
except ImportError:
pass
else:
- from ClientCookie._urllib2_support import \
+ from _urllib2_support import \
HTTPRobotRulesProcessor, RobotExclusionError
del robotparser
import httplib
if hasattr(httplib, 'HTTPS'):
- from ClientCookie._urllib2_support import HTTPSHandler
+ from _urllib2_support import HTTPSHandler
del AbstractHTTPHandler, httplib
from _Util import http2time
str2time = http2time
Modified: Zope3/trunk/src/zope/testbrowser/ClientCookie/_urllib2_support.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/ClientCookie/_urllib2_support.py 2005-10-07 09:31:24 UTC (rev 38850)
+++ Zope3/trunk/src/zope/testbrowser/ClientCookie/_urllib2_support.py 2005-10-07 09:40:49 UTC (rev 38851)
@@ -13,7 +13,6 @@
import copy, time, tempfile
-import ClientCookie
from _ClientCookie import CookieJar, request_host
from _Util import isstringlike, startswith, getheaders
from _Debug import getLogger
Modified: Zope3/trunk/src/zope/testbrowser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/__init__.py 2005-10-07 09:31:24 UTC (rev 38850)
+++ Zope3/trunk/src/zope/testbrowser/__init__.py 2005-10-07 09:40:49 UTC (rev 38851)
@@ -12,16 +12,26 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
-"""Browser Simulator for Functional DocTests
+"""Browser Simulator for Functional DocTests
$Id$
"""
# TODO this should be removed once John J. Lee releases the new versions of
-# ClientForm and pullparser that have the code we rely on here. At that point
+# ClientForm and pullparser that have the code we rely on here. At that point
# we should also remove ClientForm.py from this directory.
import sys
+# stitch in ClientCookie
+from zope.testbrowser import ClientCookie
+
+if 'ClientCookie' not in sys.modules:
+ sys.modules['ClientCookie'] = ClientCookie
+else:
+ assert sys.modules['ClientCookie'] is ClientCookie
+import ClientCookie as x
+assert x is ClientCookie
+
# stitch in ClientForm
from zope.testbrowser import ClientForm
@@ -32,16 +42,6 @@
import ClientForm as x
assert x is ClientForm
-# stitch in ClientCookie
-from zope.testbrowser import ClientCookie
-
-# I don't really care, which version is there. We are doing no patching of the
-# code.
-if 'ClientCookie' not in sys.modules:
- sys.modules['ClientCookie'] = ClientCookie
-else:
- pass
-
# stitch in pullparser
from zope.testbrowser import pullparser
More information about the Zope3-Checkins
mailing list