You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Supplying a dict to the match_param of add_view results in the following error::
File "/Users/simonyarde/development/pyramid/pyramid/pyramid/config/__init__.py", line 1093, in resolveConflicts
L = unique.setdefault(discriminator, [])
TypeError: unhashable type: 'dict'
The discriminator tuple may not contain the match_param dict because dicts are mutable and therefore unhashable::
Pyramid passes it's own tests for match_param because resolveConflicts is not invoked:
test_match_param_from_dict (pyramid.tests.test_config.test_util.Test__make_predicates) ... ok
test_match_param_from_dict_fails (pyramid.tests.test_config.test_util.Test__make_predicates) ... ok
test_match_param_from_string (pyramid.tests.test_config.test_util.Test__make_predicates) ... ok
test_match_param_from_string_fails (pyramid.tests.test_config.test_util.Test__make_predicates) ... ok.
I quickly hacked mine by storing the string repr of match_param in the discriminator, which is ugly but works.
Perhaps it would be better to configure match_param with a tuple::
('foo=bar', 'b=2', 'c=3')
since python doesn't have an immutable dict object suitable for configuration purposes.
There would (probably) be no objection to changing configuration since this feature hasn't worked in 1.2 or 1.3 so there aren't any projects using it?
The text was updated successfully, but these errors were encountered:
Supplying a dict to the
match_param
ofadd_view
results in the following error::TypeError: unhashable type: 'dict'
The
discriminator
tuple may not contain thematch_param
dict because dicts are mutable and therefore unhashable::discriminator
('view', None, '', None, , None, None, None, 'test', None, False, None, None, None, {'test': '1'})
Pyramid passes it's own tests for
match_param
becauseresolveConflicts
is not invoked:test_match_param_from_dict (pyramid.tests.test_config.test_util.Test__make_predicates) ... ok
test_match_param_from_dict_fails (pyramid.tests.test_config.test_util.Test__make_predicates) ... ok
test_match_param_from_string (pyramid.tests.test_config.test_util.Test__make_predicates) ... ok
test_match_param_from_string_fails (pyramid.tests.test_config.test_util.Test__make_predicates) ... ok.
I quickly hacked mine by storing the string repr of
match_param
in thediscriminator
, which is ugly but works.Perhaps it would be better to configure
match_param
with a tuple::since python doesn't have an immutable dict object suitable for configuration purposes.
There would (probably) be no objection to changing configuration since this feature hasn't worked in 1.2 or 1.3 so there aren't any projects using it?
The text was updated successfully, but these errors were encountered: