import os import random __author__ = "Erik Smartt " __copyright__ = "Copyright 2003-2005, Erik Smartt" __license__ = """This work is licensed under the Creative Commons Attribution-ShareAlike 2.0 Attribution-ShareAlike 2.0 You are free: * to copy, distribute, display, and perform the work * to make derivative works * to make commercial use of the work Under the following conditions: - Attribution. You must give the original author credit. - Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. * For any reuse or distribution, you must make clear to others the license terms of this work. * Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. http://creativecommons.org/licenses/by-sa/2.0/legalcode """ __doc__ = """ To Do: -fetch relevant tags for the content section we're in. For example, if the user is browsing a 'python' section, look for links tagged with 'python'. -cache the results somewhere so we're not pounding del.icio.us """ # -- def verify_installation(request): # config = request.getConfiguration() return 1 # -- def cb_prepare(args): """ This is the callback PyBlosxom will make. @param args A dictionary """ request = args["request"] data = request.getData() base_path = args["request"].getConfiguration()['datadir'] f = open(os.path.join(base_path, 'siglines')) lines = f.readlines() f.close() # Grab a random line data["sig"] = lines[random.randint(0, (len(lines) - 1))] del lines # -- # -- if __name__ == "__main__": pass