Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComplexOutput data as reference always generates a file named "input.csv", should be "output". #674

Open
1 of 5 tasks
ashleysommer opened this issue Apr 19, 2023 · 1 comment

Comments

@ashleysommer
Copy link

ashleysommer commented Apr 19, 2023

Description

When returning a ComplexOutput as Reference (output as_reference is True), the filename generated by the server (and used in the built URL) is always "input", eg "input.csv" for a "txt/csv" output, or "input.xml" for an "application/xml" output. This is misleading to users as this is actually the Output file.

After some digging through the sourcecode, I found where that name is set:

pywps/pywps/inout/basic.py

Lines 271 to 276 in d0bb978

def _build_file_name(self, href=''):
"""Return a file name for the local system."""
url_path = urlparse(href).path or ''
file_name = os.path.basename(url_path).strip() or 'input'
(prefix, suffix) = os.path.splitext(file_name)
suffix = suffix or self.extension

It appears there is no way to set this name on the ComlexOutput object, or on the FileStorage object or on the DataHandler object.

Environment

  • operating system: Ubuntu 22.04
  • Python version: 3.8
  • PyWPS version: 4.5.2
  • source/distribution
  • git clone
  • Debian
  • PyPI
  • zip/tar.gz
  • other (please specify):
@gschwind
Copy link
Collaborator

gschwind commented Oct 9, 2023

Hello,

You can change the output name by storing output data into a file.

https://github.com/geopython/pywps/blob/6293f3d5f69470b252863a838160f6959c83e5cf/pywps/inout/storage/file.py#L29C1-L35C31

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants