view plugins/extensions/custompage.py @ 5000:082ee3ded101 routing

Improve docs for registerHandler
author anatoly techtonik <techtonik@gmail.com>
date Fri, 11 Sep 2015 08:16:38 +0300
parents 8aac417c1899
children
line wrap: on
line source

# This Roundup extension was written by techtonik@gmail.com and it's been
# placed in the Public Domain. Copy and modify to your heart's content.

"""
The extension demonstrates Roundup API for creating custom pages
for tracker. 
"""


def render_html():
  """Page with static html."""
  return "I'm <b>glowing</b>."

def render_version():
  """
  Page with some 'dynamic' content demonstrating that extension
  may import Roundup to access its API, but doesn't need
  to depend on it.
  """
  import roundup
  return "Roundup %s" % roundup.__version__


def init(tracker):
  tracker.registerHandler('/staticpage', render_html)
  tracker.registerHandler('/version', render_version)

Roundup Issue Tracker: http://roundup-tracker.org/