I noticed the bug in Pyramid where a match_param argument to view_config would not allow dicts due to them being unhashable (
https://github.com/Pylons/pyramid/issues/425). This fix is to no longer accept dicts as a parameter.
Would it be an acceptable idea to allow a two dimensional tuple (('param', 'value'), ('paramtwo', 'value2')). It seems inconvenient that to work with the match_param I have to parse strings and format them to the format specification instead of using some kind of mapping.
My use case might be kind of strange, but I still think using string format for meaningful data instead of a mapping is weirder. My use case is to extend the view_config class in the following manner to automate adding a dynamic match_param argument:
from pyramid.view import view_config
class action_config(view_config):
def __call__(self, wrapper):
settings = self.__dict__
# if no name is given use the name of the function to match
# against the 'action' matchdict parameter
name = settings.get('name', wrapper.__name__)
# add custom predicate to view config
try:
settings.setdefault('match_param', {})['action'] = name
except TypeError:
raise Exception('match_param must be a dict')
return view_config.__call__(self, wrapper)
--
Jason