##// END OF EJS Templates
Moved signatures block to the model block. All the signed content is in the 'content' block now. Removed edit time, previous and next posts links from the XML sync output because they can be computed from the post itself and can be changed locally for foreign posts (which breaks the signature)
Moved signatures block to the model block. All the signed content is in the 'content' block now. Removed edit time, previous and next posts links from the XML sync output because they can be computed from the post itself and can be changed locally for foreign posts (which breaks the signature)

File last commit:

r813:259d2595 default
r838:2b96b9e7 decentral
Show More
context_processors.py
42 lines | 1.1 KiB | text/x-python | PythonLexer
/ boards / context_processors.py
from boards.abstracts.settingsmanager import PERMISSION_MODERATE, \
get_settings_manager
__author__ = 'neko259'
from boards import settings
from boards.models import Post
CONTEXT_SITE_NAME = 'site_name'
CONTEXT_VERSION = 'version'
CONTEXT_MODERATOR = 'moderator'
CONTEXT_THEME_CSS = 'theme_css'
CONTEXT_THEME = 'theme'
CONTEXT_PPD = 'posts_per_day'
CONTEXT_TAGS = 'tags'
CONTEXT_USER = 'user'
PERMISSION_MODERATE = 'moderation'
def user_and_ui_processor(request):
context = {}
context[CONTEXT_PPD] = float(Post.objects.get_posts_per_day())
settings_manager = get_settings_manager(request)
context[CONTEXT_TAGS] = settings_manager.get_fav_tags()
theme = settings_manager.get_theme()
context[CONTEXT_THEME] = theme
context[CONTEXT_THEME_CSS] = 'css/' + theme + '/base_page.css'
# This shows the moderator panel
try:
moderate = request.user.has_perm('moderation')
except AttributeError:
moderate = False
context[CONTEXT_MODERATOR] = moderate
context[CONTEXT_VERSION] = settings.VERSION
context[CONTEXT_SITE_NAME] = settings.SITE_NAME
return context