Opened 6 years ago

Closed 6 years ago

Last modified 6 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: UI/UX:


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 Changed 6 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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 Changed 6 years ago by notcourage

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