mod9-py3fstasks/main.py
def trim():
    '(push) task queue handler to delete oldest visits'
    oldest = float(request.get_json().get('oldest'))
    query = fs_client.collection('Visit')
    visits = query.where('timestamp', '<',
            datetime.fromtimestamp(oldest)).stream()
    dlist = ', '.join(str(v_id) for v_id in _delete_docs(visits))
    if dlist:
        print('Deleting %d entities: %s' % (dlist.count(',')+1, dlist))
    else:
        print('No entities older than: %s' % time.ctime(oldest))
    return ''
(push) task queue handler to delete oldest visits
(push) task queue handler to delete oldest visits
( push ) task queue handler to delete oldest visits
def trim():
    oldest = float(request.get_json().get('oldest'))
    query = fs_client.collection('Visit')
    visits = query.where('timestamp', '<',
            datetime.fromtimestamp(oldest)).stream()
    dlist = ', '.join(str(v_id) for v_id in _delete_docs(visits))
    if dlist:
        print('Deleting %d entities: %s' % (dlist.count(',')+1, dlist))
    else:
        print('No entities older than: %s' % time.ctime(oldest))
    return ''
def trim ( ) : oldest = float ( request . get_json ( ) . get ( 'oldest' ) ) query = fs_client . collection ( 'Visit' ) visits = query . where ( 'timestamp' , '<' , datetime . fromtimestamp ( oldest ) ) . stream ( ) dlist = ', ' . join ( str ( v_id ) for v_id in _delete_docs ( visits ) ) if dlist : print ( 'Deleting %d entities: %s' % ( dlist . count ( ',' ) + 1 , dlist ) ) else : print ( 'No entities older than: %s' % time . ctime ( oldest ) ) return ''
(push) task queue handler to delete oldest visits
( push ) task queue handler to delete oldest visits
'(push) task queue handler to delete oldest visits'