Skip to content
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
Closed
Labels
bug Something isn't working compiler low priority

Comments

@sqlalchemy-bot
Copy link

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
Copy link
Author

Michael Bayer (@zzzeek) wrote:

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

@sqlalchemy-bot
Copy link
Author

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
Labels
bug Something isn't working compiler low priority
Projects
None yet
Development

No branches or pull requests

1 participant