From b6183f5179b46b53cefcc6c2a401e95c9c4c14c3 Mon Sep 17 00:00:00 2001 From: Zsailer Date: Mon, 1 Jun 2020 14:55:31 -0700 Subject: [PATCH] update examples with extension_name-->name --- examples/simple/simple_ext1/application.py | 12 ++++++------ examples/simple/simple_ext1/handlers.py | 10 +++++----- examples/simple/simple_ext11/application.py | 2 +- examples/simple/simple_ext2/application.py | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/simple/simple_ext1/application.py b/examples/simple/simple_ext1/application.py index 20a9aebc75..4ddf889096 100644 --- a/examples/simple/simple_ext1/application.py +++ b/examples/simple/simple_ext1/application.py @@ -10,7 +10,7 @@ class SimpleApp1(ExtensionAppJinjaMixin, ExtensionApp): # The name of the extension. - extension_name = "simple_ext1" + name = "simple_ext1" # The url that your extension will serve its homepage. extension_url = '/simple_ext1/default' @@ -45,11 +45,11 @@ class SimpleApp1(ExtensionAppJinjaMixin, ExtensionApp): def initialize_handlers(self): self.handlers.extend([ - (r'/{}/default'.format(self.extension_name), DefaultHandler), - (r'/{}/params/(.+)$'.format(self.extension_name), ParameterHandler), - (r'/{}/template1/(.*)$'.format(self.extension_name), TemplateHandler), - (r'/{}/redirect'.format(self.extension_name), RedirectHandler), - (r'/{}/typescript/?'.format(self.extension_name), TypescriptHandler), + (r'/{}/default'.format(self.name), DefaultHandler), + (r'/{}/params/(.+)$'.format(self.name), ParameterHandler), + (r'/{}/template1/(.*)$'.format(self.name), TemplateHandler), + (r'/{}/redirect'.format(self.name), RedirectHandler), + (r'/{}/typescript/?'.format(self.name), TypescriptHandler), (r'/{}/(.*)', ErrorHandler) ]) diff --git a/examples/simple/simple_ext1/handlers.py b/examples/simple/simple_ext1/handlers.py index f635d1e2c1..fd7fef4405 100644 --- a/examples/simple/simple_ext1/handlers.py +++ b/examples/simple/simple_ext1/handlers.py @@ -4,17 +4,17 @@ class DefaultHandler(ExtensionHandlerMixin, JupyterHandler): def get(self): # The name of the extension to which this handler is linked. - self.log.info("Extension Name in {} Default Handler: {}".format(self.extension_name, self.extension_name)) - # A method for getting the url to static files (prefixed with /static/). + self.log.info("Extension Name in {} Default Handler: {}".format(self.name, self.name)) + # A method for getting the url to static files (prefixed with /static/). self.log.info("Static URL for / in simple_ext1 Default Handler:".format(self.static_url(path='/'))) self.write('

Hello Simple 1 - I am the default...

') - self.write('Config in {} Default Handler: {}'.format(self.extension_name, self.config)) + self.write('Config in {} Default Handler: {}'.format(self.name, self.config)) class RedirectHandler(ExtensionHandlerMixin, JupyterHandler): def get(self): - self.redirect("/static/{}/favicon.ico".format(self.extension_name)) + self.redirect("/static/{}/favicon.ico".format(self.name)) -class ParameterHandler(ExtensionHandlerMixin, JupyterHandler): +class ParameterHandler(ExtensionHandlerMixin, JupyterHandler): def get(self, matched_part=None, *args, **kwargs): var1 = self.get_argument('var1', default=None) components = [x for x in self.request.path.split("/") if x] diff --git a/examples/simple/simple_ext11/application.py b/examples/simple/simple_ext11/application.py index bc04a16a5c..b772bb34ff 100644 --- a/examples/simple/simple_ext11/application.py +++ b/examples/simple/simple_ext11/application.py @@ -15,7 +15,7 @@ class SimpleApp11(SimpleApp1): }) # The name of the extension. - extension_name = "simple_ext11" + name = "simple_ext11" # Te url that your extension will serve its homepage. extension_url = '/simple_ext11/default' diff --git a/examples/simple/simple_ext2/application.py b/examples/simple/simple_ext2/application.py index 7251da7900..be59ce9bfa 100644 --- a/examples/simple/simple_ext2/application.py +++ b/examples/simple/simple_ext2/application.py @@ -9,7 +9,7 @@ class SimpleApp2(ExtensionAppJinjaMixin, ExtensionApp): # The name of the extension. - extension_name = "simple_ext2" + name = "simple_ext2" # Te url that your extension will serve its homepage. extension_url = '/simple_ext2'