Python tornado.web.UIModule() Examples
The following are 8
code examples of tornado.web.UIModule().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tornado.web
, or try the search function
.
Example #1
Source File: web_test.py From tornado-zh with MIT License | 6 votes |
def get_app_kwargs(self): def my_ui_method(handler, x): return "In my_ui_method(%s) with handler value %s." % ( x, handler.value()) class MyModule(UIModule): def render(self, x): return "In MyModule(%s) with handler value %s." % ( x, self.handler.value()) loader = DictLoader({ 'foo.html': '{{ my_ui_method(42) }} {% module MyModule(123) %}', }) return dict(template_loader=loader, ui_methods={'my_ui_method': my_ui_method}, ui_modules={'MyModule': MyModule})
Example #2
Source File: web_test.py From tornado-zh with MIT License | 6 votes |
def get_app_kwargs(self): class WithoutUserModule(UIModule): def render(self): return '' class WithUserModule(UIModule): def render(self): return str(self.current_user) loader = DictLoader({ 'without_user.html': '', 'with_user.html': '{{ current_user }}', 'without_user_module.html': '{% module WithoutUserModule() %}', 'with_user_module.html': '{% module WithUserModule() %}', }) return dict(template_loader=loader, ui_modules={'WithUserModule': WithUserModule, 'WithoutUserModule': WithoutUserModule})
Example #3
Source File: web_test.py From tornado-zh with MIT License | 6 votes |
def get_app_kwargs(self): def my_ui_method(handler, x): return "In my_ui_method(%s) with handler value %s." % ( x, handler.value()) class MyModule(UIModule): def render(self, x): return "In MyModule(%s) with handler value %s." % ( x, self.handler.value()) loader = DictLoader({ 'foo.html': '{{ my_ui_method(42) }} {% module MyModule(123) %}', }) return dict(template_loader=loader, ui_methods={'my_ui_method': my_ui_method}, ui_modules={'MyModule': MyModule})
Example #4
Source File: web_test.py From tornado-zh with MIT License | 6 votes |
def get_app_kwargs(self): class WithoutUserModule(UIModule): def render(self): return '' class WithUserModule(UIModule): def render(self): return str(self.current_user) loader = DictLoader({ 'without_user.html': '', 'with_user.html': '{{ current_user }}', 'without_user_module.html': '{% module WithoutUserModule() %}', 'with_user_module.html': '{% module WithUserModule() %}', }) return dict(template_loader=loader, ui_modules={'WithUserModule': WithUserModule, 'WithoutUserModule': WithoutUserModule})
Example #5
Source File: web_test.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def get_app_kwargs(self): def my_ui_method(handler, x): return "In my_ui_method(%s) with handler value %s." % ( x, handler.value()) class MyModule(UIModule): def render(self, x): return "In MyModule(%s) with handler value %s." % ( x, self.handler.value()) loader = DictLoader({ 'foo.html': '{{ my_ui_method(42) }} {% module MyModule(123) %}', }) return dict(template_loader=loader, ui_methods={'my_ui_method': my_ui_method}, ui_modules={'MyModule': MyModule})
Example #6
Source File: web_test.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def get_app_kwargs(self): class WithoutUserModule(UIModule): def render(self): return '' class WithUserModule(UIModule): def render(self): return str(self.current_user) loader = DictLoader({ 'without_user.html': '', 'with_user.html': '{{ current_user }}', 'without_user_module.html': '{% module WithoutUserModule() %}', 'with_user_module.html': '{% module WithUserModule() %}', }) return dict(template_loader=loader, ui_modules={'WithUserModule': WithUserModule, 'WithoutUserModule': WithoutUserModule})
Example #7
Source File: web_test.py From viewfinder with Apache License 2.0 | 5 votes |
def get_app_kwargs(self): def my_ui_method(handler, x): return "In my_ui_method(%s) with handler value %s." % ( x, handler.value()) class MyModule(UIModule): def render(self, x): return "In MyModule(%s) with handler value %s." % ( x, self.handler.value()) loader = DictLoader({ 'foo.html': '{{ my_ui_method(42) }} {% module MyModule(123) %}', }) return dict(template_loader=loader, ui_methods={'my_ui_method': my_ui_method}, ui_modules={'MyModule': MyModule})
Example #8
Source File: web_test.py From viewfinder with Apache License 2.0 | 5 votes |
def get_app_kwargs(self): def my_ui_method(handler, x): return "In my_ui_method(%s) with handler value %s." % ( x, handler.value()) class MyModule(UIModule): def render(self, x): return "In MyModule(%s) with handler value %s." % ( x, self.handler.value()) loader = DictLoader({ 'foo.html': '{{ my_ui_method(42) }} {% module MyModule(123) %}', }) return dict(template_loader=loader, ui_methods={'my_ui_method': my_ui_method}, ui_modules={'MyModule': MyModule})