Commit 04fe515d authored by Christophe Benz's avatar Christophe Benz

Fetch doc URL taking into account doc_url_by_ref

parent 51f0ab0d
...@@ -5,7 +5,7 @@ ezodf==0.3.2 ...@@ -5,7 +5,7 @@ ezodf==0.3.2
Flask==1.0.2 Flask==1.0.2
Flask-Matomo==1.2.0 Flask-Matomo==1.2.0
lxml==4.2.5 lxml==4.2.5
opendataschema==0.4.0 opendataschema==0.4.1
python-dotenv==0.10.1 python-dotenv==0.10.1
requests==2.22.0 requests==2.22.0
toml==0.10.0 toml==0.10.0
......
...@@ -64,7 +64,7 @@ setup( ...@@ -64,7 +64,7 @@ setup(
'tabulator', 'tabulator',
'opendataschema >= 0.4.0, < 0.5', 'opendataschema >= 0.4.1, < 0.5',
'validata_core >= 0.3.0, < 0.4', 'validata_core >= 0.3.0, < 0.4',
], ],
......
...@@ -75,9 +75,8 @@ class SchemaInstance: ...@@ -75,9 +75,8 @@ class SchemaInstance:
abort(400, "Schéma '{}' non trouvé dans le catalogue de la section '{}'".format(self.name, self.section_name)) abort(400, "Schéma '{}' non trouvé dans le catalogue de la section '{}'".format(self.name, self.section_name))
if isinstance(schema_reference, GitSchemaReference): if isinstance(schema_reference, GitSchemaReference):
latest_tag = schema_reference.get_latest_tag()
if self.ref is None: if self.ref is None:
schema_ref = latest_tag or schema_reference.get_default_branch() schema_ref = schema_reference.get_latest_tag() or schema_reference.get_default_branch()
abort(redirect(compute_validation_form_url({ abort(redirect(compute_validation_form_url({
'schema_name': self.schema_and_section_name, 'schema_name': self.schema_and_section_name,
'schema_ref': schema_ref.name 'schema_ref': schema_ref.name
...@@ -86,9 +85,8 @@ class SchemaInstance: ...@@ -86,9 +85,8 @@ class SchemaInstance:
tag_names = [tag.name for tag in self.tags] tag_names = [tag.name for tag in self.tags]
self.branches = [branch for branch in schema_reference.iter_branches() self.branches = [branch for branch in schema_reference.iter_branches()
if branch.name not in tag_names] if branch.name not in tag_names]
self.doc_url = schema_reference.doc_url \ self.doc_url = schema_reference.get_doc_url(ref=self.ref) or \
if self.ref == latest_tag.name \ schema_reference.get_project_url(ref=self.ref)
else schema_reference.get_project_url(self.ref)
self.url = schema_reference.get_schema_url(ref=self.ref) self.url = schema_reference.get_schema_url(ref=self.ref)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment