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

ease undefined check for expression args that can come from function args #191

Closed
sqlalchemy-bot opened this issue Jun 9, 2012 · 2 comments
Labels
bug Something isn't working compiler low priority

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Michael Bayer (@zzzeek)

from mako.template import Template

t = Template(
"""
<%def name="layout(foo)" cached="True" cache_key="${foo}">
foo: ${foo}
</%def>

${layout(3)}
""",
strict_undefined=True
)

print t.render()

patch:

diff -r 4b622e16dbdd55b85608103a9a9e33a9f7f7b830 mako/parsetree.py
--- a/mako/parsetree.py Wed May 16 10:38:44 2012 -0400
+++ b/mako/parsetree.py Tue Jun 05 12:37:53 2012 +0800
@@ -439,12 +439,15 @@
         for c in self.function_decl.defaults:
             res += list(ast.PythonCode(c, **self.exception_kwargs).
                                     undeclared_identifiers)
+
         return set(res).union(
             self.filter_args.\
                             undeclared_identifiers.\
                             difference(filters.DEFAULT_ESCAPES.keys())
         ).union(
             self.expression_undeclared_identifiers
+        ).difference(
+            self.function_decl.argnames
         )
 
 class BlockTag(Tag):
@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

03c97d1

@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