Skip to content

Commit

Permalink
fix failing import due to source_exists being removed
Browse files Browse the repository at this point in the history
  • Loading branch information
redshiftzero committed May 29, 2019
1 parent 2340a03 commit b2e1286
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions securedrop_client/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,3 +435,11 @@ def rename_file(data_dir: str, filename: str, new_filename: str) -> None:
os.path.join(data_dir, new_filename))
except OSError as e:
logger.debug('File could not be renamed: {}'.format(e))


def source_exists(session: Session, source_uuid: str) -> bool:
try:
session.query(Source).filter_by(uuid=source_uuid).one()
return True
except NoResultFound:
return False

0 comments on commit b2e1286

Please sign in to comment.