from settings import gettext from flask import Response from flask import request, g from flask import redirect, url_for, flash, abort from flask.helpers import safe_join from werkzeug.contrib.atom import AtomFeed import apis from tools import unquote from ajax import dispatch_action, jsonify, get_sitemap, get_latest_posts from utils import render_template, get_locale, flask_render_template from utils import login_required, login_user, logout_user import model app = model.bind_app(app) # Bind DataBase Models ######################################## ## Global Functions ######################################## def theme_file(theme, filename): filename = "themes/%s/%s" % (theme, filename) if RUNTIME_ENV not in ("gae", "gae_dev"): # GAE can not access static folder because the files will go to CDN instead of GAE instance real_file = safe_join(app.static_folder, filename) if not os.path.isfile(real_file): return "" return "%s/%s" % (app.static_url_path, filename)