diff --git a/config.yaml b/config.yaml
index 8f38f1ed..79c80279 100644
--- a/config.yaml
+++ b/config.yaml
@@ -31,27 +31,33 @@ surt_ordered: true
archive_paths: ./sample_archive/warcs/
-# ui: optional Jinja2 template to insert into
of each replay
+# ==== Optional UI: HTML/Jinja2 Templates ====
+
+# template for insert into replayed html content
head_insert_html: ./ui/head_insert.html
-# ui: optional text to directly insert into
-# only loaded if ui_head_insert_template_file is not specified
-
-#head_insert_text:
-
-#static_path: /static2/
-
-# ui: optional Jinja2 template to use for 'calendar' query,
+# template to for 'calendar' query,
# eg, a listing of captures in response to a ../*/
#
# may be a simple listing or a more complex 'calendar' UI
-# if omitted, the capture listing lists raw index
+# if omitted, will list raw cdx in plain text
query_html: ./ui/query.html
-# ui: optional Jinja2 template to use for 'search' page
-# this page is displayed when no search url is entered
+# template for search page, which is displayed when no search url is entered
+# in a collection
search_html: ./ui/search.html
+# template for home page.
+# if no other route is set, this will be rendered at /, /index.htm and /index.html
+home_html: ./ui/index.html
+
+
+# error page temlpate for may formatting error message and details
+# if omitted, a text response is returned
+error_html: ./ui/error.html
+
+# ==== Other Paths ====
+
# list of host names that pywb will be running from to detect
# 'fallthrough' requests based on referrer
#
@@ -62,13 +68,12 @@ search_html: ./ui/search.html
hostpaths: ['http://localhost:8080/']
-# ui: optional Jinja2 template for home page
-# if no other route is set to home page, this template will
-# be rendered at /, /index.htm and /index.html
-home_html: ./ui/index.html
+# Custom path for serving html content
+# Default is hostname[0] + '/static/'
+#static_path: /static/
+# ==== New / Experimental Settings ====
+# Not yet production ready -- used primarily for testing
-# ui: optional Jinja2 template for rendering any errors
-# the error page may print a detailed error message
-error_html: ./ui/error.html
-
+# enable cdx server api for querying cdx directly (experimental)
+enable_cdx_api: false
diff --git a/pywb/archivalrouter.py b/pywb/archivalrouter.py
index 8fb17ec3..ecaccfd4 100644
--- a/pywb/archivalrouter.py
+++ b/pywb/archivalrouter.py
@@ -7,9 +7,9 @@ from url_rewriter import UrlRewriter
from wburl import WbUrl
#=================================================================
-# ArchivalRequestRouter -- route WB requests in archival mode
+# ArchivalRouter -- route WB requests in archival mode
#=================================================================
-class ArchivalRequestRouter:
+class ArchivalRouter:
def __init__(self, routes, hostpaths = None, abs_path = True, home_view = None, error_view = None):
self.routes = routes
self.fallback = ReferRedirect(hostpaths)
diff --git a/pywb/config_utils.py b/pywb/config_utils.py
index c4755eec..5a315d51 100644
--- a/pywb/config_utils.py
+++ b/pywb/config_utils.py
@@ -4,7 +4,6 @@ import handlers
import indexreader
import replay_views
import replay_resolvers
-from archivalrouter import ArchivalRequestRouter, Route
import logging
diff --git a/pywb/handlers.py b/pywb/handlers.py
index 37a7eb9c..264943cd 100644
--- a/pywb/handlers.py
+++ b/pywb/handlers.py
@@ -95,6 +95,9 @@ class CDXHandler(BaseHandler):
def get_wburl_type():
return None
+ def __str__(self):
+ return 'CDX Server: ' + str(self.cdx_reader)
+
#=================================================================
# Debug Handlers
#=================================================================
diff --git a/pywb/pywb_init.py b/pywb/pywb_init.py
index 1f8f6184..38772c99 100644
--- a/pywb/pywb_init.py
+++ b/pywb/pywb_init.py
@@ -1,6 +1,6 @@
import handlers
import indexreader
-from archivalrouter import ArchivalRequestRouter, Route
+import archivalrouter
import os
import yaml
import config_utils
@@ -31,40 +31,40 @@ def pywb_config_manual(config = {}):
cdx_source = indexreader.IndexReader.make_best_cdx_source(index_paths, **config)
# cdx query handler
- if config.get('enable_cdx_api', True):
- routes.append(Route(name + '-cdx', handlers.CDXHandler(cdx_source)))
+ if config.get('enable_cdx_api', False):
+ routes.append(archivalrouter.Route(name + '-cdx', handlers.CDXHandler(cdx_source)))
wb_handler = config_utils.create_wb_handler(
cdx_source = cdx_source,
archive_paths = config.get('archive_paths', './sample_archive/warcs/'),
- head_html = config.get('head_insert_html', './ui/head_insert.html'),
- query_html = config.get('query_html', './ui/query.html'),
- search_html = config.get('search_html', './ui/search.html'),
+ head_html = config.get('head_insert_html'),
+ query_html = config.get('query_html'),
+ search_html = config.get('search_html'),
static_path = config.get('static_path', hostpaths[0] + 'static/')
)
logging.info('Adding Collection: ' + name)
- routes.append(Route(name, wb_handler))
+ routes.append(archivalrouter.Route(name, wb_handler))
if config.get('debug_echo_env', False):
- routes.append(Route('echo_env', handlers.DebugEchoEnvHandler()))
+ routes.append(archivalrouter.Route('echo_env', handlers.DebugEchoEnvHandler()))
if config.get('debug_echo_req', False):
- routes.append(Route('echo_req', handlers.DebugEchoHandler()))
+ routes.append(archivalrouter.Route('echo_req', handlers.DebugEchoHandler()))
# Finally, create wb router
- return ArchivalRequestRouter(
+ return archivalrouter.ArchivalRouter(
routes,
# Specify hostnames that pywb will be running on
# This will help catch occasionally missed rewrites that fall-through to the host
# (See archivalrouter.ReferRedirect)
hostpaths = hostpaths,
- home_view = config_utils.load_template_file(config.get('home_html', './ui/index.html'), 'Home Page'),
- error_view = config_utils.load_template_file(config.get('error_html', './ui/error.html'), 'Error Page')
+ home_view = config_utils.load_template_file(config.get('home_html'), 'Home Page'),
+ error_view = config_utils.load_template_file(config.get('error_html'), 'Error Page')
)
diff --git a/run-tests.py b/run-tests.py
index 3cfbc46d..9b39436c 100644
--- a/run-tests.py
+++ b/run-tests.py
@@ -3,10 +3,12 @@ import pywb.pywb_init
from pywb.indexreader import CDXCaptureResult
class TestWb:
+ TEST_CONFIG = 'test_config.yaml'
+
def setup(self):
import pywb.wbapp
#self.app = pywb.wbapp.create_wb_app(pywb.pywb_init.pywb_config())
- self.app = pywb.wbapp.create_wb_app(pywb.pywb_init.pywb_config_manual())
+ self.app = pywb.wbapp.create_wb_app(pywb.pywb_init.pywb_config(self.TEST_CONFIG))
self.testapp = webtest.TestApp(self.app)
def _assert_basic_html(self, resp):