def _execute_with_revision(q, rev_table, context):
 model = context['model']
 session = model.Session
 revision_id = context.get('revision_id')
 revision_date = context.get('revision_date')
 if revision_id:
  revision = session.query(context['model'].Revision).filter_by(id=revision_id).first()
  if (not revision):
   raise logic.NotFound
  revision_date = revision.timestamp
 q = q.where((rev_table.c.revision_timestamp <= revision_date))
 q = q.where((rev_table.c.expired_timestamp > revision_date))
 return session.execute(q)

def _execute_with_revision ( q , rev_table , context ) : model = context [ 'model' ] session = model . Session revision_id = context . get ( 'revision_id' ) revision_date = context . get ( 'revision_date' ) if revision_id : revision = session . query ( context [ 'model' ] . Revision ) . filter_by ( id = revision_id ) . first ( ) if ( not revision ) : raise logic . NotFound revision_date = revision . timestamp q = q . where ( ( rev_table . c . revision_timestamp <= revision_date ) ) q = q . where ( ( rev_table . c . expired_timestamp > revision_date ) ) return session . execute ( q )
takes an sqlalchemy query (q) that is a select on an object revision table .