def col_download_unread(cols_selected):
 submissions = []
 for sid in cols_selected:
  id = Source.query.filter((Source.filesystem_id == sid)).one().id
  submissions += Submission.query.filter((Submission.downloaded == False), (Submission.source_id == id)).all()
 if (submissions == []):
  flash('No unread submissions in collections selected!', 'error')
  return redirect(url_for('index'))
 return download('unread', submissions)

def col_download_unread ( cols_selected ) : submissions = [ ] for sid in cols_selected : id = Source . query . filter ( ( Source . filesystem_id == sid ) ) . one ( ) . id submissions += Submission . query . filter ( ( Submission . downloaded == False ) , ( Submission . source_id == id ) ) . all ( ) if ( submissions == [ ] ) : flash ( 'No unread submissions in collections selected!' , 'error' ) return redirect ( url_for ( 'index' ) ) return download ( 'unread' , submissions )
download all unread submissions from all selected sources .