Opened 6 years ago

Closed 5 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 Stephen Kelly 6 years ago.
Fixes bug
15092.patch (2.2 KB) - added by Aymeric Augustin 5 years ago.
15092-2.patch (2.6 KB) - added by Claude Paroz 5 years ago.
Adding 2 more tests

Download all attachments as: .zip

Change History (13)

comment:1 Changed 6 years ago by anonymous

Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to anonymous
Patch needs improvement: unset
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:2 Changed 6 years ago by anonymous

Owner: changed from anonymous to gennad
Status: assignednew

Changed 6 years ago by Stephen Kelly

Attachment: fix_now.patch added

Fixes bug

comment:3 Changed 6 years ago by anonymous

Owner: changed from gennad to nobody

comment:4 Changed 6 years ago by anonymous

Has patch: set

comment:5 Changed 5 years ago by Julien Phalip

Patch needs improvement: set
Severity: Normal
Type: 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 5 years ago by Julien Phalip

Type: UncategorizedBug

comment:7 Changed 5 years ago by Aymeric Augustin

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 5 years ago by Aymeric Augustin

Attachment: 15092.patch added

Changed 5 years ago by Claude Paroz

Attachment: 15092-2.patch added

Adding 2 more tests

comment:8 Changed 5 years ago by Claude Paroz

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

comment:9 Changed 5 years ago by Ramiro Morales

Triage Stage: AcceptedReady for checkin

comment:10 Changed 5 years ago by Julien Phalip

Resolution: fixed
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top