#11315 closed (wontfix)
add coercion to URLconf
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | HTTP handling | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I'm thinking of a coercion feature similar to TypedChoiceField. The dict could contain the coercions. So if I have a route w/ a parameter X, the dictionary could be:
{'coerce': {'x': int}}
Change History (2)
comment:1 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 16 years ago
Seems to me the whole point of routes is to express URL syntax. So far I've written 3 regex's over & over: string, sha1, int. Wouldn't it be nice to declare the type instead of the regex? No regex to repeat and coercion. Thx for considering it.
Note:
See TracTickets
for help on using tickets.
I don't see the necessity.
Coerce it in your view, or if it's a common case, use a decorator to do the coercion (you can even use this decorator directly in the url conf).