Re: Hello World plug-in
Wari Wahab <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <[email protected]> |
Lee Joramo wrote:
> I am looking for a well documented "Hello World" plug in for
> pyblosxom. Over the weekend, I tried to modify several of the current
> plug-ins without success. So how would you create a plug in that would
> replace $HelloWorld in a flavor file with the phrase "Hello, World".
For pyblosxom 0.6 (the next release will have a different way to do
things, check the cvs for more info):
def load(py, entryList):
py["HelloWorld"] = "Hello, World"
> For extra credit, how would you get it to return your name "Hello, YOU
> NAME".
Assuming you call by - http://host.address/pyblosxom?name=Wari%20Wahab
-----------------------
def load(py, entryList):
form = cgi.FieldStorage()
name = (form.has_key('name') and [form['name'].value] or ["World!"])[0]
py["HelloWorld"] = "Hello, %s" % name
-----------------------
If name is defined, Hello, Wari Wahab, else Hello, World!
Pretty much untested, but you get the idea :)
The plugin system in the CVS, plugins must register with the api. Hope
this one works for you :)
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf