__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 """ # http://jamesclarke.info/projects/flickr/ import flickr # -- def verify_installation(request): config = request.getConfiguration() if not config.has_key("flickr_email"): print "missing config properties 'flickr_email'." return 1 # -- def cb_prepare(args): """ This is the callback PyBlosxom will make. @param args A dictionary """ request = args['request'] data = request.getData() config = request.getConfiguration() try: email = config['flickr_email'] except: # BAIL return user = flickr.people_findByEmail(email) photos = flickr.people_getPublicPhotos(user.id, 4, 1) results = "" for item in photos: results = "%s
%s
" % (results, item.getURL('Thumbnail', 'url'), item.getURL('Thumbnail', 'source'), item.title) data["flickrpics"] = str(results) return "%s
" % (results) # -- # -- if __name__ == "__main__": print "No tests here."