Skip to content

Commit

Permalink
update examples with extension_name-->name
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsailer committed Jun 4, 2020
1 parent dcad189 commit b6183f5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions examples/simple/simple_ext1/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)
])

Expand Down
10 changes: 5 additions & 5 deletions examples/simple/simple_ext1/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<extension_name>).
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/<name>).
self.log.info("Static URL for / in simple_ext1 Default Handler:".format(self.static_url(path='/')))
self.write('<h1>Hello Simple 1 - I am the default...</h1>')
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]
Expand Down
2 changes: 1 addition & 1 deletion examples/simple/simple_ext11/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion examples/simple/simple_ext2/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit b6183f5

Please sign in to comment.