[ home | blog home | recent activity ]
I just added locking to Pyblosxom to allow separate Pyblosxom requests to synchronize on centralized data. In my case, the data is a file of how many views each of my blog entries has gotten. It seems to be pretty functional. It's something I had coded in my viewcounts plugin, but I've moved the code (and added to it) into the tools module so we can all use the same base.
An example of usage is this:
from Pyblosxom import tools
LOCKNAME = "viewcounts.dat"
...
lockret = tools.get_lock(request, LOCKNAME)
if lockret:
# yay -- we have the lcok
else:
# foo -- we don't have the lock
...
if tools.has_lock(request, LOCKNAME)
# yay -- we have the lock
else:
# foo -- we don't have the lock
...
tools.return_lock(request, LOCKNAME)
The code is in CVS. It'll go into the next version. Also, I added a unittest module to the code base.
Comments:
Post a new comment:
Three things:
If you can't for some reason post a comment, send me an email: willg at bluesock dot org.
pyblosxom::1.5-dev git-master
Copyright 1996 to 2012, Will Guaraldi Kahn-Greene, under the Creative Commons BY-SA 3.0 license

Will's Blog by William Kahn-Greene is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.