benselme / flask-mako

Provides support for Mako Templates in Flask.
40 stars 30 forks source link

TypeError: expected string or buffer #4

Closed acertain closed 12 years ago

acertain commented 12 years ago
Traceback (most recent call last):
  File "/home/zcarterc/.config/python/envs/pyramid/lib/python2.7/site-packages/flask/app.py", line 1701, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/zcarterc/.config/python/envs/pyramid/lib/python2.7/site-packages/flask/app.py", line 1689, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/zcarterc/.config/python/envs/pyramid/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/zcarterc/.config/python/envs/pyramid/lib/python2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/zcarterc/.config/python/envs/pyramid/lib/python2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/zcarterc/.config/python/envs/pyramid/lib/python2.7/site-packages/flask/app.py", line 1344, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/zcarterc/Documents/Code/dndapp/appw.py", line 20, in simplelayout
    return render_template(simplelayouts.get(url))
  File "/home/zcarterc/.config/python/envs/pyramid/lib/python2.7/site-packages/flask_mako.py", line 153, in render_template
    return _render(_lookup(ctx.app).get_template(template_name),
  File "/home/zcarterc/.config/python/envs/pyramid/lib/python2.7/site-packages/mako/lookup.py", line 236, in get_template
    u = re.sub(r'^\/+', '', uri)
  File "/usr/lib64/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or buffer```
AnIrishDuck commented 12 years ago

There's no reason for re.sub to fail unless it's not being passed a string. I'm willing to bet that url not in simplelayouts and you're thus trying to render_template(None)

acertain commented 12 years ago

That is not the case, but it seems to be an issue like that, so I'm closing this.