예제 #1
0
    def GET(self):
        i = web.input(key=None)
        changes = db.get_recent_changes(key=i.key, limit=50)
        site =  web.ctx.home

        def diff(key, revision):
            b = db.get_version(key, revision)

            rev_a = revision -1
            if rev_a is 0:
                a = web.ctx.site.new(key, {})
                a.revision = 0
            else: 
                a = db.get_version(key, revision=rev_a)
                
            diff = render.diff(a, b)

            #@@ dirty hack to extract diff table from diff
            import re
            rx = re.compile(r"^.*(<table.*<\/table>).*$", re.S)
            return rx.sub(r'\1', str(diff))
            
        web.header('Content-Type', 'application/rss+xml')

        for c in changes:
            c.diff = diff(c.key, c.revision)
            c.created = self._format_date(c.created)
        print render.feed(site, changes)
예제 #2
0
    def GET(self):
        i = web.input(key=None)
        changes = db.get_recent_changes(key=i.key, limit=50)
        site =  web.ctx.home

        def diff(key, revision):
            b = db.get_version(key, revision)

            rev_a = revision -1
            if rev_a is 0:
                a = web.ctx.site.new(key, {})
                a.revision = 0
            else: 
                a = db.get_version(key, revision=rev_a)
                
            diff = render.diff(a, b)

            #@@ dirty hack to extract diff table from diff
            import re
            rx = re.compile(r"^.*(<table.*<\/table>).*$", re.S)
            return rx.sub(r'\1', str(diff))
            
        web.header('Content-Type', 'application/rss+xml')

        for c in changes:
            c.diff = diff(c.key, c.revision)
            c.created = self._format_date(c.created)
        return delegate.RawText(render.feed(site, changes))
예제 #3
0
 def GET(self, path):
     page = web.ctx.site.get(path)
     if not page:
         raise web.seeother(path)
     i = web.input(page=0)
     offset = 20 * safeint(i.page)
     limit = 20
     history = db.get_recent_changes(key=path, limit=limit, offset=offset)
     return render.history(page, history)
예제 #4
0
 def GET(self, path):
     page = web.ctx.site.get(path)
     if not page:
         raise web.seeother(path)
     i = web.input(page=0)
     offset = 20 * safeint(i.page)
     limit = 20
     history = db.get_recent_changes(key=path, limit=limit, offset=offset)
     return render.history(page, history)