Error on archive with same name already present
This commit is contained in:
parent
0f30573180
commit
02df31759f
@ -10,6 +10,9 @@ import zipfile
|
|||||||
import psycopg2
|
import psycopg2
|
||||||
|
|
||||||
|
|
||||||
|
class ZipFileExistsError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
def get_connection():
|
def get_connection():
|
||||||
return psycopg2.connect(
|
return psycopg2.connect(
|
||||||
host=os.environ['PGHOST'],
|
host=os.environ['PGHOST'],
|
||||||
@ -82,6 +85,9 @@ edit_history_query = read_sql('./export_edit_history.sql')
|
|||||||
|
|
||||||
|
|
||||||
def make_data_extract(current_time, connection, zip_file_path):
|
def make_data_extract(current_time, connection, zip_file_path):
|
||||||
|
if zip_file_path.exists():
|
||||||
|
raise ZipFileExistsError('Archive file under specified name already exists')
|
||||||
|
|
||||||
zip_file_path.parent.mkdir(parents=True, exist_ok=True)
|
zip_file_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user