Skip to content

Invalid GAE templates generated #24

evgenyz opened this Issue Oct 6, 2010 · 1 comment

2 participants

evgenyz commented Oct 6, 2010

Problem is in change

This change results in such a template:

from web.template import CompiledTemplate, ForLoop, TemplateResult

import snippets
# encoding: utf-8 
    join_ = main._join; escape_ = main._escape
def main (username):
    __lineoffset__ = -4
    loop = ForLoop()
    self = TemplateResult(); extend_ = self.extend
    extend_([u'        <td/><td colspan="2">Hello, ', escape_(username, False), u'!</td><td/>\n'])

    return self

main = CompiledTemplate(main, './templates/main.html')

# encoding: utf-8 
    join_ = time_reports_individual._join; escape_ = time_reports_individual._escape
def time_reports_individual (periods):

And exception:

join_ = main._join; escape_ = main._escape
    IndentationError: unexpected indent

Instead this should look as this IMHO:

        code = code.replace("__template__", name, 1)


        out.write('%s = CompiledTemplate(%s, %s)\n\n' % (name, name, repr(path)))
        # inject "join_ = ..; escape_ = .." into the code.. 
        # That is required to make escape functionality work correctly. 
        out.write('\njoin_ = %s._join; escape_ = %s._escape\n' % (name, name))

fix GAE compilation issue. (closed by 75dcc97)

@s7v7nislands s7v7nislands pushed a commit to s7v7nislands/webpy that referenced this issue May 4, 2011
@anandology anandology fix GAE compilation issue. (closes #24) 75dcc97
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.