Example #1
0
  def POST(self):
    you = auth.require_you()
    record = {'type':'commission','commissioner':you.id, 'created':make_timestamp()}

    try:
      commission_ish(record)
    except ValueError:
      return render("form", action="new", commission=record, you=auth.get_you(), error="Unacceptable Price")
    web.seeother('/')
Example #2
0
 def GET(self, commission_id):
   you = auth.require_you()
   if commission_id not in db:
     raise web.notfound()
   commission = db[commission_id]
   if commission['commissioner'] != you.id and you['openids'] != ["xri://=!E68D.731D.F0A8.BFA8"]:
     raise web.notfound()
   
   #if web.openid.status() == "xri://=!E68D.731D.F0A8.BFA8":
   #  return "awesome powers"
   return render("form", action=commission_id, commission=commission, you=auth.get_you())
Example #3
0
  def POST(self, commission_id):    
    you = auth.require_you()
    if commission_id not in db:
      raise web.notfound()
    commission = db[commission_id]
    if commission['commissioner'] != you.id and you['openids'] != ["xri://=!E68D.731D.F0A8.BFA8"]:
      raise web.notfound()

    try:
      commission_ish(commission)
    except ValueError:
      return render("form", action=commission_id, commission=commission, you=you, error="Unacceptable Price")

    web.seeother('/')
Example #4
0
 def test_empty(self):
     alerts = {
         'US.ADSK': {
             'adjLower': 277.1943867166462,
             'date': datetime.datetime(2020, 8, 30, 0, 0),
             'factor': 0.24,
             'inflate': 1.3521677400812009,
             'lower': 205.0,
             'memo': '',
             'price': 257.6600036621094,
             'upper': None
         }
     }
     html = renderer.render(alerts)
     self.assertEqual(
         html,
         "<html><body><ul><li>US.ADSK($257.6600036621094) falls below adjusted limit($277.1943867166462 with factor:24.00%)</li></body></ul></html>"
     )
Example #5
0
 def GET(self):
   return render("form", action="new", commission={}, you=auth.require_you())
Example #6
0
  def GET(self):
    commissions = usernames([row.value for row in database.commissions(db, descending=True)])
    finished = usernames([row.value for row in database.finished(db, descending=True)])
    deleted = usernames([row.value for row in database.deleted(db, descending=True)])

    return render("index", commissions=commissions, finished=finished, deleted=deleted, you=auth.get_you())