Changeset 2511:46b0e2627549 in livinglogic.python.xist

Show
Ignore:
Timestamp:
05/03/06 21:37:06 (14 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Rename asString() to asstring().

Code cleanup.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • _xist/ns/code.py

    r2491 r2511  
    3333            white = line[:len(line)-len(rest)] 
    3434            lines[i] = [white, rest] 
    35         # drop all empty lines at the beginning; if we drop a line we no longer have to handle the first specifically 
     35        # drop all empty lines at the beginning; if we drop a line, we no longer have to handle the first specifically 
    3636        while lines and not lines[0][1]: 
    3737            del lines[0] 
     
    7171        self.lines.insert(0, [u"", u"def %s(converter):" % name]) 
    7272 
    73     def asString(self): 
     73    def asstring(self): 
    7474        v = [] 
    7575        for line in self.lines: 
    76             v += line 
    77             v += u"\n" 
     76            v.extend(line) 
     77            v.append(u"\n") 
    7878        return u"".join(v) 
    7979 
     
    9090 
    9191    def convert(self, converter): 
    92         code = Code(self.content, 1) 
     92        code = Code(self.content, True) 
    9393        sandbox = converter[self.__ns__].sandbox 
    94         exec code.asString() in sandbox # requires Python 2.0b2 (and doesn't really work) 
     94        exec code.asstring() in sandbox # requires Python 2.0b2 (and doesn't really work) 
    9595        return xsc.Null 
    9696 
     
    117117        under the name <arg>converter</arg> as an argument to the function.</par> 
    118118        """ 
    119         code = Code(self.content, 1) 
     119        code = Code(self.content, True) 
    120120        code.funcify() 
    121121        sandbox = converter[self.__ns__].sandbox 
    122         exec code.asString() in sandbox # requires Python 2.0b2 (and doesn't really work) 
     122        exec code.asstring() in sandbox # requires Python 2.0b2 (and doesn't really work) 
    123123        return xsc.tonode(sandbox["__"](converter)).convert(converter) 
    124124 
     
    134134 
    135135__ns__.makemod(vars()) 
    136