def get_staticdirector(app_config):
- if 'direct_remote_path' in app_config:
- return staticdirect.RemoteStaticDirect(
- app_config['direct_remote_path'].strip())
- elif 'direct_remote_paths' in app_config:
- direct_remote_path_lines = app_config[
- 'direct_remote_paths'].strip().splitlines()
- return staticdirect.MultiRemoteStaticDirect(
- dict([line.strip().split(' ', 1)
- for line in direct_remote_path_lines]))
- else:
+ if not 'direct_remote_path' in app_config:
raise ImproperlyConfigured(
"One of direct_remote_path or "
"direct_remote_paths must be provided")
+ return staticdirect.RemoteStaticDirect(
+ app_config['direct_remote_path'].strip())
+
def setup_storage():
global_config = mg_globals.global_config
def get(self, filepath):
return '%s/%s' % (
self.remotepath, filepath.lstrip('/'))
-
-
-class MultiRemoteStaticDirect(StaticDirect):
- """
- For whene separate sections of the static data is served under
- separate urls.
- """
- def __init__(self, remotepaths):
- StaticDirect.__init__(self)
- self.remotepaths = remotepaths
-
- def get(self, filepath):
- section, rest = filepath.strip('/').split('/', 1)
-
- return '%s/%s' % (
- self.remotepaths[section].rstrip('/'),
- rest.lstrip('/'))