Log message for revision 98209:
  Scrub goofy module-scope imports.

Changed:
  U   Zope/trunk/src/OFS/tests/testRanges.py

-=-
Modified: Zope/trunk/src/OFS/tests/testRanges.py
===================================================================
--- Zope/trunk/src/OFS/tests/testRanges.py      2009-03-17 17:23:47 UTC (rev 
98208)
+++ Zope/trunk/src/OFS/tests/testRanges.py      2009-03-17 17:30:59 UTC (rev 
98209)
@@ -1,6 +1,7 @@
 ##############################################################################
 #
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2002-2009 Zope Corporation and Contributors.
+# All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
@@ -10,20 +11,8 @@
 # FOR A PARTICULAR PURPOSE
 #
 ##############################################################################
-import os, sys, unittest
+import unittest
 
-import string, random, cStringIO, time, re
-import ZODB
-import transaction
-from OFS.Application import Application
-from OFS.Folder import manage_addFolder
-from OFS.Image import manage_addFile
-from Testing.makerequest import makerequest
-from webdav.common import rfc1123_date
-
-from mimetools import Message
-from multifile import MultiFile
-
 def makeConnection():
     import ZODB
     from ZODB.DemoStorage import DemoStorage
@@ -35,6 +24,9 @@
     # Create a file that is several 1<<16 blocks of data big, to force the
     # use of chained Pdata objects.
     # Make sure we create a file that isn't of x * 1<<16 length! Coll #671
+    import cStringIO
+    import random
+    import string
     size = (1<<16) * 5 + 12345
     file = cStringIO.StringIO()
 
@@ -51,6 +43,13 @@
 class TestRequestRange(unittest.TestCase):
     # Test case setup and teardown
     def setUp(self):
+        import cStringIO
+        import string
+        import transaction
+        from OFS.Application import Application
+        from OFS.Folder import manage_addFolder
+        from OFS.Image import manage_addFile
+        from Testing.makerequest import makerequest
         self.responseOut = cStringIO.StringIO()
         self.connection = makeConnection()
         try:
@@ -80,8 +79,11 @@
             raise
 
     def tearDown(self):
-        try: self.app._delObject(TESTFOLDER_NAME)
-        except AttributeError: pass
+        import transaction
+        try:
+            self.app._delObject(TESTFOLDER_NAME)
+        except AttributeError:
+            pass
         transaction.abort()
         self.app._p_jar.sync()
         self.connection.close()
@@ -102,11 +104,12 @@
 
         # Chop off any printed headers (only when response.write was used)
         if body:
-            body = string.split(body, '\r\n\r\n', 1)[1]
+            body = body.split('\r\n\r\n', 1)[1]
 
         return body + rv
 
     def createLastModifiedDate(self, offset=0):
+        from webdav.common import rfc1123_date
         return rfc1123_date(self.file._p_mtime + offset)
 
     def expectUnsatisfiable(self, range):
@@ -173,8 +176,12 @@
             'Incorrect range returned, expected %s, got %s' % (
                 `self.data[start:end]`, `body`))
 
-    def expectMultipleRanges(self, range, sets, draft=0,
-            rangeParse=re.compile('bytes\s*(\d+)-(\d+)/(\d+)')):
+    def expectMultipleRanges(self, range, sets, draft=0):
+        import cStringIO
+        from mimetools import Message
+        from multifile import MultiFile
+        import re
+        rangeParse = re.compile('bytes\s*(\d+)-(\d+)/(\d+)')
         req = self.app.REQUEST
         rsp = req.RESPONSE
 
@@ -191,7 +198,7 @@
         self.failIf(rsp.getHeader('content-range'),
             'The Content-Range header should not be set!')
 
-        ct = string.split(rsp.getHeader('content-type'), ';')[0]
+        ct = rsp.getHeader('content-type').split(';')[0]
         draftprefix = draft and 'x-' or ''
         self.failIf(ct != 'multipart/%sbyteranges' % draftprefix,
             "Incorrect Content-Type set. Expected 'multipart/%sbyteranges', "

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to