All modules are now plugins. The config.py calls load_plugin for each plugin it needs (some plugins may load others automatically). Also each plugin keeps its own template folder which gets added to the template search path, so i.e. if the photo plugin is unloaded completely, the URL endpoints won't work either (with the old system, since the HTML templates still existed in the default root the endpoints would still serve pages, just without any Python logic behind them).
30 regels
721 B
Python
30 regels
721 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
"""Endpoints for the commenting subsystem."""
|
|
|
|
from flask import Blueprint, g
|
|
|
|
import rophako.model.emoticons as Emoticons
|
|
from rophako.utils import template
|
|
from rophako.log import logger
|
|
from config import *
|
|
|
|
mod = Blueprint("emoticons", __name__, url_prefix="/emoticons")
|
|
|
|
|
|
@mod.route("/")
|
|
def index():
|
|
"""List the available emoticons."""
|
|
theme = Emoticons.load_theme()
|
|
|
|
smileys = []
|
|
for img in sorted(theme["map"]):
|
|
smileys.append({
|
|
"img": img,
|
|
"triggers": theme["map"][img],
|
|
})
|
|
|
|
g.info["theme"] = EMOTICON_THEME
|
|
g.info["theme_name"] = theme["name"]
|
|
g.info["smileys"] = smileys
|
|
return template("emoticons/index.html") |