- @classmethod
- def data_project_from_files(cls, request):
-
- file_dict = {}
- for my_key in request.FILES.keys():
- file_dict[my_key] = request.FILES.getlist(my_key)
-
- log.debug(file_dict)
-
- data_project = OsmParser.importprojectfiles(file_dict)
-
- return data_project
-
- @classmethod
- def data_project_from_example(cls, request):
- osm_id = request.POST.get('example-osm-id', '')
- data_project = OsmParser.importprojectdir(EXAMPLES_FOLDER + osm_id + '/JSON', 'yaml')
- return data_project
-
- @classmethod
- def get_example_list(cls):
- """Returns a list of directories, in each directory there is a project osm"""
-
- path = EXAMPLES_FOLDER
- dirs = [d for d in os.listdir(path) if os.path.isdir(os.path.join(path, d))]
- return {'osm': dirs}
-
- @classmethod
- def get_new_descriptor(cls, descriptor_type, request_id):
-
- json_template = cls.get_descriptor_template(descriptor_type)
-
- return json_template
-
- @classmethod
- def get_descriptor_template(cls, type_descriptor):
- """Returns a descriptor template for a given descriptor type"""
-
- try:
- schema = Util.loadjsonfile(os.path.join(PATH_TO_DESCRIPTORS_TEMPLATES, type_descriptor + DESCRIPTOR_TEMPLATE_SUFFIX))
- return schema
- except Exception as e:
- log.exception(e)
- return False
-
- @classmethod
- def get_clone_descriptor(cls, descriptor, type_descriptor, new_descriptor_id):
- new_descriptor = copy.deepcopy(descriptor)
-
- return new_descriptor
-
- def get_type(self):