Changeset 3785:3aa5a5d89287 in livinglogic.python.xist for src/ll/ul4c.py

Show
Ignore:
Timestamp:
06/02/09 17:47:48 (10 years ago)
Author:
Walter Doerwald <walter@…>
Children:
3786:56fb60cd4cef, 3823:697e888115bc
Branch:
default
Tags:
rel-3-6-5
Message:

Fix UL4 templates that produce no output.

As the generated Python sourcecode didn't contain any yield statements, the
resulting function was an ordinary function instead of a generator.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/ul4c.py

    r3716 r3785  
    11991199        self.lines.append("%ssource = %r" % (self.indent, self.source)) 
    12001200        self.lines.append('%svariables = dict((key.decode("utf-8"), value) for (key, value) in variables.iteritems())' % self.indent) # FIXME: This can be dropped in Python 3.0 where strings are unicode 
     1201        # Make sure that the resulting code is a generator even if the byte codes produces no yield statement 
     1202        self.lines.append("%sif 0: yield ''" % self.indent) 
    12011203        locations = [] 
    12021204        lines2locs = []