Source

CherryPy / cherrypy / test / test_dynamicobjectmapping.py

Diff from to

cherrypy/test/test_dynamicobjectmapping.py

 import cherrypy
+from cherrypy._cpcompat import sorted, unicodestr
 from cherrypy._cptree import Application
 from cherrypy.test import helper
 
 
         def __unicode__(self):
             return unicode(self.name)
+        def __str__(self):
+            return str(self.name)
 
     user_lookup = {
         1: User(1, 'foo'),
 
     def make_user(name, id=None):
         if not id:
-            id = max(*user_lookup.keys()) + 1
+            id = max(*list(user_lookup.keys())) + 1
         user_lookup[id] = User(id, name)
         return id
 
             return "POST %d" % make_user(name)
 
         def GET(self):
-            keys = user_lookup.keys()
-            keys.sort()
-            return unicode(keys)
+            return unicodestr(sorted(user_lookup.keys()))
 
         def dynamic_dispatch(self, vpath):
             try:
             """
             Return the appropriate representation of the instance.
             """
-            return unicode(self.user)
+            return unicodestr(self.user)
 
         def POST(self, name):
             """
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.