示例#1
0
def most_recent_change():
    if 'cache_most_recent' in infogami.config.features:
        v = web.ctx.site._request('/most_recent')
        v.thing = web.ctx.site.get(v.key)
        v.author = v.author and web.ctx.site.get(v.author)
        v.created = client.parse_datetime(v.created)
        return v
    else:
        return get_recent_changes(limit=1)[0]
示例#2
0
def most_recent_change():
    if 'cache_most_recent' in infogami.config.features:
        v = web.ctx.site._request('/most_recent')
        v.thing = web.ctx.site.get(v.key)
        v.author = v.author and web.ctx.site.get(v.author)
        v.created = client.parse_datetime(v.created)
        return v
    else:
        return get_recent_changes(limit=1)[0]
示例#3
0
 def GET(self):
     web.header('Content-Type', 'text/xml')
 
     issues = web.ctx.site.things({'type': '/type/issue', 'published': True, 'sort': '-key', 'limit': 1000})
     articles = web.ctx.site.things({'type': '/type/article', 'last_modified': None, 'sort': '-key', 'limit': 1000}, details=True)
     articles = [a for a in articles if a.key.rsplit('/', 1)[0] in issues]
     for a in articles:
         a.last_modified = client.parse_datetime(a.last_modified.value).strftime('%Y-%m-%dT%H:%M:%SZ')
     
     out = render.sitemap(articles)
     raise web.ok(out)
示例#4
0
def process_post(post):
    post = web.storage(post)
    post.timestamp = parse_datetime(post.timestamp)
    post.author = post.author and web.ctx.site.get(post.author)
    post.url = "/%s-%s" % (post.key, urlsafe(post.title))
    return post