1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00

routes: make coll route config extendable to support prefix routing for localization ukwa/ukwa-pywb#11

split init_routes() into init_coll_routes() and make_coll_routes() which retrieves a list of per-collection routes only
This commit is contained in:
Ilya Kreymer 2018-02-26 22:53:52 -08:00 committed by John Berlin
parent 3020606608
commit 0d68f67049
No known key found for this signature in database
GPG Key ID: 6EF5E4B442011B02

View File

@ -91,8 +91,6 @@ class FrontEndApp(object):
self.cdx_api_endpoint = config.get('cdx_api_endpoint', '/cdx') self.cdx_api_endpoint = config.get('cdx_api_endpoint', '/cdx')
self._init_routes()
upstream_paths = self.get_upstream_paths(self.warcserver_server.port) upstream_paths = self.get_upstream_paths(self.warcserver_server.port)
framed_replay = config.get('framed_replay', True) framed_replay = config.get('framed_replay', True)
@ -106,6 +104,8 @@ class FrontEndApp(object):
metadata_templ = os.path.join(self.warcserver.root_dir, '{coll}', 'metadata.yaml') metadata_templ = os.path.join(self.warcserver.root_dir, '{coll}', 'metadata.yaml')
self.metadata_cache = MetadataCache(metadata_templ) self.metadata_cache = MetadataCache(metadata_templ)
self._init_routes()
def _init_routes(self): def _init_routes(self):
"""Initialize the routes and based on the configuration file makes available """Initialize the routes and based on the configuration file makes available
specific routes (proxy mode, record)""" specific routes (proxy mode, record)"""
@ -500,6 +500,11 @@ class FrontEndApp(object):
# store original script_name (original prefix) before modifications are made # store original script_name (original prefix) before modifications are made
environ['pywb.app_prefix'] = environ.get('SCRIPT_NAME', '') environ['pywb.app_prefix'] = environ.get('SCRIPT_NAME', '')
lang = args.pop('lang', '')
if lang:
pop_path_info(environ)
environ['pywb_lang'] = lang
response = endpoint(environ, **args) response = endpoint(environ, **args)
except HTTPException as hte: except HTTPException as hte: