Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1620

Show
Ignore:
Timestamp:
02/16/07 21:15:28
Author:
fumanchu
Message:

Fix to unrepr for function calls.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/lib/__init__.py

    r1592 r1620  
    4747     
    4848    def build_CallFunc(self, o): 
    49         callee, args, starargs, kwargs = map(self.build, o.getChildren()) 
    50         return callee(args, *(starargs or ()), **(kwargs or {})) 
     49        children = map(self.build, o.getChildren()) 
     50        callee = children.pop(0) 
     51        kwargs = children.pop() or {} 
     52        starargs = children.pop() or () 
     53        args = tuple(children) + tuple(starargs) 
     54        return callee(*args, **kwargs) 
    5155     
    5256    def build_List(self, o): 
  • trunk/cherrypy/test/test_config.py

    r1340 r1620  
    44test.prefer_parent_path() 
    55 
     6import os 
    67import StringIO 
    78import cherrypy 
     
    7475[/] 
    7576neg: -1234 
     77filename: os.path.join(os.getcwd(), "hello.py") 
    7678""") 
    7779     
     
    98100            ('/',        'foo', 'this'), 
    99101            ('/',        'bar', 'that'), 
    100             ('/repr',    'neg', '-1234'), 
    101102            ('/xyz',     'foo', 'this'), 
    102103            ('/foo/',    'foo', 'this2'), 
     
    134135            self.assertBody(`expected`) 
    135136     
     137    def testUnrepr(self): 
     138        self.getPage("/repr?key=neg") 
     139        self.assertBody("-1234") 
     140         
     141        self.getPage("/repr?key=filename") 
     142        self.assertBody(repr(os.path.join(os.getcwd(), "hello.py"))) 
     143     
    136144    def testCustomNamespaces(self): 
    137145        self.getPage("/raw/incr?num=12") 

Hosted by WebFaction

Log in as guest/cpguest to create tickets