File tree Expand file tree Collapse file tree 4 files changed +7
-23
lines changed Expand file tree Collapse file tree 4 files changed +7
-23
lines changed Original file line number Diff line number Diff line change 55# Third party imports
66import flask
77import werkzeug
8+ from opengeodeweb_microservice .schemas import get_schemas_dict
89
910# Local application imports
1011from opengeodeweb_back import geode_functions , utils_functions
2021 name = blueprint_models .routes .name ,
2122)
2223
23- schemas_dict = utils_functions .get_schemas_dict (
24- os .path .join (os .path .dirname (__file__ ), "schemas" )
25- )
24+ schemas_dict = get_schemas_dict (os .path .join (os .path .dirname (__file__ ), "schemas" ))
2625
2726
2827@routes .route (
Original file line number Diff line number Diff line change 44# Third party imports
55import flask
66import opengeode
7+ from opengeodeweb_microservice .schemas import get_schemas_dict
78
89# Local application imports
910from opengeodeweb_back import geode_functions , utils_functions
1011from . import schemas
1112
1213routes = flask .Blueprint ("create" , __name__ , url_prefix = "/create" )
13- schemas_dict = utils_functions .get_schemas_dict (
14- os .path .join (os .path .dirname (__file__ ), "schemas" )
15- )
14+ schemas_dict = get_schemas_dict (os .path .join (os .path .dirname (__file__ ), "schemas" ))
1615
1716
1817@routes .route (
Original file line number Diff line number Diff line change 11import os
22import xml .etree .ElementTree as ET
33import flask
4+ from opengeodeweb_microservice .schemas import get_schemas_dict
45
56from opengeodeweb_back import geode_functions , utils_functions
67from . import schemas
78
89routes = flask .Blueprint ("models" , __name__ , url_prefix = "/models" )
9- schemas_dict = utils_functions .get_schemas_dict (
10- os .path .join (os .path .dirname (__file__ ), "schemas" )
11- )
10+ schemas_dict = get_schemas_dict (os .path .join (os .path .dirname (__file__ ), "schemas" ))
1211
1312
1413@routes .route (
Original file line number Diff line number Diff line change 11# Standard library imports
22import os
3- import glob
4- import json
53import threading
64import time
75import zipfile
1816
1917# Local application imports
2018from . import geode_functions
19+ from opengeodeweb_microservice .schemas import SchemaDict
2120from opengeodeweb_microservice .database .data import Data
2221from opengeodeweb_microservice .database .connection import get_session
2322
24- type SchemaDict = dict [str , str ]
25-
26-
27- def get_schemas_dict (path : str ) -> dict [str , SchemaDict ]:
28- schemas_dict : dict [str , SchemaDict ] = {}
29- for json_file in glob .glob (os .path .join (path , "*.json" )):
30- filename = os .path .basename (json_file )
31- with open (os .path .join (path , json_file ), "r" ) as file :
32- file_content = json .load (file )
33- schemas_dict [os .path .splitext (filename )[0 ]] = file_content
34- return schemas_dict
35-
3623
3724def increment_request_counter (current_app : flask .Flask ) -> None :
3825 if "REQUEST_COUNTER" in current_app .config :
You can’t perform that action at this time.
0 commit comments