chadwhitacre / mongs

A nice web-based MongoDB data browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError displaying large plaintext field

jaraco opened this issue · comments

When accessing a field 'qsl.json' (@whit537 might guess what that field contains), we're getting this traceback:

Traceback (most recent call last):
  File "/app/.heroku/venv/lib/python2.7/site-packages/aspen/website.py", line 66, in handle_safely
    response = self.handle(request)
  File "/app/.heroku/venv/lib/python2.7/site-packages/aspen/website.py", line 99, in handle
    response = request.resource.respond(request)
  File "/app/.heroku/venv/lib/python2.7/site-packages/aspen/resources/dynamic_resource.py", line 47, in respond
    exec self.pages[1] in context
  File "/app/www/%server/%database/%collection/%filter/%value.json.spt", line 7, in <module>
    request.redirect("%(value)s.txt" % request.path.raw)
AttributeError: 'Request' object has no attribute 'path'

Replacing the URL manually with .txt seems to do the trick.

We're using the latest version of mongs (and whatever version of aspen it bundles). Can you suggest a fix?

@jaraco Ah, sorry. path.raw should work instead of request.path.raw, or request.line.uri.path.raw. Aspen's request object has a verbose API that comprehensively models an HTTP message. Then, aliases inserted into the context for a simplate provide short-cuts to the most commonly-used parts of the API, such as path.