示例#1
0
文件: app.py 项目: elwillow/kaiinshou
    def GET(self, action, badge_id):
        cart_id = view.getCookie()
        if not cart_id:
            raise web.seeother(config.make_url("/"))
        elif "status" in db.getCart(cart_id):
            view.destroyCookie()
            raise web.seeother(config.make_url("/"))

        return render.base(view.cartListing(cart_id, (action, badge_id)))
示例#2
0
    def GET(self, action, badge_id):
        cart_id = view.getCookie()
        if not cart_id:
            raise web.seeother(config.make_url("/"))
        elif "status" in db.getCart(cart_id):
            view.destroyCookie()
            raise web.seeother(config.make_url("/"))

        return render.base(view.cartListing(cart_id, (action, badge_id)))
示例#3
0
文件: app.py 项目: elwillow/kaiinshou
    def GET(self):
        """Display the cart listing"""
        cart_id = web.cookies().get(config.cookieName)
        if not cart_id:
            cart_number = view.generateCartNumber()
            cart_id = db.newCart(cart_number)
            view.saveCookie(cart_id)
        elif "status" in db.getCart(cart_id):
            view.destroyCookie()
            cart_number = view.generateCartNumber()
            cart_id = db.newCart(cart_number)
            view.saveCookie(cart_id)

        return render.base(view.cartListing(cart_id))
示例#4
0
    def GET(self):
        """Display the cart listing"""
        cart_id = web.cookies().get(config.cookieName)
        if not cart_id:
            cart_number = view.generateCartNumber()
            cart_id = db.newCart(cart_number)
            view.saveCookie(cart_id)
        elif "status" in db.getCart(cart_id):
            view.destroyCookie()
            cart_number = view.generateCartNumber()
            cart_id = db.newCart(cart_number)
            view.saveCookie(cart_id)

        return render.base(view.cartListing(cart_id))
示例#5
0
    def GET(self, cart_id, hash):
        """Validate an email and forward to the pickup page"""
        try:
            bson.objectid.ObjectId(cart_id)
        except bson.errors.InvalidId:
            return render.base(render.validate(None, ("bad", "Invalid ObjectId")), "Confirmation", True)

        cart = db.getCart(cart_id)
        if not cart:
            return render.base("""<h2>Ce courriel est invalide</h2>""", "Confirmation", True)

        vEmail = hashlib.sha1()
        vEmail.update(cart["email"])
        vEmail.update(config.salt)
        if vEmail.hexdigest() == hash:
            db.cartValidEmail(cart_id)
            raise web.seeother(config.make_url("/pickup/%s" % (cart_id, )))
        else:
           return  render.base("""<h2>Ce courriel est invalide</h2>""", "Confirmation", True)
示例#6
0
 def __init__(self, username):
     if db.selectItemCount(username) == 0:
         self.__lineItems = []
     else:
         self.__lineItems = db.getCart(username)