Hello I got this error when trying out the Estore app.
File "/home/maurice/web2py/applications/EStore/controllers/default.py" 
<http://127.0.0.1:8000/admin/default/edit/EStore/controllers/default.py>, line 
157, in pay
description="Purchase".encode('utf-8')
File "/home/maurice/web2py/gluon/contrib/stripe.py", line 115, in __init__
self.signature = sha1(repr((self.amount,self.description))).hexdigest()
TypeError: Unicode-objects must be encoded before hashing


part of the code in default is:

@auth.requires_login()
def checkout():
    if session.checkout_form and not request.post_vars:
        for key in session.checkout_form:
            db.cart_order[key].default = session.checkout_form[key]
    form = SQLFORM(db.cart_order).process(dbio=False)
    if form.accepted:
        session.checkout_form = form.vars
        redirect(URL('pay'))
    return locals()

def pay():#Not working, error # description: TypeError: Unicode-objects 
must be encoded before hashing
    from gluon.contrib.stripe import StripeForm
    results = price_cart()
    stripe_form = StripeForm(
        pk=STRIPE_PUBLIC_KEY,
        sk=STRIPE_SECRET_KEY,
        amount=int(100*results['total_with_shipping']),  # (amount is in 
cents)amount=int(100*results['total_with_shipping']),  
        currency='eur',
        currency_symbol='€',
        description="Purchase".encode('utf-8')
    )
    stripe_form.process()

Help in correcting this error will be appreciated.
Thank you

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/96e2016b-92b6-4b43-8ae5-94cc6a082cc9n%40googlegroups.com.

Reply via email to