nacl icon indicating copy to clipboard operation
nacl copied to clipboard

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

Open andreasnuesslein opened this issue 10 years ago • 4 comments

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

andreasnuesslein avatar Dec 12 '14 15:12 andreasnuesslein

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.

borgstrom avatar Dec 12 '14 16:12 borgstrom

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 :+1:

andreasnuesslein avatar Dec 12 '14 21:12 andreasnuesslein

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.

borgstrom avatar Dec 15 '14 15:12 borgstrom

awesome :)

On Mon, Dec 15, 2014 at 4:48 PM, Evan Borgstrom [email protected] 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 https://github.com/borgstrom/nacl/issues/8#issuecomment-67013743.

andreasnuesslein avatar Dec 15 '14 22:12 andreasnuesslein