Code

Opened 5 years ago

Closed 5 years ago

Last modified 5 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:

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}}

Attachments (0)

Change History (2)

comment:1 Changed 5 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 5 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.