Comment 0 for bug 1602206

Revision history for this message
Binoy M V (binoy-mv) wrote :

Hi,

I am trying to implement the pecan rest framework with policy. How can I do that. I tried with the following but getting error on that. Please help

My policy file (test.json)
http://pastebin.com/0pn2JPK1

I am trying to call the following from my pecan rootcontroller
test.enforce("events:index", pecan.request)

My test.py file (oslo code)
http://pastebin.com/F39VqHY5

Getting following o/p while printing the self from load_rules()
print self.__dict__

{'policy_file': 'policy.json', 'policy_path': None, 'rules': {}, 'file_rules': {}, 'overwrite': True, 'conf': <oslo_config.cfg.ConfigOpts object at 0x7f3ff02f7e90>, '_policy_dir_mtimes': {}, 'registered_rules': {}, '_file_cache': {}, 'default_rule': 'default', '_loaded_files': [], 'use_conf': True}

Is this correct behaviour. But I am passing the file as test.json. Please give me an opening for this.