Hello,

I used this scenario don't know if it good or not... I am open to suggestion
if it is not a good pratice.

def index():
    """
    Index page using the internationalization operator T and flash
    rendered by views/default/index.html or views/generic.html
    """
    table,nb_events=last_hour_events(tables_list)
    return dict(
        table=table,
        nb_events=nb_events)


def last_hour_events(tables_list):
    """
    Establishing the list of last hour actions and return the 10 lasts of
the list
    """
    now = datetime.datetime.now()
    time_one_hour_before_now = now - datetime.timedelta(hours=1)
    last_hour_events_list = []
    for t in tables_list:
        for row in db(db[t].sdate >=
time_one_hour_before_now).select(db[t].id, orderby=db[t].sdate):
            last_hour_events_list.append(A(T('This is a new event in the
last hour'),
                _href=URL(r=request,c='test', f='read',args=(db[t],row.id
))))
    nb_events=len(last_hour_events_list)
    table=TABLE(last_hour_events_list[0:10])
    return (table,nb_events)

So I would like prevent the direct execution of the above function
("last_hour_events").

Wich decorator should I use?

Also, I think listing all the decorator available with description into one
location somewhere in the book could be a great improvement of the
documentation, since there is no complete information about decorators
excepted mention here and there few decorator at a time.

Richard

Reply via email to