'When an Event is updated, check for closure'

@staticmethod
def event_update_onaccept(form):

    form_vars = form.vars
    if form_vars.closed:
        event = form_vars.id
        s3 = current.session.s3
        if (s3.event == event):
            s3.event = None
        db = current.db
        ltable = current.s3db.event_post
        table = db.cms_post
        rows = db((ltable.event_id == event)).select(ltable.post_id)
        for row in rows:
            db((table.id == row.post_id)).update(expired=True)
