template last modification time

3 lượt xem
Chuyển tới thư đầu tiên chưa đọc

Manlio Perillo

chưa đọc,
11:09:00 2 thg 10, 20072/10/07
đến mako-d...@googlegroups.com
Hi.

Is it possible to have access to the last modification time of a template?

I need it to properly set the Last-Modified header (when only the
template has been modified, and not the data source).

The Template object has a _last_modified attribute that works as I want,
but it is private.

Thanks Manlio Perillo

Michael Bayer

chưa đọc,
10:23:40 3 thg 10, 20073/10/07
đến mako-d...@googlegroups.com
certainly you should use _last_modified for now. we can look into
making those variables non-underscored in the next release.

Jose Galvez

chưa đọc,
10:51:18 3 thg 10, 20073/10/07
đến mako-d...@googlegroups.com
I tried ${_last_modified } and ${self._last_modified } neither give me
the expected date. How do you _last_modified?
Jose

Manlio Perillo

chưa đọc,
11:01:45 3 thg 10, 20073/10/07
đến mako-d...@googlegroups.com
Michael Bayer ha scritto:

> certainly you should use _last_modified for now. we can look into
> making those variables non-underscored in the next release.
>

Thanks.

> On Oct 2, 2007, at 11:09 AM, Manlio Perillo wrote:
>
>> Hi.
>>
>> Is it possible to have access to the last modification time of a
>> template?
>>
>> I need it to properly set the Last-Modified header (when only the
>> template has been modified, and not the data source).
>>
>> The Template object has a _last_modified attribute that works as I
>> want,

A precisation: the attribute is "_modified_time" and it is defined in
the "module" attribute of the Template object (and it seems that it is
always defined, even for string based templates).


Manlio Perillo

Michael Bayer

chưa đọc,
11:06:11 3 thg 10, 20073/10/07
đến mako-d...@googlegroups.com
it wont work from inside the template, since _last_modified will
replace itself with a contextual variable. in the template you can
get to it as self.module._last_modified (its also a one liner to add
self.last_modified to namespace....).

Jose Galvez

chưa đọc,
11:29:52 3 thg 10, 20073/10/07
đến mako-d...@googlegroups.com
Cool thanks
Jose
Trả lời tất cả
Trả lời tác giả
Chuyển tiếp
0 tin nhắn mới