This commit is contained in:
parent
ead891796a
commit
bb21ef72e7
|
@ -17,7 +17,8 @@ class MellonAdapter(DefaultAdapter):
|
|||
hobo_json_path = os.path.join(tenant_dir, 'hobo.json')
|
||||
if not os.path.exists(hobo_json_path):
|
||||
return []
|
||||
hobo_json = json.load(open(hobo_json_path))
|
||||
with open(hobo_json_path) as fd:
|
||||
hobo_json = json.load(fd)
|
||||
# always look for the first active identity provider in the list of
|
||||
# services
|
||||
for service in hobo_json.get('services'):
|
||||
|
|
|
@ -34,7 +34,8 @@ class Tenant(TenantMixin):
|
|||
|
||||
def get_hobo_json(self):
|
||||
if not self.__hobo_json:
|
||||
self.__hobo_json = json.load(open(os.path.join(self.get_directory(), 'hobo.json')))
|
||||
with open(os.path.join(self.get_directory(), 'hobo.json')) as fd:
|
||||
self.__hobo_json = json.load(fd)
|
||||
return self.__hobo_json
|
||||
|
||||
def get_service(self):
|
||||
|
@ -44,7 +45,8 @@ class Tenant(TenantMixin):
|
|||
|
||||
def get_base_url(self):
|
||||
if os.path.exists(os.path.join(self.get_directory(), 'base_url')):
|
||||
return open(os.path.join(self.get_directory(), 'base_url')).read().strip().strip('/')
|
||||
with open(os.path.join(self.get_directory(), 'base_url')) as fd:
|
||||
return fd.read().strip().strip('/')
|
||||
return 'https://%s' % self.domain_url
|
||||
|
||||
def build_absolute_uri(self, location):
|
||||
|
|
|
@ -30,7 +30,8 @@ def get_themes():
|
|||
filename = os.path.join(settings.THEMES_DIRECTORY, dirname, 'themes.json')
|
||||
if not os.path.exists(filename):
|
||||
continue
|
||||
themes_data = json.load(open(filename))
|
||||
with open(filename) as fd:
|
||||
themes_data = json.load(fd)
|
||||
if not isinstance(themes_data, dict):
|
||||
themes_data = {'themes': themes_data}
|
||||
for theme in themes_data['themes']:
|
||||
|
|
Loading…
Reference in New Issue