Storage config: Drop all Backward Compatibility
Chris Webber says not to care about backward compatibility at this stage. So drop the last bits.
This commit is contained in:
parent
f7d73aeb34
commit
56fc718659
@ -112,16 +112,15 @@ def get_staticdirector(app_config):
|
|||||||
|
|
||||||
|
|
||||||
def setup_storage():
|
def setup_storage():
|
||||||
app_config = mg_globals.app_config
|
|
||||||
global_config = mg_globals.global_config
|
global_config = mg_globals.global_config
|
||||||
|
|
||||||
key_short = 'publicstore'
|
key_short = 'publicstore'
|
||||||
key_long = "storage:" + key_short
|
key_long = "storage:" + key_short
|
||||||
public_store = storage_system_from_config(global_config[key_long], None)
|
public_store = storage_system_from_config(global_config[key_long])
|
||||||
|
|
||||||
key_short = 'queuestore'
|
key_short = 'queuestore'
|
||||||
key_long = "storage:" + key_short
|
key_long = "storage:" + key_short
|
||||||
queue_store = storage_system_from_config(global_config[key_long], None)
|
queue_store = storage_system_from_config(global_config[key_long])
|
||||||
|
|
||||||
setup_globals(
|
setup_globals(
|
||||||
public_store = public_store,
|
public_store = public_store,
|
||||||
|
@ -443,7 +443,7 @@ def clean_listy_filepath(listy_filepath):
|
|||||||
return cleaned_filepath
|
return cleaned_filepath
|
||||||
|
|
||||||
|
|
||||||
def storage_system_from_config(paste_config, storage_prefix):
|
def storage_system_from_config(config):
|
||||||
"""
|
"""
|
||||||
Utility for setting up a storage system from the paste app config.
|
Utility for setting up a storage system from the paste app config.
|
||||||
|
|
||||||
@ -472,15 +472,9 @@ def storage_system_from_config(paste_config, storage_prefix):
|
|||||||
base_url='/media/',
|
base_url='/media/',
|
||||||
base_dir='/var/whatever/media')
|
base_dir='/var/whatever/media')
|
||||||
"""
|
"""
|
||||||
if storage_prefix is not None:
|
# This construct is needed, because dict(config) does
|
||||||
prefix_re = re.compile('^%s_(.+)$' % re.escape(storage_prefix))
|
# not replace the variables in the config items.
|
||||||
else:
|
config_params = dict(config.iteritems())
|
||||||
prefix_re = re.compile('^(.+)$')
|
|
||||||
|
|
||||||
config_params = dict(
|
|
||||||
[(prefix_re.match(key).groups()[0], value)
|
|
||||||
for key, value in paste_config.iteritems()
|
|
||||||
if prefix_re.match(key)])
|
|
||||||
|
|
||||||
if 'storage_class' in config_params:
|
if 'storage_class' in config_params:
|
||||||
storage_class = config_params['storage_class']
|
storage_class = config_params['storage_class']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user