Is there a catch-all “predicate mismatch” view?

23 views
Skip to first unread message

Jens Troeger

unread,
Aug 8, 2019, 2:16:51 AM8/8/19
to pylons-discuss
Hello,

During testing we just noticed that existing views whose predicate mismatched when making a request return an error like so:

404 Not Found
The resource could not be found.

predicate mismatch for view ... (request_method = POST)

Is there a way to define a view that matches any and all of such mismatches to avoid returning too much information to the client? At least for production…

Cheers!
Jens

Michael Merickel

unread,
Aug 8, 2019, 11:28:22 AM8/8/19
to Pylons
pyramid.exceptions.PredicateMismatch is a subclass of HTTPNotFound and thus a generic 404 handler (notfound_view_config) will catch it. You can define an exception_view_config specifically for PredicateMismatch if you wish to be more specific but most people would let it fall through to the 404 handler which you apparently are not defining.

--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/78b7b977-8c47-481b-8488-21c223888a26%40googlegroups.com.


--

Michael
Reply all
Reply to author
Forward
0 new messages