def dir_feed(self, dir): xmldoc, dfeed = feed.atom.new_xmldoc_feed() dfeed.title = settings.blog_name + " " + dir dfeed.id = settings.blog_url + '/' + dir # << url for feed dfeed.updated = self.atom_date(dir) links = feed.atom.Link(settings.blog_url) # << url to home. dfeed.links.append(links) selflink = feed.atom.Link(settings.blog_url + '/' + dir + '.atom') selflink.attrs['rel'] = "self" dfeed.links.append(selflink) for a in self.atom_authors(dir): author = feed.atom.Author(a) dfeed.authors.append(author) (eout, eerr) = git.ls(file=dir, name=True) for e in eout: if dir != '': e = dir + '/' + e entry = feed.atom.Entry() (entryc, ecerr) = git.show(e) entry.content = "<![CDATA[\n" + entryc + "\n]]>" entry.title = entryc.splitlines()[0] entry.id = settings.blog_url + '/' + e entry.updated = self.atom_date(e.lstrip('/')) dfeed.entries.append(entry) return str(xmldoc)
def GET(self, file): file = file.rstrip('/') (out, ret) = git.type(file) if ret == 128: web.webapi.notfound() elif out == 'blob': (fout, fret) = git.show(file) (templ, dict) = get_dict(fout) templ = tenv.get_template(templ) print templ.render(dict) elif out == 'tree': print dirify(file, git.ls(file)[0]) else: web.webapi.notfound()
def GET(self): print dirify('/', git.ls()[0])