pallets-eco / pallets-eco/flask-debugtoolbar

UUID support in URLs

Open
#112 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
978
Forks
151
PR merge metrics
No merged PRs in 30d

Description

Thanks for the good extension that helps a lot!

I have problems using it with Flask-UUID extension and URLs that have UUIDs inside. Is it possible to fix this? Providing stack trace below:

File "..prog_path/e_venv/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response)
File "..prog_path/e_venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "..prog_path/e_venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "..prog_path/e_venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "..prog_path/e_venv/lib/python2.7/site-packages/flask/app.py", line 1615, in full_dispatch_request
return self.finalize_request(rv)
File "..prog_path/e_venv/lib/python2.7/site-packages/flask/app.py", line 1632, in finalize_request
response = self.process_response(response)
File "..prog_path/e_venv/lib/python2.7/site-packages/flask/app.py", line 1856, in process_response
response = handler(response)
File "..prog_path/e_venv/lib/python2.7/site-packages/flask_debugtoolbar/__init__.py", line 223, in process_response
toolbar_html = toolbar.render_toolbar()
File "..prog_path/e_venv/lib/python2.7/site-packages/flask_debugtoolbar/toolbar.py", line 46, in render_toolbar
return template.render(**context)
File "..prog_path/e_venv/lib/python2.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "..prog_path/e_venv/lib/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "..prog_path/e_venv/lib/python2.7/site-packages/flask_debugtoolbar/templates/base.html", line 50, in top-level template code
{{ panel.content()|safe }}
File "..prog_path/e_venv/lib/python2.7/site-packages/flask_debugtoolbar/panels/sqlalchemy.py", line 122, in content
'signed_query': dump_query(query.statement, query.parameters),
File "..prog_path/e_venv/lib/python2.7/site-packages/flask_debugtoolbar/panels/sqlalchemy.py", line 34, in dump_query
return query_signer().dumps([statement, params])
File "..prog_path/e_venv/lib/python2.7/site-packages/itsdangerous.py", line 565, in dumps
payload = want_bytes(self.dump_payload(obj))
File "..prog_path/e_venv/lib/python2.7/site-packages/itsdangerous.py", line 847, in dump_payload
json = super(URLSafeSerializerMixin, self).dump_payload(obj)
File "..prog_path/e_venv/lib/python2.7/site-packages/itsdangerous.py", line 550, in dump_payload
return want_bytes(self.serializer.dumps(obj))
File "..prog_path/e_venv/lib/python2.7/site-packages/itsdangerous.py", line 51, in dumps
return json.dumps(obj, separators=(',', ':'))
File "/usr/lib64/python2.7/json/__init__.py", line 251, in dumps
sort_keys=sort_keys, **kw).encode(obj)
File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe8 in position 0: invalid continuation byte

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at flask_debugtoolbar/panels/sqlalchemy.py, especially dump_query and query_signer(), using the provided UnicodeDecodeError as the first failure to reproduce. Look for existing tests covering SQLAlchemy panel rendering and add coverage for the UUID-related case; done means the toolbar renders without this encoding error.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python, sqlalchemy
Domain
backend, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.