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

Properly handle requests for empty data/station lists #26

Open
jameshiebert opened this issue Jan 14, 2021 · 0 comments
Open

Properly handle requests for empty data/station lists #26

jameshiebert opened this issue Jan 14, 2021 · 0 comments

Comments

@jameshiebert
Copy link
Contributor

Issue #8 handled the potential for empty station lists being requested by the PCDS portal. However, I believe that the calling code can still fail.

        responders = chain(get_all_metadata_index_responders(self.session, stns, climo),
                           get_pcds_responders(self.dsn, stns, ext, get_clip_dates(environ), environ)
                           )

Assume that chain() gets two empty iterators. If it does this call to ziperator() will have no responders. If that's the case, there's some logic in this loop that assumes that the loop will be called at least once. If it's not called, the response will end up writing (I believe) "PKPK" (the second "PK" being the problem and a result of the incorrect logic) which is not a valid zip file.

A preferable behaviour would be to return a 404 response somewhere in __call__() with a helpful message about what parameters were received and about how there are no stations that meet the given criteria.

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

1 participant