def _task_soft_delete(context, session=None):
 expires_at = models.Task.expires_at
 session = (session or get_session())
 query = session.query(models.Task)
 query = query.filter((models.Task.owner == context.owner)).filter_by(deleted=0).filter((expires_at <= timeutils.utcnow()))
 values = {'deleted': 1, 'deleted_at': timeutils.utcnow()}
 with session.begin():
  query.update(values)

def _task_soft_delete ( context , session = None ) : expires_at = models . Task . expires_at session = ( session or get_session ( ) ) query = session . query ( models . Task ) query = query . filter ( ( models . Task . owner == context . owner ) ) . filter_by ( deleted = 0 ) . filter ( ( expires_at <= timeutils . utcnow ( ) ) ) values = { 'deleted' : 1 , 'deleted_at' : timeutils . utcnow ( ) } with session . begin ( ) : query . update ( values )
scrub task entities which are expired .