publisher: reset site options when changing appdir (#31016)

This commit is contained in:
Frédéric Péters 2019-03-01 01:08:15 +01:00
parent 78799be562
commit b7625dd101
2 changed files with 2 additions and 0 deletions

View File

@ -262,6 +262,7 @@ def test_is_url_signed_check_nonce(pub, local_user):
pub.site_options.add_section('api-secrets')
pub.site_options.set('api-secrets', ORIG, KEY)
pub.site_options.write(open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w'))
# test clean_nonces do not bark when nonces directory is empty
if os.path.exists(os.path.join(pub.app_dir, 'nonces')):
shutil.rmtree(os.path.join(pub.app_dir, 'nonces'))

View File

@ -480,6 +480,7 @@ class QommonPublisher(Publisher, object):
'''
Set the application directory, creating it if possible and authorized.
'''
self.site_options = None # reset at the beginning of a request
canonical_hostname = request.get_server(clean = False).lower().split(':')[0].rstrip('.')
for prefix in ['mobile', 'm']:
if canonical_hostname.startswith(prefix + '.') or \