-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
#102 several fixes for (dead) links in navigating HTML #103
Conversation
@@ -166,3 +166,7 @@ def serve(ctx, debug=False): | |||
# setup_logger(CONFIG['logging']) | |||
APP.run(debug=True, host=api_.config['server']['bind']['host'], | |||
port=api_.config['server']['bind']['port']) | |||
|
|||
|
|||
if __name__ == '__main__': # run locally, for testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? pygeoapi serve
accomplishes this already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main reason for main()
here is for (stepwise) debugging within an IDE like IntelliJ IDEA or WebStorm and probably PyCharm: needed easy entry point.
pygeoapi/api.py
Outdated
@@ -125,6 +125,10 @@ def root(self, headers, args): | |||
] | |||
|
|||
if format_ == 'html': # render | |||
for link in fcm['links']: | |||
if 'json' in link['type']: | |||
link['href'] += '?f=json' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this better written as link['href'] = ''.join((link['href'], '?f=json'))
? I'm not sure what the current verdict is around 'adding' strings in Python.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I read both +
and join
can be used, with join
being marginally faster with many strings to concatenate. For readablity +
is preferred.
Checks failed since one test need change in |
Also needed to fix the breadcrumbs relative URL paths: in cases where the page URL ends with Now all HTML links are based on Flask/Werkzeug Also needed to rewrite the |
Appears this issue was not really due to #92.
At least no dead links anymore and JSON content when accessed in browser.
Question remains that on single Item the
Next
andPrev
links should really walk through Collection but I suggest to do that in other issue, as this is quite tricky to achieve (as one does not know the prev/next id's in isolation of single Item).Hold on..one failing test now...