Beispiel #1
0
 def get() -> Union[tuple[Resource, int], Response]:
     parser = default.parse_args()
     type_tree = {'typeTree': GetTypeTree.get_type_tree()}
     template = TypeTreeTemplate.type_tree_template()
     if parser['download']:
         return download(type_tree, template, 'type_tree')
     return marshal(type_tree, template), 200
Beispiel #2
0
 def get() -> Union[tuple[Resource, int], Response]:
     parser = default.parse_args()
     node = {"types": GetNodeOverview.get_node_overview()}
     template = NodesOverviewTemplate.node_overview_template()
     if parser['download']:
         return download(node, template, 'types')
     return marshal(node, template), 200
Beispiel #3
0
 def get() -> Union[int, Response, tuple[Any, int]]:
     parser = gis.parse_args()
     output: dict[str, Any] = {
         'type': 'FeatureCollection',
         'features': GetGeometricEntities.get_geometries(parser)
     }
     if parser['count']:
         return jsonify(len(output['features']))
     if parser['download']:
         return download(output, GeometriesTemplate.geometries_template(),
                         'geometries')
     return marshal(output, GeometriesTemplate.geometries_template()), 200
Beispiel #4
0
 def get() -> Union[tuple[Resource, int], Response]:
     parser = language.parse_args()
     lang = parser['lang']
     content = {
         'intro': get_translation('intro_for_frontend', lang),
         'contact': get_translation('contact_for_frontend', lang),
         'siteName': get_translation('site_name_for_frontend', lang),
         'imageSizes': app.config['IMAGE_SIZE'],
         'legalNotice': get_translation('legal_notice_for_frontend', lang)
     }
     template = ContentTemplate.content_template()
     if parser['download']:
         return download(content, template, 'content')
     return marshal(content, template), 200
Beispiel #5
0
 def resolve_entity(
         entity: Entity,
         parser: dict[str, Any]) \
         -> Union[Response, dict[str, Any], tuple[Any, int]]:
     if parser['export'] == 'csv':
         return export_entities_csv(entity, entity.name)
     result = GetEntity.get_format(entity, parser)
     if parser['format'] in app.config['RDF_FORMATS']:
         return Response(
             rdf_output(result, parser),
             mimetype=app.config['RDF_FORMATS'][parser['format']])
     if parser['download']:
         return download(result, GetEntity.get_template(parser), entity.id)
     return marshal(result, GetEntity.get_template(parser)), 200