Code

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9880 closed (invalid)

Spaces in assignment of values of named parameters for 'url' template function raise 'TypeError'

Reported by: Art Skvira <artem.skvira@…> Owned by: nobody
Component: Uncategorized 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

When '=' sign in statement like this:

{% url vj job_id=job.id %}

is surrounded by spaces, ie.

{% url vj job_id = job.id %}, view raises TypeError:

http://dpaste.com/100225/

Attachments (0)

Change History (3)

comment:1 Changed 5 years ago by ubernostrum

  • Resolution set to invalid
  • Status changed from new to closed

Which is why the documentation shows you to do it without spaces.

comment:2 Changed 5 years ago by Art Skvira <artem.skvira@…>

But why formatting style has to be enforced in such way?

comment:3 Changed 5 years ago by ubernostrum

Because of the way Django's template system works, spaces are taken to be separators between arguments. Remember: things you type into templates are not directly interpreted as Python code, and the template language has its own, different-from-Python, ideas about what is and is not acceptable syntax.

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.