Files
deb-python-pecan/pecan/decorators.py
Jonathan LaCour 5c32201386 Initial commit.
2010-09-28 13:08:30 -04:00

9 lines
378 B
Python

def expose(template=None, content_type='text/html'):
if template == 'json': content_type = 'application/json'
def decorate(f):
f.exposed = True
if not hasattr(f, 'pecan'): f.pecan = {}
f.pecan.setdefault('template', []).append(template)
f.pecan.setdefault('content_types', {})[content_type] = template
return f
return decorate