def index():
    return dict()
# List all the current records in the database
def list():
    highways = db().select(db.highways.ALL, orderby=db.highways.lognum)
    return dict(highways = highways)
# Show details of a single record
def show():
    # Retrieve the requested log entry from the database
    # Assumes the requested entry exists in the db (no error handling yet)
    hwy = db(db.highways.lognum == request.args(0)).select().first()
    return dict(hwy=hwy)
# Display a search form
def search():
    form = FORM(INPUT(_name='log_number', requires=IS_NOT_EMPTY()),
                INPUT(_type='submit'))
    if form.process().accepted:
        session.log_number = form.vars.log_number
        redirect(URL('results'))
    return dict(form=form)
# Show the item that was found in the search
def results():
    hwy = db(db.highways.lognum == session.log_number).select().first()
    return dict(hwy=hwy)
# Create a new record
def submit():
    # Don't name this function 'request' because it creates a name conflict with http.request
    form = SQLFORM(db.highways)
    if form.process().accepted:
        response.flash = 'your submission is accepted'
        redirect(URL('list'))
    return dict(form=form)
