Robert Brewer avatar Robert Brewer committed 7faab78

Fix to unrepr for function calls.

Comments (0)

Files changed (2)


         return m(o)
     def build_CallFunc(self, o):
-        callee, args, starargs, kwargs = map(, o.getChildren())
-        return callee(args, *(starargs or ()), **(kwargs or {}))
+        children = map(, o.getChildren())
+        callee = children.pop(0)
+        kwargs = children.pop() or {}
+        starargs = children.pop() or ()
+        args = tuple(children) + tuple(starargs)
+        return callee(*args, **kwargs)
     def build_List(self, o):
         return map(, o.getChildren())


 from cherrypy.test import test
+import os
 import StringIO
 import cherrypy
     ioconf = StringIO.StringIO("""
 neg: -1234
+filename: os.path.join(os.getcwd(), "")
     root = Root()
             ('/',        'nex', 'None'),
             ('/',        'foo', 'this'),
             ('/',        'bar', 'that'),
-            ('/repr',    'neg', '-1234'),
             ('/xyz',     'foo', 'this'),
             ('/foo/',    'foo', 'this2'),
             ('/foo/',    'bar', 'that'),
             self.getPage("/foo/bar?key=" + key)
+    def testUnrepr(self):
+        self.getPage("/repr?key=neg")
+        self.assertBody("-1234")
+        self.getPage("/repr?key=filename")
+        self.assertBody(repr(os.path.join(os.getcwd(), "")))
     def testCustomNamespaces(self):
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
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.