Esempio n. 1
0
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))
Esempio n. 2
0
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
    )
  )
Esempio n. 3
0
def render_item(id):
    return resolve({"id": id}) >> encode_json
Esempio n. 4
0
def render_home(req):
    return (resolve("<h1><a href=\"%s\">Hello world!</a></h1>" %
                    encode_path(HomeR())).fmap(from_html))
Esempio n. 5
0
 def _reject(*a, **kw):
     try:
         return resolve(fn(*a, **kw))
     except Exception as e:
         return reject(err.wrap(e))
Esempio n. 6
0
File: app.py Progetto: ericgj/fungi
 def _get_nick(u):
     return cache_get("/".join(('session', u.email(), 'nick')),
                      resolve(u.nickname()))
Esempio n. 7
0
def render_item(id):
  return resolve({ "id": id }) >> encode_json
Esempio n. 8
0
def render_home(req):
  return (
    resolve(
      "<h1><a href=\"%s\">Hello world!</a></h1>" % encode_path(HomeR())
    ).fmap(from_html)
  )
Esempio n. 9
0
 def _reject(*a,**kw):
   try:
     return resolve( fn(*a,**kw) )
   except Exception as e:
     return reject( err.wrap(e) )
Esempio n. 10
0
File: app.py Progetto: ericgj/fungi
 def _get_nick(u):
   return cache_get( "/".join(('session',u.email(),'nick')), resolve(u.nickname()) )