示例#1
0
文件: core.py 项目: WenTingZhu/osf.io
def init_mfr(app):
    """Register all available FileHandlers and collect each
    plugin's static assets to the app's static path.
    """
    # Available file handlers
    mfr.register_filehandlers(ALL_HANDLERS)

    # Update mfr config with static path and url
    mfr.config.update({
        # Base URL for static files
        'ASSETS_URL': os.path.join(app.static_url_path, 'mfr'),
        # Where to save static files
        'ASSETS_FOLDER': os.path.join(app.static_folder, 'mfr'),
    })
    mfr.collect_static(dest=mfr.config['ASSETS_FOLDER'])
示例#2
0
def init_mfr(app):
    """Register all available FileHandlers and collect each
    plugin's static assets to the app's static path.
    """
    # Available file handlers
    mfr.register_filehandlers(ALL_HANDLERS)

    # Update mfr config with static path and url
    mfr.config.update({
        # Base URL for static files
        'ASSETS_URL': os.path.join(app.static_url_path, 'public', 'mfr'),
        # Where to save static files
        'ASSETS_FOLDER': os.path.join(app.static_folder, 'public', 'mfr'),
    })
    mfr.collect_static(dest=mfr.config['ASSETS_FOLDER'])
示例#3
0
from mfr.exceptions import MFRError

from website import settings
from website.language import ERROR_PREFIX

from framework.tasks import app
from framework.render import exceptions
from framework.render.core import save_to_file_or_error
from framework.render.core import render_is_done_or_happening


logger = logging.getLogger(__name__)

# Ensure all filehandlers are registered. This MUST happen here so that
# the handlers are registered when celery imports this module
mfr.register_filehandlers(ALL_HANDLERS)
# Update mfr config with static path and url
mfr.config.update({
    # Base URL for static files
    'ASSETS_URL': os.path.join(settings.STATIC_URL_PATH, 'public', 'mfr'),
    # Where to save static files
    'ASSETS_FOLDER': os.path.join(settings.STATIC_FOLDER, 'public', 'mfr'),
})

CUSTOM_ERROR_MESSAGES = {}

# Unable to render. Download the file to view it.
def render_mfr_error(err):
    pre = ERROR_PREFIX
    msg = CUSTOM_ERROR_MESSAGES.get(type(err), err.message)
    return u"""
示例#4
0
from mfr.ext import ALL_HANDLERS
from mfr.exceptions import MFRError

from website import settings
from website.language import ERROR_PREFIX

from framework.tasks import app
from framework.render import exceptions
from framework.render.core import save_to_file_or_error
from framework.render.core import render_is_done_or_happening

logger = logging.getLogger(__name__)

# Ensure all filehandlers are registered. This MUST happen here so that
# the handlers are registered when celery imports this module
mfr.register_filehandlers(ALL_HANDLERS)
# Update mfr config with static path and url
mfr.config.update({
    # Base URL for static files
    'ASSETS_URL':
    os.path.join(settings.STATIC_URL_PATH, 'public', 'mfr'),
    # Where to save static files
    'ASSETS_FOLDER':
    os.path.join(settings.STATIC_FOLDER, 'public', 'mfr'),
})

CUSTOM_ERROR_MESSAGES = {}


# Unable to render. Download the file to view it.
def render_mfr_error(err):