Example #1
0
def overview(request):
    owner = authenticated_userid(request)
    author = Author.get_author(owner)
    if not author:
        loc = request.route_url('login')
        return HTTPFound(location=loc)
    if author.name == 'admin': #TODO
        logs = Log.get_logs()
    else:
        logs = Log.get_logs_by_author(author.id)
    if not logs:
        url = request.route_url('editor')
        return HTTPFound(location=url)
    logs_json = json.dumps([i.reprJSON() for i in logs],cls=ComplexEncoder)
    return {'logs': logs_json, 'author': author}