1. Andriy Kornatskyy
  2. wheezy.web
  3. Issues
Issue #5 resolved

The use of defaultattrdict in routing middleware may lead to unexpected path construction

Andriy Kornatskyy
repo owner created an issue

Problem Statement

If a given call to path_for relies on route_args but they are not actually present since currently executing route doesn't supply such information, defaultattrdict returns an empty string, while a call to path_for may require a non empty value, e.g. id.

Solution

Replace defaultattrdict with attrdict, this way an exception will be generated in case the requested route argument is not available. The user must explicitly update route mapping to set default route args. This should prevent unexpected path construction.

Workaround

If the user code relies on mentioned above behavior, there is a way to "patch" attdict import in routing middleware.

Comments (1)

  1. Log in to comment