예제 #1
0
 def POST(self):
     cookie = web.cookies()[loggedInCookie]
     if len(cookie):
         i = web.input()
         print "[DBG] web.input() = %s" % (json.dumps(i),)
         print "[DBG] web.data() = %s" % (json.dumps(web.data()),)
         _amnt = i.amount
         _cat = i.category
         _desc = utils.allOrNone(i.description)
         _date = utils.timestampFromDate(i.date, False)
         print "[DBG] (amount, category, description, date) = (%s, %s, %s, %s)" % (_amnt, _cat, _desc, _date)
         self.m_worker.newExpense(amount = _amnt, category = _cat,
                 description = _desc, date = _date,
                 cookie = long(cookie))
     else:
         pass
     pass
예제 #2
0
         utils.timestamp()]))])[0]
 worker.userLogin(uid, ck, utils.timestamp(False), email,
         "xyz__nnnn", "Prakhar",
         "Sharma", "631-885-4602", utils.timestamp(False), 'manual')
 cont = raw_input("wanna report an expense (y/n): ")
 if cont == "y" or cont == "Y":
     amnt = float(raw_input("bill amount: "))
     catg = raw_input("bill category: ")
     uid = worker.userIdFromCookie(ck)
     if uid is None:
         sys.stderr.write("User for cookie %s not present" % ck)
         sys.exit(1)
     listify = lambda tags: ((tags is None or len(tags) == 0)
             and [[]] or [tags.split(",")])[0]
     tags = listify(raw_input("tags (csv list): "))
     desc = utils.allOrNone(raw_input("desc: "))
     members = listify(raw_input("participants: "))
     amounts = listify(raw_input("participants contributions: "))
     emails = listify(raw_input("emails: "))
     btype = raw_input("bill type [individual, shared, itemized]: ")
     tstmp = utils.timestamp(False)
     worker.newBill(userCookie = ck, amount = amnt, category = catg,
             date = tstmp, reportedBy = uid, reportedAt = tstmp,
             billType = btype, participants = members, tags = tags,
             description = desc, userAmounts = amounts,
             emails = emails)
 cont = raw_input("wanna see report (y/n): ")
 if cont == "y" or cont == "Y":
     date = raw_input("date (YYYYMMDD): ")
     category = utils.allOrNone(raw_input("category: "))
     print worker.reportRequest(userCookie = ck,