185:47c8998f49ef
Anton Shestakov <av6@dwimlabs.net>, Wed, 27 Jul 2016 18:43:12 +0800
viewer: using tuples for describing handlers is easier (Especially true since Tornado 3.2)

next change 216:f679f272fe10
previous change 131:0cb14e3f792e

candolint/uimodules.py

Permissions: -rw-r--r--

Other formats: Feeds:
from tornado.web import UIModule
class Time(UIModule):
def render(self, value, format_=True):
if format_:
datetime = value.isoformat() + 'Z'
text = value.strftime('%Y-%m-%d %H:%M:%S') + ' UTC'
else:
parts = value.split(' ', 2)
datetime = '{}T{}{}'.format(*parts)
text = value
return self.render_string('ui/time.html', datetime=datetime, text=text)
class Badges(UIModule):
def render(self, check):
return self.render_string('ui/badges.html', check=check)