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

Changeset 1724

Show
Ignore:
Timestamp:
09/26/07 18:21:10
Author:
fumanchu
Message:

Allow string concatenation in config files. Very useful for using ConfigParser's interpolated values to build repetitive strings.

Files:

Legend:

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

    r1699 r1724  
    100100     
    101101    def build_Add(self, o): 
    102         real, imag = map(self.build_Const, o.getChildren()) 
    103         try: 
    104             real = float(real) 
    105         except TypeError: 
    106             raise TypeError("unrepr could not parse real %s" % repr(real)) 
    107         if not isinstance(imag, complex) or imag.real != 0.0: 
    108             raise TypeError("unrepr could not parse imag %s" % repr(imag)) 
    109         return real+imag 
     102        left, right = map(self.build, o.getChildren()) 
     103        return left + right 
    110104     
    111105    def build_Getattr(self, o): 
  • trunk/cherrypy/test/test_config.py

    r1699 r1724  
    9393thing1: cherrypy.lib.http.response_codes[404] 
    9494thing2: __import__('cherrypy.tutorial', globals(), locals(), ['']).thing2 
     95complex: 3+2j 
     96ones: "11" 
     97twos: "22" 
     98stradd: %%(ones)s + %%(twos)s + "33" 
    9599 
    96100[/favicon.ico] 
     
    170174        from cherrypy.tutorial import thing2 
    171175        self.assertBody(repr(thing2)) 
     176         
     177        self.getPage("/repr?key=complex") 
     178        self.assertBody("(3+2j)") 
     179         
     180        self.getPage("/repr?key=stradd") 
     181        self.assertBody(repr("112233")) 
    172182     
    173183    def testCustomNamespaces(self): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets