Commits

Anonymous committed 0e7fbe9

Added multiply operation to unrepr

Comments (0)

Files changed (2)

cherrypy/lib/reprconf.py

     def build_Add(self, o):
         left, right = map(self.build, o.getChildren())
         return left + right
+
+    def build_Mul(self, o):
+        left, right = map(self.build, o.getChildren())
+        return left * right
     
     def build_Getattr(self, o):
         parent = self.build(o.expr)
 
     def build_Add(self, o):
         return _operator.add
+
+    def build_Mult(self, o):
+        return _operator.mul
         
     def build_USub(self, o):
         return _operator.neg

cherrypy/test/test_config.py

 thing1: cherrypy.lib.httputil.response_codes[404]
 thing2: __import__('cherrypy.tutorial', globals(), locals(), ['']).thing2
 complex: 3+2j
+mul: 6*3
 ones: "11"
 twos: "22"
 stradd: %%(ones)s + %%(twos)s + "33"
         self.getPage("/repr?key=complex")
         self.assertBody("(3+2j)")
 
+        self.getPage("/repr?key=mul")
+        self.assertBody("18")
+
         self.getPage("/repr?key=stradd")
         self.assertBody(repr("112233"))