Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#11315 closed (wontfix)

add coercion to URLconf

Reported by: klrfin@… 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


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 Chris Beaven, 15 years ago

Resolution: wontfix
Status: newclosed

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).

comment:2 by notcourage, 15 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.
Back to Top