Skip to content
This repository has been archived by the owner on Jul 26, 2021. It is now read-only.

{% import_json "auth/users.json" as users %} #8

Open
andreasnuesslein opened this issue Dec 12, 2014 · 4 comments
Open

{% import_json "auth/users.json" as users %} #8

andreasnuesslein opened this issue Dec 12, 2014 · 4 comments

Comments

@andreasnuesslein
Copy link

Is there an equivalent for this code? Or should I just do:
with open('auth/users.json','r') as f: ...?

What would be the most elegant way to translate this to pyobjects?

Thanks :)

@borgstrom
Copy link
Owner

I would just use simplejson directly.

import simplejson
users = simplejson.load(open('auth/users.json'))

Then you can do whatever you want with the users object.

@andreasnuesslein
Copy link
Author

Awesome. :)

One little drawback is, that I can't use a relative path, and i can't use salt://, so i need to use /srv/salt/auth/users.json

But other than that, it works great and is so nice pythonic!

thanks 👍

@borgstrom
Copy link
Owner

Good point.

I think the best thing to do would be to support salt:// paths anywhere in Pyobjects files. I'll see what I can do over the next little bit.

@andreasnuesslein
Copy link
Author

awesome :)

On Mon, Dec 15, 2014 at 4:48 PM, Evan Borgstrom notifications@github.com
wrote:

Good point.

I think the best thing to do would be to support salt:// paths anywhere
in Pyobjects files. I'll see what I can do over the next little bit.


Reply to this email directly or view it on GitHub
#8 (comment).

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

No branches or pull requests

2 participants