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

Problem with access of dictionary subfields #267

Open
degustator opened this issue Oct 4, 2016 · 0 comments
Open

Problem with access of dictionary subfields #267

degustator opened this issue Oct 4, 2016 · 0 comments

Comments

@degustator
Copy link

degustator commented Oct 4, 2016

I have a code below:

from pyjade.parser import Parser`

from pyjade.ext.html import HTMLCompiler, local_context_manager
import pyjade

def process(jade_string, context=None, **compiler_kwargs):
    ctx = context or {}
    block = Parser(jade_string).parse()
    compiler = HTMLCompiler(block, **compiler_kwargs)
    with local_context_manager(compiler, ctx):
        return compiler.compile()

jade_template = """p #{store} #{address.street}"""

json_data = {
    "store":"MyBookStore",
    "address": {"street": "Meryland","house": "5A"}
}

html = process(jade_template,json_data)
print html

It prints:

<p>MyBookStore None</p>

So it means it cannot access subfields of dictionaries, whereas jade should support that. It showed normally value of field "store", but not "store.address". Is it possible to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant