Diff of /examples/web_framework/web.krb [9ac085] .. [0176eb]  Maximize  Restore

Switch to unified view

a/examples/web_framework/web.krb b/examples/web_framework/web.krb
...
...
189
    with
189
    with
190
        getattr(template, $name).repeat($detail_fun, data[$name])
190
        getattr(template, $name).repeat($detail_fun, data[$name])
191
191
192
bc_extras
192
bc_extras
193
    import sys
193
    import sys
194
    import StringIO
194
    import io
195
    import HTMLTemplate
195
    import HTMLTemplate
196
196
197
    def renderFun(template, render_fn, data):
197
    def renderFun(template, render_fn, data):
198
        render_fn(template, data)
198
        render_fn(template, data)
199
199
...
...
207
    # Kludge!  HTMLTemplate needs methods to query the structure...
207
    # Kludge!  HTMLTemplate needs methods to query the structure...
208
    def structure(template):
208
    def structure(template):
209
        try:
209
        try:
210
            # This was stdout in earlier releases of HTMLTemplate!
210
            # This was stdout in earlier releases of HTMLTemplate!
211
            stderr_save = sys.stderr
211
            stderr_save = sys.stderr
212
            sys.stderr = StringIO.StringIO()
212
            sys.stderr = io.StringIO()
213
            template.structure()
213
            template.structure()
214
            lines = sys.stderr.getvalue().split('\n')
214
            lines = sys.stderr.getvalue().split('\n')
215
        finally:
215
        finally:
216
            sys.stderr.close()
216
            sys.stderr.close()
217
            sys.stderr = stderr_save
217
            sys.stderr = stderr_save
...
...
231
                    ans[-1] = tuple(ans[-1]) + children
231
                    ans[-1] = tuple(ans[-1]) + children
232
                    continue
232
                    continue
233
                else:
233
                else:
234
                    ans.append(tuple(line.strip().split(':')))
234
                    ans.append(tuple(line.strip().split(':')))
235
            start += 1
235
            start += 1
236
        #print "get_info -> %d, %s" % (start, tuple(ans))
236
        #print("get_info -> %d, %s" % (start, tuple(ans)))
237
        return start, tuple(ans)
237
        return start, tuple(ans)
238
238