Commits

Robert Brewer  committed 558eb46

Fix for #506 (unrepr should support negative numbers).

  • Participants
  • Parent commits a802f42

Comments (0)

Files changed (2)

File cherrypy/lib/__init__.py

     
     def build_NoneType(self, o):
         return None
+    
+    def build_UnarySub(self, o):
+        return -self.build_Const(o.getChildren()[0])
+    
+    def build_UnaryAdd(self, o):
+        return self.build_Const(o.getChildren()[0])
 
 
 def unrepr(s):

File cherrypy/test/test_config.py

         def index(self, key):
             return cherrypy.request.config.get(key, "None")
         index = cherrypy.expose(index, alias=('global_', 'xyz'))
+        
+        def repr(self, key):
+            return repr(cherrypy.request.config.get(key, None))
+        repr.exposed = True
     
     class Foo:
         
             return str(cherrypy.request.config.get(key, "None"))
         index.exposed = True
     
+    ioconf = StringIO.StringIO("""
+[/]
+neg: -1234
+""")
+    
     root = Root()
     root.foo = Foo()
-    cherrypy.tree.mount(root)
+    cherrypy.tree.mount(root, config=ioconf)
     cherrypy.tree.mount(Another(), "/another")
     cherrypy.config.update({'environment': 'test_suite'})
     
             ('/',        'nex', 'None'),
             ('/',        'foo', 'this'),
             ('/',        'bar', 'that'),
+            ('/repr',    'neg', '-1234'),
             ('/xyz',     'foo', 'this'),
             ('/foo/',    'foo', 'this2'),
             ('/foo/',    'bar', 'that'),