Page MenuHome
No OneTemporary

import logging
from pillarsdk import Node
from pillarsdk import Project
from flask import Blueprint
from flask import current_app
from flask import render_template
from flask import redirect
from flask import request
from werkzeug.contrib.atom import AtomFeed
from pillar.web.utils import system_util
from pillar.web.nodes.routes import url_for_node
from pillar.web.nodes.custom.posts import posts_view
from pillar.web.nodes.custom.posts import posts_create
blueprint = Blueprint('main', __name__)
log = logging.getLogger(__name__)
def homepage():
return render_template('homepage.html')
# @blueprint.errorhandler(500)
# def error_500(e):
# return render_template('errors/500.html'), 500
# @blueprint.errorhandler(404)
# def error_404(e):
# return render_template('errors/404.html'), 404
# @blueprint.errorhandler(403)
# def error_404(e):
# return render_template('errors/403_embed.html'), 403
def main_blog(url=None):
"""Blog with project news"""
project_id = current_app.config['MAIN_PROJECT_ID']
return posts_view(project_id, url=url)
def main_posts_create():
project_id = current_app.config['MAIN_PROJECT_ID']
return posts_create(project_id)
def project_blog(project_url, url=None):
"""View project blog"""
return posts_view(project_url=project_url, url=url)
def vrview():
"""Call this from iframes to render sperical content (video and images)"""
if 'image' not in request.args:
return redirect('/')
return render_template('vrview.html')
def error_403():
"""Custom entry point to display the not allowed template"""
return render_template('errors/403_embed.html')
def feeds_blogs():
"""Global feed generator for latest blogposts across all projects"""
def render_page():
feed = AtomFeed('Blender Cloud - Latest updates',
feed_url=request.url, url=request.url_root)
# Get latest blog posts
api = system_util.pillar_api()
latest_posts = Node.all({
'where': {'node_type': 'post', 'properties.status': 'published'},
'embedded': {'user': 1},
'sort': '-_created',
'max_results': '15'
}, api=api)
# Populate the feed
for post in latest_posts._items:
author = post.user.fullname
updated = post._updated if post._updated else post._created
url = url_for_node(node=post)
content =[:500]
content = '<p>{0}... <a href="{1}">Read more</a></p>'.format(content, url)
feed.add(, str(content),
return feed.get_response()
return render_page()
def nodes_search_index():
return render_template('nodes/search.html')

File Metadata

Mime Type
Thu, Aug 11, 10:24 AM (1 d, 23 h)
Storage Engine
Storage Format
Raw Data
Storage Handle

Event Timeline