New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sqlalchemy-bot opened this Issue Mar 14, 2007 · 2 comments

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Mar 14, 2007

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=:)

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Mar 14, 2007

Michael Bayer (@zzzeek) wrote:

more AST tweaks (remembering to split the modname on "." and get [0]), [changeset:236]

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Mar 14, 2007

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment