""" Allow sections to change the title of the page. If the directory contains a file called '.title', the first line of this file is used as the page's title. Copyright (C) 2004 Ross Burton """ __author__ = "Ross Burton " __version__ = "0.1" def cb_prepare(args): """ This method gets called in the prepareChain. It gets passed the Request object as the first member of the args tuple. """ request = args["request"] data = request.getData() config = request.getConfiguration() # If we have no entries, we want to keep it that way so the 404 message # title is correct. entry_list = data.get("entry_list", []) if len(entry_list) <= 0: return try: f = open(config["datadir"] + '/' + data['pi_bl'] + "/.title") title = f.readline() config['blog_title'] = title.strip() except Exception, e: return