1. dgentry
  2. CherryPy


Robert Brewer  committed 7dedb7e

Even more sync for py2 ;)

  • Participants
  • Parent commits b901d2d
  • Branches default

Comments (0)

Files changed (5)

File py2/cherrypy/lib/reprconf.py

View file
  • Ignore whitespace
     """Return a Python object compiled from a string."""
     if not s:
         return s
-    if sys.version_info <= (3, 0):
+    if sys.version_info < (3, 0):
         b = _Builder2()
         b = _Builder3()

File py2/cherrypy/test/fcgi.conf

View file
  • Ignore whitespace
 # Apache2 server conf file for testing CherryPy with mod_fcgid.
-DocumentRoot "C:\Python25\Lib\site-packages\cherrypy\test"
+DocumentRoot "/usr/lib/python2.6/site-packages/cproot/trunk/cherrypy/test"
 Listen 8080
 LoadModule fastcgi_module modules/mod_fastcgi.dll
 SetHandler fastcgi-script
 RewriteEngine On
 RewriteRule ^(.*)$ /fastcgi.pyc [L]
-FastCgiExternalServer "C:\\Python25\\Lib\\site-packages\\cherrypy\\test\\fastcgi.pyc" -host
+FastCgiExternalServer "/usr/lib/python2.6/site-packages/cproot/trunk/cherrypy/test/fastcgi.pyc" -host

File py2/cherrypy/test/logtest.py

View file
  • Ignore whitespace
 import time
 import cherrypy
-from cherrypy._cpcompat import ntob
+from cherrypy._cpcompat import basestring, ntob, unicodestr
         if marker is None:
             return open(logfile, 'rb').readlines()
+        if isinstance(marker, unicodestr):
+            marker = marker.encode('utf-8')
         data = []
         in_region = False
         for line in open(logfile, 'rb'):
             # Single arg. Use __getitem__ and allow lines to be str or list.
             if isinstance(lines, (tuple, list)):
                 lines = lines[0]
+            if isinstance(lines, unicodestr):
+                lines = lines.encode('utf-8')
             if lines not in data[sliceargs]:
                 msg = "%r not found on log line %r" % (lines, sliceargs)
-                self._handleLogError(msg, [data[sliceargs]], marker, lines)
+                self._handleLogError(msg, [data[sliceargs],"--EXTRA CONTEXT--"] + data[sliceargs+1:sliceargs+6], marker, lines)
             # Multiple args. Use __getslice__ and require lines to be list.
             if isinstance(lines, tuple):
             start, stop = sliceargs
             for line, logline in zip(lines, data[start:stop]):
+                if isinstance(line, unicodestr):
+                    line = line.encode('utf-8')
                 if line not in logline:
                     msg = "%r not found in log" % line
                     self._handleLogError(msg, data[start:stop], marker, line)

File py2/cherrypy/test/test_config.py

View file
  • Ignore whitespace
             return 'Hello world'
         silly.exposed = True
         silly._cp_config = {'response.headers.X-silly': 'sillyval'}
+        # Test the expose and config decorators
+        #@cherrypy.expose
+        #@cherrypy.config(foo='this3', **{'bax': 'this4'})
         def bar(self, key):
             return repr(cherrypy.request.config.get(key, None))
         bar.exposed = True

File py2/cherrypy/test/test_core.py

View file
  • Ignore whitespace
                     if isinstance(value, types.FunctionType):
                         value.exposed = True
                 setattr(root, name.lower(), cls())
-        class Test(object):
-            __metaclass__ = TestType
+        Test = TestType('Test', (object, ), {})
         class URL(Test):