Re: setting template variables from plugins/ unkludging code/

"William Cybriwsky" <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <[email protected]>
oh, I've been talking with will and have actually developed the plugin to
the point where it is
a) a proper plugin
b) gets the uname/pass from config.py
c) provides the last 'tweet', its date, and its time as vars.
d) caches for 60 seconds

but my site just went down around an hour ago. thanks for the
help+enthusiasm, this would be my first public code (ever).

On 7/7/07, Ryan Barrett <pyblosxom-6sb6M7qyT/[email protected]> wrote:
>
> cool! it'd be great to have a twitter plugin for pyblosxom.
>
> On Fri, 6 Jul 2007, William Cybriwsky wrote:
>
> > Hi, I'm a new user of pyblosxom, and I wanted to know how to set
> template
> > variables from a plugin. I currently have the chunk of python code:
>
> if you want the variables to be available in existing templates, you can
> set
> them on the request data. for example:
>
>    def cb_prepare(args):
>      data = args['request'].getData()
>      data['twitterstatus'] = ...
>
> if you're rendering an entry yourself, you can set it directly on the
> entry.
> for example:
>
>    entry = args['entry']  # or entry = FileEntry(request) or ...
>    entry['twitterstatus'] = ...
>
> see http://pyblosxom.sourceforge.net/1.3.1/api/ .
>
>
> > P.S. : if I wanted to write some simple cache code, how would I just do
> a
> > check for a file age of 60 seconds?
>
> if i understand right, you only want to check your twitter status every 60
> seconds, so on each request, you want to check if tmptwit.xml is over 60
> seconds old? try os.path.getmtime():
>
> http://docs.python.org/lib/module-os.path.html#l2h-2168
>
> -Ryan
>
> --
> http://snarfed.org/
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Pyblosxom-devel mailing list
Pyblosxom-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/pyblosxom-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.