Re: discordia plug in
Wari Wahab <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <[email protected]> |
Lee Joramo wrote:
> Okay, I got my "Hello World" plug in working. In playing with this, I
> found that the plug ins can be far simpler than I originally thought.
Yeah more or less :) Some plugins can be complicated. But for some
performance, you might want to follow these tips.
1. Let the plugin execution be 'delayed'.
2. If the process is heavy, store some state value in a file if possible.
> So from there I have created a plugin to provide the Discordia date.
> Pretty useless, but that is the point.
You know, this is actually a cool plugin, I like it. I've never heard of
a Discordia date before :)
BTW, following the tip from above, you could do delayed execution with
this pythonic way:
---------
class Discordia:
def __str__(self):
return getDiscordia()
def getDiscordia(self):
# Do your processing here
return day
load(py, entryList):
py['discordia'] = Discordia()
------------------
With this template, you won't get this plugin executed for those RSS
flavours. If you put $discordia at foot.html, the plugin will only be
executed then.
There are other plugins in pyblosxom that could use saving state value,
like pyarchives.py, only to be awake at the first day of the month, else
it lazily reads its state files.
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com