Replaces xml.etree with lxml.etree
This commit is contained in:
parent
237abcdfed
commit
c3ceda4c2f
39
Pipfile
39
Pipfile
|
@ -9,39 +9,40 @@ pbr = "*"
|
|||
coverage = "*"
|
||||
|
||||
[packages]
|
||||
alembic = "*"
|
||||
connexion = {extras = ["swagger-ui"],version = "*"}
|
||||
swagger-ui-bundle = "*"
|
||||
coverage = "*"
|
||||
docxtpl = "*"
|
||||
flask = "*"
|
||||
flask-admin = "*"
|
||||
flask-bcrypt = "*"
|
||||
flask-cors = "*"
|
||||
flask-mail = "*"
|
||||
flask-marshmallow = "*"
|
||||
flask-migrate = "*"
|
||||
flask-restful = "*"
|
||||
gunicorn = "*"
|
||||
httpretty = "*"
|
||||
ldap3 = "*"
|
||||
marshmallow = "*"
|
||||
marshmallow-enum = "*"
|
||||
marshmallow-sqlalchemy = "*"
|
||||
openpyxl = "*"
|
||||
pyjwt = "*"
|
||||
requests = "*"
|
||||
xlsxwriter = "*"
|
||||
webtest = "*"
|
||||
spiffworkflow = {editable = true,git = "https://github.com/sartography/SpiffWorkflow.git",ref = "STG-26"}
|
||||
alembic = "*"
|
||||
coverage = "*"
|
||||
sphinx = "*"
|
||||
recommonmark = "*"
|
||||
psycopg2-binary = "*"
|
||||
docxtpl = "*"
|
||||
python-dateutil = "*"
|
||||
pandas = "*"
|
||||
xlrd = "*"
|
||||
ldap3 = "*"
|
||||
gunicorn = "*"
|
||||
werkzeug = "*"
|
||||
psycopg2-binary = "*"
|
||||
pyjwt = "*"
|
||||
python-dateutil = "*"
|
||||
recommonmark = "*"
|
||||
requests = "*"
|
||||
sentry-sdk = {extras = ["flask"],version = "==0.14.4"}
|
||||
flask-mail = "*"
|
||||
flask-admin = "*"
|
||||
sphinx = "*"
|
||||
spiffworkflow = {editable = true,git = "https://github.com/sartography/SpiffWorkflow.git",ref = "STG-26"}
|
||||
swagger-ui-bundle = "*"
|
||||
webtest = "*"
|
||||
werkzeug = "*"
|
||||
xlrd = "*"
|
||||
xlsxwriter = "*"
|
||||
lxml = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.7"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "8d6d99bcacef0b12f29f3c402f7980799812f645c576767b5477445a1fc03062"
|
||||
"sha256": "d82c06e080dbdd4c9da4e308d29ebefd9ef41be7a15caa72c6d6f9b7007d8910"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
|
@ -464,7 +464,7 @@
|
|||
"sha256:f95d28193c3863132b1f55c1056036bf580b5a488d908f7d22a04ace8935a3a9",
|
||||
"sha256:fadd2a63a2bfd7fb604508e553d1cf68eca250b2fbdbd81213b5f6f2fbf23529"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
|
||||
"index": "pypi",
|
||||
"version": "==4.5.1"
|
||||
},
|
||||
"mako": {
|
||||
|
@ -918,7 +918,7 @@
|
|||
"spiffworkflow": {
|
||||
"editable": true,
|
||||
"git": "https://github.com/sartography/SpiffWorkflow.git",
|
||||
"ref": "49163a983b7d8b8e564079c79277b21e358a26ac"
|
||||
"ref": "8ab8d98792ac46e0bac5b1b35a59ddfe28aa9760"
|
||||
},
|
||||
"sqlalchemy": {
|
||||
"hashes": [
|
||||
|
|
|
@ -3,7 +3,7 @@ import json
|
|||
import os
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
from xml.etree import ElementTree
|
||||
from lxml import etree
|
||||
|
||||
import flask
|
||||
from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException
|
||||
|
@ -151,7 +151,7 @@ class FileService(object):
|
|||
|
||||
# If this is a BPMN, extract the process id.
|
||||
if file_model.type == FileType.bpmn:
|
||||
bpmn: ElementTree.Element = ElementTree.fromstring(binary_data)
|
||||
bpmn: etree.Element = etree.fromstring(binary_data)
|
||||
file_model.primary_process_id = FileService.get_process_id(bpmn)
|
||||
|
||||
new_file_data_model = FileDataModel(
|
||||
|
@ -165,7 +165,7 @@ class FileService(object):
|
|||
return file_model
|
||||
|
||||
@staticmethod
|
||||
def get_process_id(et_root: ElementTree.Element):
|
||||
def get_process_id(et_root: etree.Element):
|
||||
process_elements = []
|
||||
for child in et_root:
|
||||
if child.tag.endswith('process') and child.attrib.get('isExecutable', False):
|
||||
|
@ -179,7 +179,7 @@ class FileService(object):
|
|||
|
||||
# Look for the element that has the startEvent in it
|
||||
for e in process_elements:
|
||||
this_element: ElementTree.Element = e
|
||||
this_element: etree.Element = e
|
||||
for child_element in list(this_element):
|
||||
if child_element.tag.endswith('startEvent'):
|
||||
return this_element.attrib['id']
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import re
|
||||
import xml.etree.ElementTree as ElementTree
|
||||
from lxml import etree
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
|
||||
|
@ -266,12 +266,12 @@ class WorkflowProcessor(object):
|
|||
|
||||
for file_data in file_data_models:
|
||||
if file_data.file_model.type == FileType.bpmn:
|
||||
bpmn: ElementTree.Element = ElementTree.fromstring(file_data.data)
|
||||
bpmn: etree.Element = etree.fromstring(file_data.data)
|
||||
if file_data.file_model.primary:
|
||||
process_id = FileService.get_process_id(bpmn)
|
||||
parser.add_bpmn_xml(bpmn, filename=file_data.file_model.name)
|
||||
elif file_data.file_model.type == FileType.dmn:
|
||||
dmn: ElementTree.Element = ElementTree.fromstring(file_data.data)
|
||||
dmn: etree.Element = etree.fromstring(file_data.data)
|
||||
parser.add_dmn_xml(dmn, filename=file_data.file_model.name)
|
||||
if process_id is None:
|
||||
raise (ApiError(code="no_primary_bpmn_error",
|
||||
|
|
Loading…
Reference in New Issue