Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"djangorestframework",
"djangorestframework-xml",
"simplejson",
"pyminizip",
"pyzipper",
"defusedxml",
"tablib",
Expand Down
12 changes: 6 additions & 6 deletions tools/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
MODULE_NAME = "tools"

DEFAULT_CFG = {
"registers_perms": ["131000"],
"registers_perms": ["131000", "131100"],
"registers_diagnoses_perms": ["131000", "131002", "131001"],
"registers_health_facilities_perms": ["131000", "131004", "131003"],
"registers_locations_perms": ["131000", "131006", "131005"],
"registers_items_perms": ["131000", "131008", "131007"],
"registers_services_perms": ["131000", "131010", "131009"],
"extracts_master_data_perms": [],
"extracts_officer_feedbacks_perms": [],
"extracts_officer_renewals_perms": [],
"extracts_phone_extract_perms": [],
"extracts_upload_claims_perms": [],
"extracts_master_data_perms": ["131101"],
"extracts_officer_feedbacks_perms": ["131106"],
"extracts_officer_renewals_perms": ["131105"],
"extracts_phone_extract_perms": ["131102", "131103"],
"extracts_upload_claims_perms": ["131104"],
"master_data_password": None,
}

Expand Down
11 changes: 3 additions & 8 deletions tools/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
from dataclasses import dataclass
import simplejson as json
import tempfile
import pyminizip
import zipfile
import sqlite3
import os
Expand Down Expand Up @@ -990,13 +989,9 @@ def create_master_data_export(user):
# We close it directly since the only thing we want is to have a temporary file that will not be deleted
zip_file.close()

pyminizip.compress(
master_data_file_path,
"",
zip_file.name,
ToolsConfig.get_master_data_password(),
5,
)
with zipfile.ZipFile(zip_file.name, 'w', zipfile.ZIP_DEFLATED) as zf:
zf.setpassword(bytes(ToolsConfig.get_master_data_password(), 'utf-8'))
zf.write(master_data_file_path, os.path.basename(master_data_file_path))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to add a unit test to cover this.


return zip_file

Expand Down
Loading