Code

Opened 3 years ago

Closed 2 years ago

#15092 closed Bug (fixed)

Built-in template tags "now" don't accept simple quote

Reported by: ninja_otoko Owned by: nobody
Component: Template system Version: 1.2
Severity: Normal Keywords: template tags,now
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Using templatetag 'now' with argument betwen simple quote

 {% now 'Y' %} 


Raise an error:

'now' statement takes one argument

Attachments (3)

fix_now.patch (3.0 KB) - added by steveire 3 years ago.
Fixes bug
15092.patch (2.2 KB) - added by aaugustin 2 years ago.
15092-2.patch (2.6 KB) - added by claudep 2 years ago.
Adding 2 more tests

Download all attachments as: .zip

Change History (13)

comment:1 Changed 3 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to anonymous
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by anonymous

  • Owner changed from anonymous to gennad
  • Status changed from assigned to new

Changed 3 years ago by steveire

Fixes bug

comment:3 Changed 3 years ago by anonymous

  • Owner changed from gennad to nobody

comment:4 Changed 3 years ago by anonymous

  • Has patch set

comment:5 Changed 3 years ago by julien

  • Patch needs improvement set
  • Severity set to Normal
  • Type set to Uncategorized

Your patch for {% now %} looks good however I don't understand why you're adding a test for {% ifequal %}. If you've got a good reason to add that test, then please describe it in a new ticket, and also resubmit a new patch for this ticket solely addressing the {% now %} bug.

comment:6 Changed 3 years ago by julien

  • Type changed from Uncategorized to Bug

comment:7 Changed 2 years ago by aaugustin

  • Easy pickings unset
  • Patch needs improvement unset
  • UI/UX unset

I'm attaching an updated patch. It breaks one test: 'now02', but I'm not convinced by that test at all, nor by 'now03' and 'now04' that are commented out since they were introduced, at the merge of magic-removal.

I'm suggest to remove these tests and normalize the behavior of {% now ... %} as shown in the attached patch.

Changed 2 years ago by aaugustin

Changed 2 years ago by claudep

Adding 2 more tests

comment:8 Changed 2 years ago by claudep

Just a proposal with two more tests. Apart from that, I'm considering this as RFC.

comment:9 Changed 2 years ago by ramiro

  • Triage Stage changed from Accepted to Ready for checkin

comment:10 Changed 2 years ago by julien

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

In [17391]:

Fixed #15092 -- Made {% now %} work with single-quoted string arguments. Thanks to ninja_otoko for the report and to steveire, Aymeric Augustin and Claude Paroz for the patch.

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.