Skip to content

<%! import foo.bar %> <% foo.bar.bazz() %> raises AttributeError #27

Description

@sqlalchemy-bot

Migrated issue, originally created by Anonymous

<%! import myapp.utils %>
<% bar = myapp.utils.Sequence() %>

raises:

  File "/tmp/myapp/templates/bar.html.py", line 19, in render_body
    bar = myapp.utils.Sequence()
AttributeError: 'Undefined' object has no attribute 'utils'

looking into the compiled template:

import myapp.utils 

def render_body(context,**pageargs):
    __locals = dict(pageargs=pageargs)
    myapp = context.get('myapp', UNDEFINED)
    bar = myapp.utils.Sequence() 
    __locals.update(dict([(k, locals()[k]) for k in ['bar'] if k in locals()]))
    return ''

i think

myapp = context.get('myapp', UNDEFINED)

should not be there...

SVN: r235

(can be worked over with the "from something import object, anotherobject" form, and sometimes "import myapp" then "import myapp.utils" solved this yesterday, but now i can't reproduce that=:)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions