mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 20:58:28 +00:00
Not certain if this works, but this should help finding data maybe.
This commit is contained in:
parent
eb7760fa55
commit
edaf6e205e
@ -32,6 +32,10 @@ class FileSystemService(object):
|
||||
def category_path(name: str):
|
||||
return os.path.join(FileSystemService.root_path(), name)
|
||||
|
||||
@staticmethod
|
||||
def library_path(name: str):
|
||||
return os.path.join(FileSystemService.root_path(), FileSystemService.LIBRARY_SPECS, name)
|
||||
|
||||
@staticmethod
|
||||
def category_path_for_spec(spec):
|
||||
if spec.is_master_spec:
|
||||
|
@ -51,17 +51,22 @@ class SpecFileService(FileSystemService):
|
||||
SpecFileService.set_primary_bpmn(workflow_spec, file_name, binary_data)
|
||||
return file
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_data(workflow_spec: WorkflowSpecInfo, file_name: str):
|
||||
file_path = SpecFileService.file_path(workflow_spec, file_name)
|
||||
if not os.path.exists(file_path):
|
||||
# If the file isn't here, it may be in a library
|
||||
for lib in workflow_spec.libraries:
|
||||
lib_path = SpecFileService.library_path(lib)
|
||||
file_path = SpecFileService.file_path(workflow_spec, file_name)
|
||||
if os.path.exists(file_path):
|
||||
break
|
||||
if not os.path.exists(file_path):
|
||||
raise ApiError("unknown_file", f"So file found with name {file_name} in {workflow_spec.display_name}")
|
||||
with open(file_path, 'rb') as f_handle:
|
||||
spec_file_data = f_handle.read()
|
||||
return spec_file_data
|
||||
|
||||
|
||||
@staticmethod
|
||||
def file_path(spec: WorkflowSpecInfo, file_name: str):
|
||||
return os.path.join(SpecFileService.workflow_path(spec), file_name)
|
||||
|
6
crc/services/update_service.py
Normal file
6
crc/services/update_service.py
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
# loop over all the categories in the database
|
||||
# assure we have a directory with the correct name
|
||||
# assure it contains a valid json file called categories.json
|
||||
|
||||
categories = db.
|
Loading…
x
Reference in New Issue
Block a user