All pastes #477135 Raw Edit

Unnamed

public python v1 · immutable
·published 2007-05-08 14:18 UTC
rendered paste body
# -*- encoding: UTF-8 -*-import osimport localeimport cherrypyfrom paste.evalexception.middleware import EvalExceptionimport verkstjorinn.routingconf = {    '/': {        'request.dispatch': verkstjorinn.routing.setup_routes(),        'wsgi.pipeline': [('EvalException', EvalException)],        'request.throw_errors': True,        'tools.encode.on': True,        'tools.encode.encoding': 'UTF-8',        'tools.decode.on': True,        'tools.decode.encoding': 'UTF-8',        'tools.sacleanup.on': True,        'tools.auth.on': True,    },    '/static': {        'tools.staticdir.on': True,        'tools.staticdir.root': os.path.dirname(os.path.abspath(__file__)),        'tools.staticdir.dir': 'static'    },    '/favicon.ico': {        'tools.staticfile.on': True,        'tools.staticfile.filename': os.path.join(os.path.dirname(__file__), 'static/img/favicon.ico')    },}def start(config):    cherrypy.config.update(config)    locale.setlocale(locale.LC_ALL, cherrypy.config.get('verkstjorinn.locale', ''))    cherrypy.quickstart(None, config=conf)### verkstjorinn.routing module:# -*- encoding: UTF-8 -*-import cherrypyimport controllersimport controllers.dagbokimport authdispatcher = Nonedef setup_routes():    d = cherrypy.dispatch.RoutesDispatcher()    d.connect('auth', 'auth/:action', controller=auth.LoginController(), action='loginform')    d.connect('verkefni', 'verkefni/:verkefni_id/:action', controller=controllers.VerkefniController())    d.connect('dagbok', 'dagbok/:year/:month/:day/:action', controller=controllers.dagbok.DagbokController(), year=0, month=0, day=0)    d.connect('main', ':action', controller=controllers.MainController())    dispatcher = d    return dispatcher