Let policies be stored in policies/{url_name}/policy.json

* still backcompat with old mode
This commit is contained in:
Victor Shnayder
2012-08-20 19:28:07 -04:00
parent 9f23e4378e
commit eeadf0ba87
2 changed files with 7 additions and 2 deletions

View File

@@ -243,8 +243,13 @@ class XMLModuleStore(ModuleStoreBase):
url_name = course_data.get('url_name', course_data.get('slug'))
if url_name:
policy_path = self.data_dir / course_dir / 'policies' / '{0}.json'.format(url_name)
policy = self.load_policy(policy_path, tracker)
old_policy_path = self.data_dir / course_dir / 'policies' / url_name / 'policy.json'
policy = self.load_policy(old_policy_path, tracker)
# VS[compat]: remove once courses use the policy dirs.
if policy == {}:
old_policy_path = self.data_dir / course_dir / 'policies' / '{0}.json'.format(url_name)
policy = self.load_policy(old_policy_path, tracker)
else:
policy = {}
# VS[compat] : 'name' is deprecated, but support it for now...