def render_home(req, config): secret = (Right(config['secret']) if config.has_key('secret') else Left( KeyError('No secret found in config'))) contents = (secret.fmap( lambda s: ("<h1><a href=\"%s\">Your secret is: %s!</a></h1>" % (encode_path(HomeR()), s)))) return (fold(reject, lambda c: resolve(c).fmap(from_html), contents))
def render_home(req,config): secret = ( Right(config['secret']) if config.has_key('secret') else Left(KeyError('No secret found in config')) ) contents = ( secret.fmap( lambda s: ( "<h1><a href=\"%s\">Your secret is: %s!</a></h1>" % (encode_path(HomeR()), s) )) ) return ( fold( reject, lambda c: resolve(c).fmap(from_html), contents ) )
def render_item(id): return resolve({"id": id}) >> encode_json
def render_home(req): return (resolve("<h1><a href=\"%s\">Hello world!</a></h1>" % encode_path(HomeR())).fmap(from_html))
def _reject(*a, **kw): try: return resolve(fn(*a, **kw)) except Exception as e: return reject(err.wrap(e))
def _get_nick(u): return cache_get("/".join(('session', u.email(), 'nick')), resolve(u.nickname()))
def render_item(id): return resolve({ "id": id }) >> encode_json
def render_home(req): return ( resolve( "<h1><a href=\"%s\">Hello world!</a></h1>" % encode_path(HomeR()) ).fmap(from_html) )
def _reject(*a,**kw): try: return resolve( fn(*a,**kw) ) except Exception as e: return reject( err.wrap(e) )
def _get_nick(u): return cache_get( "/".join(('session',u.email(),'nick')), resolve(u.nickname()) )