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

created post @id's refer to API_URI, but feed view searches for posts on SERVER_URI #89

Open
npdoty opened this issue Dec 15, 2017 · 2 comments

Comments

@npdoty
Copy link
Contributor

npdoty commented Dec 15, 2017

Created posts have an @id like: "@id" : "http://api.smilodon.localhost:5000/test/posts/0", but the viewPost route queries for a post with @id at the request's url_root, which isn't typically the same. So, when I try to load a particular post in the web browser, the server throws an error like:

16:50:01 web.1   |    File "/Users/nick/code/mastodon/smilodon/app/views.py", line 118, in viewPost
16:50:01 web.1   |      return render_template('feed.html', posts=p, mongo=mongo)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/env3/lib/python3.5/site-packages/flask/templating.py", line 134, in render_template
16:50:01 web.1   |      context, ctx.app)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/env3/lib/python3.5/site-packages/flask/templating.py", line 116, in _render
16:50:01 web.1   |      rv = template.render(context)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/env3/lib/python3.5/site-packages/jinja2/environment.py", line 1008, in render
16:50:01 web.1   |      return self.environment.handle_exception(exc_info, True)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/env3/lib/python3.5/site-packages/jinja2/environment.py", line 780, in handle_exception
16:50:01 web.1   |      reraise(exc_type, exc_value, tb)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/env3/lib/python3.5/site-packages/jinja2/_compat.py", line 37, in reraise
16:50:01 web.1   |      raise value.with_traceback(tb)
16:50:01 web.1   |    File "/Users/nick/code/mastodon/smilodon/app/templates/feed.html", line 1, in top-level template code
16:50:01 web.1   |      {% extends 'basic.html' %}
16:50:01 web.1   |    File "/Users/nick/code/mastodon/smilodon/app/templates/basic.html", line 37, in top-level template code
16:50:01 web.1   |      <div class="content">{% block content %}{% endblock content %}</div>
16:50:01 web.1   |    File "/Users/nick/code/mastodon/smilodon/app/templates/feed.html", line 4, in block "content"
16:50:01 web.1   |      <p> {%for p in posts%}
16:50:01 web.1   |  TypeError: 'NoneType' object is not iterable

Whether there need to be separate URIs for the API and the server at all is also unclear to me, but probably a separate issue.

@npdoty
Copy link
Contributor Author

npdoty commented Dec 15, 2017

That latter issue I've opened as #90. That might just be me not understanding how you want this system to work, but it could also make this easier to fix if there aren't two separate URI systems in parallel.

@rowanlupton
Copy link
Owner

viewPost is out of date :) i haven't updated any of the templates while i've been doing a bunch of restructuring data stuff (eg adding @-prefixes to ids)

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