How to decide which document is being generated

1 view
Skip to first unread message

Adalbert Prokop

unread,
Sep 17, 2006, 4:02:08 AM9/17/06
to fire...@googlegroups.com
Hello!

Is there any possibility to decide inside the python code of the page
template which document is beeing generated?

What I want is the following:
I want to generate a calendar in the top corner of my blogpage. The
calendar on the index page should be the calendar for the actual month
(or better: the month at which the index page was generated).
The calendar in each of the archive pages should refer the month of the
archive page. Here I assume that I'm generating monthly archives.

I've found the shared.archives object, which contains all entries of all
archives. That's fine enough for extracting the entries' metadata. But
can I get the information which archive page or which category page is
beeing generated?

bye,
Adalbert
--
A man's house is his castle. -- Sir Edward Coke

Michael Foord

unread,
Sep 17, 2006, 9:42:11 AM9/17/06
to fire...@googlegroups.com
Hmmm... I'm not sure of a way with the current code, but a calender
would be a very useful feature.

All the best,

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml


> bye,
> Adalbert
>

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.4/449 - Release Date: 15/09/2006

Hans Nowak

unread,
Sep 17, 2006, 10:39:47 AM9/17/06
to fire...@googlegroups.com
Michael Foord wrote:
> Adalbert Prokop wrote:
>> Hello!
>>
>> Is there any possibility to decide inside the python code of the page
>> template which document is beeing generated?

I think the variable 'pagename' should be defined. I haven't tested
this, but it can probably be used like this:

<#
if pagename == 'index.html':
...do this...
else:
...do that...
#>

If your front page has a different name, use options['frontpage_name'].

HTH,

--
Hans Nowak
http://zephyrfalcon.org/

Adalbert Prokop

unread,
Sep 20, 2006, 4:48:35 AM9/20/06
to fire...@googlegroups.com
Hans Nowak schrieb am Sonntag, 17. September 2006 16:39:

> I think the variable 'pagename' should be defined. I haven't tested
> this, but it can probably be used like this:

This might just work. :) And now a last question: is there an object,
which contains only the entries, which will be published on the $pagename?

As far as I understand the philosophy of the shared-object it contains all
entries, not only those which will be included in the HTML document.

Bye,
Adalbert
--
Duckies are fun!

Hans Nowak

unread,
Sep 20, 2006, 9:40:39 AM9/20/06
to fire...@googlegroups.com
Adalbert Prokop wrote:
> Hans Nowak schrieb am Sonntag, 17. September 2006 16:39:
>
>> I think the variable 'pagename' should be defined. I haven't tested
>> this, but it can probably be used like this:
>
> This might just work. :) And now a last question: is there an object,
> which contains only the entries, which will be published on the $pagename?

No, but there might be other ways to get this information. In
weblog.py, for example, the create_front_page() method stores this info
in self._fp_entries. For archive pages, there's the 'archives'
variable, etc. However, it would probably require some Firedrop hacking
to make these data available to the user, in a consistent manner.

Reply all
Reply to author
Forward
0 new messages