Opened 13 years ago

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

Download all attachments as: .zip

Change History (13)

comment:1 by anonymous, 13 years ago

Owner: changed from nobody to anonymous
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:2 by anonymous, 13 years ago

Owner: changed from anonymous to gennad
Status: assignednew

by Stephen Kelly, 13 years ago

Attachment: fix_now.patch added

Fixes bug

comment:3 by anonymous, 13 years ago

Owner: changed from gennad to nobody

comment:4 by anonymous, 13 years ago

Has patch: set

comment:5 by Julien Phalip, 13 years ago

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 by Julien Phalip, 13 years ago

Type: UncategorizedBug

comment:7 by Aymeric Augustin, 12 years ago

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.

by Aymeric Augustin, 12 years ago

Attachment: 15092.patch added

by Claude Paroz, 12 years ago

Attachment: 15092-2.patch added

Adding 2 more tests

comment:8 by Claude Paroz, 12 years ago

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

comment:9 by Ramiro Morales, 12 years ago

Triage Stage: AcceptedReady for checkin

comment:10 by Julien Phalip, 12 years ago

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