Skip to content

Commit

Permalink
Update docs for UIModule.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarnell committed Feb 1, 2015
1 parent 2716458 commit 96f81df
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions tornado/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -2633,6 +2633,8 @@ class UIModule(object):
UI modules often execute additional queries, and they can include
additional CSS and JavaScript that will be included in the output
page, which is automatically inserted on page render.
Subclasses of UIModule must override the `render` method.
"""
def __init__(self, handler):
self.handler = handler
Expand All @@ -2645,31 +2647,43 @@ def current_user(self):
return self.handler.current_user

def render(self, *args, **kwargs):
"""Overridden in subclasses to return this module's output."""
"""Override in subclasses to return this module's output."""
raise NotImplementedError()

def embedded_javascript(self):
"""Returns a JavaScript string that will be embedded in the page."""
"""Override to return a JavaScript string to be embedded in the page."""
return None

def javascript_files(self):
"""Returns a list of JavaScript files required by this module."""
"""Override to return a list of JavaScript files needed by this module.
If the return values are relative paths, they will be passed to
`RequestHandler.static_url`; otherwise they will be used as-is.
"""
return None

def embedded_css(self):
"""Returns a CSS string that will be embedded in the page."""
"""Override to return a CSS string that will be embedded in the page."""
return None

def css_files(self):
"""Returns a list of CSS files required by this module."""
"""Override to returns a list of CSS files required by this module.
If the return values are relative paths, they will be passed to
`RequestHandler.static_url`; otherwise they will be used as-is.
"""
return None

def html_head(self):
"""Returns a CSS string that will be put in the <head/> element"""
"""Override to return an HTML string that will be put in the <head/>
element.
"""
return None

def html_body(self):
"""Returns an HTML string that will be put in the <body/> element"""
"""Override to return an HTML string that will be put at the end of
the <body/> element.
"""
return None

def render_string(self, path, **kwargs):
Expand Down

0 comments on commit 96f81df

Please sign in to comment.