If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!

Instructions

1. Follow the steps here to enable Blackberry PIN and email headers. They will be used to detect and create users in the database. If you cannot enable the headers then you must modify the app to use normal auth

2. Download and install the mileage tracker app from here (right click / save as)

3. That's all. A test user will be created if you use the app from a non-blackberry device. To disable the test user, modify the get_user function in db.py:

def _get_user():    
    try:
        eml = request.env.http_rim_device_email
        pin = request.env.http_rim_device_id
        if not (eml and pin):
            eml = "testuser@yourdomain.com"
            pin = "12345678"
            #redirect(URL(r=request,f='unauthorized'))
        user = db(db.bbuser.email==eml).select()
        if len(user):
            return user[0]
        else:
            db.bbuser.insert(email=eml,pin=pin)
            db.commit()
            user = db(db.bbuser.email==eml).select()
            return user[0] 
    except:
        redirect(URL(r=request,f='unauthorized'))

Comment out the test user eml and pin assignments and uncomment the redirect.

Comments (0)


Hosting graciously provided by:
Python Anywhere