def from_queue(self, queue): filename = wgo_queue.message_path(queue, self["message-id"]) if os.path.exists(filename): os.remove(filename) wgo_queue.generate_blotter(queue) pass return (0)
def to_queue(self, queue): filename = wgo_queue.message_path(queue, self["message-id"]) fp = open(filename, "w") print >>fp, self.msg fp.close() os.chmod(filename, config.news_permission) wgo_queue.generate_blotter(queue) return (0)
def main(queue): wgo_news.header() if queue in [wgo_news.config.pending_queue, wgo_news.config.current_queue, wgo_news.config.archive_queue]: dirpath = wgo.config.spool_path + queue names = map(lambda t: dirpath + "/" + t, os.listdir(dirpath)) names.sort(lambda a, b: cmp(os.stat(a).st_mtime, os.stat(b).st_mtime)) news = map(lambda f: wgo_news.news(f, False), names) news = filter(lambda n: n.valid, news) print xhtml.include('%s%s_header.html' % (wgo_news.config.news_path, queue)) # If this is the pending queue, then create one initialised news article for display. if queue == wgo_news.config.pending_queue: n = wgo_news.news() n["Subject"] = "NEW NEWS" html_index_page(queue, n) pass map(lambda n: html_index_page(queue, n), news) control_panel(queue) print xhtml.include('%s/%s_footer.html' % (wgo_news.config.news_path, queue)) if 0: print xhtml.hyperlink("XML", { "class" : "faux-button", "style" : "background: #ff6600 none; color: white; font-weight: bold; padding: 0 .5em 0 .5em; font-size: medium;", "href" : wgo_news.config.news_dir + queue + "/news.rdf"}) pass print xhtml.include(wgo_queue.generate_blotter(queue)) else: print wgo.error("Malformed Request") pass wgo_news.footer() return (0)
pass pass elif action == "reject": status = "Reject unimplemented" pass else: status = "Bad action: " + form["action"].value pass if status == 0: print xhtml.table.cell("Successful", {"id" : "success"}) else: print xhtml.table.cell(status, {"id" : "failure"}) pass print xhtml.table.row.fini() pass pass print xhtml.table.fini() wgo_queue.generate_blotter(wgo_news.config.archive_queue) wgo_queue.generate_blotter(wgo_news.config.current_queue) wgo_queue.generate_blotter(wgo_news.config.pending_queue) print xhtml.para(xhtml.hyperlink("Continue", { "href" : "news-index.cgi?%s" % (queue)})) wgo_news.footer() sys.exit(1)