}, } web.ctx.site.write(q) raise web.seeother('/account/preferences') def monkey_patch_debugerror(): """Monkey patch web.debug error to display template code.""" def xopen(filename): if filename.endswith('.tmpl') or filename.startswith('/macros/'): page = web.ctx.site.get(filename) if page is None: raise IOError("not found: " + filename) from six import StringIO return StringIO(page.body + "\n" * 100) else: return open(filename) web.debugerror.func_globals['open'] = xopen from infogami.core.code import register_preferences register_preferences(template_preferences) # load templates and macros from all sites. setup() monkey_patch_debugerror()
"key": context.user.key + "/preferences", "template_root": { "connect": "update", "value": i.path } } web.ctx.site.write(q) raise web.seeother('/account/preferences') def monkey_patch_debugerror(): """Monkey patch web.debug error to display template code.""" def xopen(filename): if filename.endswith('.tmpl') or filename.startswith('/macros/'): page = web.ctx.site.get(filename) if page is None: raise IOError("not found: " + filename) from StringIO import StringIO return StringIO(page.body + "\n" * 100) else: return open(filename) web.debugerror.func_globals['open'] = xopen from infogami.core.code import register_preferences register_preferences(template_preferences) # load templates and macros from all sites. setup() monkey_patch_debugerror()