diff --git a/pywps/app/Common.py b/pywps/app/Common.py index bf8b77341..c2ba42c12 100644 --- a/pywps/app/Common.py +++ b/pywps/app/Common.py @@ -63,3 +63,21 @@ def __eq__(self, other): self.role == other.role, self.type == other.type, ]) + + +class MetadataUrl(Metadata): + """Metadata subclass to allow anonymous links generation in documentation. + + Useful to avoid Sphinx "Duplicate explicit target name" warning. + + See https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#anonymous-hyperlinks. + + Meant to use in documentation only, not needed in the xml response, nor being serialized or + deserialized to/from json. So that's why it is not directly in the base class. + """ + + def __init__(self, title, href=None, role=None, type_='simple', + anonymous=False): + super().__init__(title, href=href, role=role, type_=type_) + self.anonymous = anonymous + "Whether to create anonymous link (boolean)." diff --git a/pywps/ext_autodoc.py b/pywps/ext_autodoc.py index 664847505..082b16e29 100644 --- a/pywps/ext_autodoc.py +++ b/pywps/ext_autodoc.py @@ -5,22 +5,7 @@ from sphinx.util import force_decode from docutils.parsers.rst import directives from pywps import Process -from pywps.app.Common import Metadata - - -class MetadataUrl(Metadata): - """Metadata subclass to allow anonymous links generation. - - Useful to avoid Sphinx "Duplicate explicit target name" warning. - - See https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#anonymous-hyperlinks. - """ - - def __init__(self, title, href=None, role=None, type_='simple', - anonymous=False): - super().__init__(title, href=href, role=role, type_=type_) - self.anonymous = anonymous - "Whether to create anonymous link (boolean)." +from pywps.app.Common import Metadata, MetadataUrl class ProcessDocumenter(ClassDocumenter): diff --git a/pywps/tests.py b/pywps/tests.py index c8d3e84e3..36ad18b47 100644 --- a/pywps/tests.py +++ b/pywps/tests.py @@ -11,8 +11,7 @@ from pywps import Process from pywps.inout import LiteralInput, LiteralOutput, ComplexInput, ComplexOutput, BoundingBoxInput, BoundingBoxOutput from pywps.inout import Format -from pywps.app.Common import Metadata -from pywps.ext_autodoc import MetadataUrl +from pywps.app.Common import Metadata, MetadataUrl import re