Robert Brewer avatar Robert Brewer committed 7dedb7e

Even more sync for py2 ;)

Comments (0)

Files changed (5)

py2/cherrypy/lib/reprconf.py

     """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()
     else:
         b = _Builder3()

py2/cherrypy/test/fcgi.conf

 
 # 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"
 ServerName 127.0.0.1
 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 127.0.0.1:4000
+FastCgiExternalServer "/usr/lib/python2.6/site-packages/cproot/trunk/cherrypy/test/fastcgi.pyc" -host 127.0.0.1:4000

py2/cherrypy/test/logtest.py

 import time
 
 import cherrypy
-from cherrypy._cpcompat import ntob
+from cherrypy._cpcompat import basestring, ntob, unicodestr
 
 
 try:
         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)
         else:
             # 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)

py2/cherrypy/test/test_config.py

             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

py2/cherrypy/test/test_core.py

                     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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.