http: Rename 'path' to 'static_file_path'
This commit is contained in:
parent
4d7ab27836
commit
cad0207ef8
@ -63,8 +63,8 @@ class Router(object):
|
|||||||
#: Name of the HTTP router implementation, must be overridden.
|
#: Name of the HTTP router implementation, must be overridden.
|
||||||
name = None
|
name = None
|
||||||
|
|
||||||
#: Path to location of static files.
|
#: Path to location of static files to be served.
|
||||||
path = None
|
static_file_path = None
|
||||||
|
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.config = config
|
self.config = config
|
||||||
@ -91,13 +91,13 @@ class Router(object):
|
|||||||
:return: list of Tornado routes
|
:return: list of Tornado routes
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.path is None:
|
if self.static_file_path is None:
|
||||||
raise ValueError('Undefined path in %s' % self)
|
raise ValueError('Undefined static file path in %s' % self)
|
||||||
logger.info(
|
logger.info(
|
||||||
'Serving HTTP extension %s at %s', type(self), self.linkify())
|
'Serving HTTP extension %s at %s', type(self), self.linkify())
|
||||||
return [
|
return [
|
||||||
(r'/%s/(.*)' % self.name, StaticFileHandler, {
|
(r'/%s/(.*)' % self.name, StaticFileHandler, {
|
||||||
'path': self.path,
|
'path': self.static_file_path,
|
||||||
'default_filename': 'index.html'
|
'default_filename': 'index.html'
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -23,7 +23,7 @@ if tornado:
|
|||||||
|
|
||||||
class TestRouter(http.Router):
|
class TestRouter(http.Router):
|
||||||
name = 'test'
|
name = 'test'
|
||||||
path = os.path.join(os.path.dirname(__file__), 'static')
|
static_file_path = os.path.join(os.path.dirname(__file__), 'static')
|
||||||
|
|
||||||
|
|
||||||
class TestRouterMissingPath(http.Router):
|
class TestRouterMissingPath(http.Router):
|
||||||
@ -31,7 +31,7 @@ class TestRouterMissingPath(http.Router):
|
|||||||
|
|
||||||
|
|
||||||
class TestRouterMissingName(http.Router):
|
class TestRouterMissingName(http.Router):
|
||||||
path = os.path.join(os.path.dirname(__file__), 'static')
|
static_file_path = os.path.join(os.path.dirname(__file__), 'static')
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(tornado, 'tornado is missing')
|
@unittest.skipUnless(tornado, 'tornado is missing')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user