http: Rename 'linkify()' to 'get_root_url()'

This commit is contained in:
Stein Magnus Jodal 2014-05-20 22:16:01 +02:00
parent c84a3fc349
commit e8291d471e
2 changed files with 4 additions and 8 deletions

View File

@ -73,12 +73,8 @@ class Router(object):
if not self.name: if not self.name:
raise ValueError('Undefined router name in %s' % self) raise ValueError('Undefined router name in %s' % self)
def linkify(self): def get_root_url(self):
""" """Get the absolute URL to the root of this router."""
Absolute URL to the root of this router.
:return: URL this router is mounted at
"""
return 'http://%s:%s/%s/' % (self.hostname, self.port, self.name) return 'http://%s:%s/%s/' % (self.hostname, self.port, self.name)
def setup_routes(self): def setup_routes(self):
@ -94,7 +90,7 @@ class Router(object):
if self.static_file_path is None: if self.static_file_path is None:
raise ValueError('Undefined static file 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.get_root_url())
return [ return [
(r'/%s/(.*)' % self.name, StaticFileHandler, { (r'/%s/(.*)' % self.name, StaticFileHandler, {
'path': self.static_file_path, 'path': self.static_file_path,

View File

@ -64,7 +64,7 @@ class HttpRouterTest(unittest.TestCase):
def test_default_uri_helper(self): def test_default_uri_helper(self):
router = TestRouter(self.config) router = TestRouter(self.config)
self.assertEqual('http://127.0.0.1:6680/test/', router.linkify()) self.assertEqual('http://127.0.0.1:6680/test/', router.get_root_url())
class StaticFileHandlerTest(AsyncHTTPTestCase): class StaticFileHandlerTest(AsyncHTTPTestCase):