pylodon icon indicating copy to clipboard operation
pylodon copied to clipboard

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

Open npdoty opened this issue 6 years ago • 2 comments

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 avatar Dec 15 '17 01:12 npdoty

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.

npdoty avatar Dec 15 '17 01:12 npdoty

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)

rowanlupton avatar Dec 15 '17 02:12 rowanlupton