def make_app(debug): app = tornado.web.Application( [ (r'/static/(.*)', tornado.web.StaticFileHandler, {'path': server_settings.STATIC_PATH}), (r'/assets/(.*?)/(.*\..*)', ExtensionsStaticFileHandler), (r'/export', ExportHandler), (r'/render', RenderHandler), (r'/status', StatusHandler), ], debug=debug, ) # Fix package import app.sentry_client = AioSentryClient(settings.get('SENTRY_DSN', None)) return app
try: from mfr import settings except ImportError: settings = {} config = settings.get("HTTP_PROVIDER_CONFIG", {})
import asyncio import aiohttp from stevedore import driver from raven.contrib.tornado import AsyncSentryClient from mfr import settings from mfr.core import exceptions sentry_dns = settings.get('SENTRY_DSN', None) class AioSentryClient(AsyncSentryClient): def send_remote(self, url, data, headers=None, callback=None): headers = headers or {} if not self.state.should_try(): message = self._get_log_message(data) self.error_logger.error(message) return future = aiohttp.request('POST', url, data=data, headers=headers) asyncio.async(future) if sentry_dns: client = AioSentryClient(sentry_dns) else: client = None
try: from mfr import settings except ImportError: settings = {} config = settings.get('OSF_PROVIDER_CONFIG', {}) # BASE_URL = config.get('BASE_URL', 'http://localhost:5001/')
import os import furl try: from mfr import settings except ImportError: settings = {} config = settings.get('SERVER_CONFIG', {}) STATIC_PATH = config.get('STATIC_PATH', os.path.join(os.path.dirname(__file__), 'static')) ADDRESS = config.get('ADDRESS', 'localhost') PORT = config.get('PORT', 7778) DEBUG = config.get('DEBUG', False) SSL_CERT_FILE = config.get('SSL_CERT_FILE', None) SSL_KEY_FILE = config.get('SSL_KEY_FILE', None) XHEADERS = config.get('XHEADERS', False) CORS_ALLOW_ORIGIN = config.get('CORS_ALLOW_ORIGIN', '*') CHUNK_SIZE = config.get('CHUNK_SIZE', 65536) # 64KB MAX_BUFFER_SIZE = config.get('MAX_BUFFER_SIZE', 1024 * 1024 * 100) # 100MB PROVIDER_NAME = config.get('PROVIDER_NAME', 'osf')
import os try: from mfr import settings except ImportError: settings = {} config = settings.get('SERVER_CONFIG', {}) STATIC_PATH = config.get('STATIC_PATH', os.path.join(os.path.dirname(__file__), 'static')) ADDRESS = config.get('ADDRESS', '127.0.0.1') PORT = config.get('PORT', 7778) DEBUG = config.get('DEBUG', True) SSL_CERT_FILE = config.get('SSL_CERT_FILE', None) SSL_KEY_FILE = config.get('SSL_KEY_FILE', None) XHEADERS = config.get('XHEADERS', False) CORS_ALLOW_ORIGIN = config.get('CORS_ALLOW_ORIGIN', '*') CHUNK_SIZE = config.get('CHUNK_SIZE', 65536) # 64KB MAX_BUFFER_SIZE = config.get('MAX_BUFFER_SIZE', 1024 * 1024 * 100) # 100MB PROVIDER_NAME = config.get('PROVIDER_NAME', 'osf') CACHE_ENABLED = config.get('CACHE_ENABLED', False) CACHE_PROVIDER_NAME = config.get('CACHE_PROVIDER_NAME', 'filesystem') CACHE_PROVIDER_SETTINGS = config.get('CACHE_PROVIDER_SETTINGS',
import asyncio import aiohttp from stevedore import driver from raven.contrib.tornado import AsyncSentryClient from mfr import settings from mfr.core import exceptions sentry_dns = settings.get('SENTRY_DSN', None) class AioSentryClient(AsyncSentryClient): def send_remote(self, url, data, headers=None, callback=None): headers = headers or {} if not self.state.should_try(): message = self._get_log_message(data) self.error_logger.error(message) return future = aiohttp.request('POST', url, data=data, headers=headers) asyncio. async (future) if sentry_dns: client = AioSentryClient(sentry_dns) else: client = None
try: from mfr import settings except ImportError: settings = {} config = settings.get('PDB_EXTENSION_CONFIG', {}) OPTIONS = config.get('OPTIONS', { 'width': 'auto', 'height': '400', 'antialias': True, 'outline': True, 'quality': 'medium', 'fog': False })
try: from mfr import settings except ImportError: settings = {} config = settings.get('PDB_EXTENSION_CONFIG', {}) OPTIONS = config.get( 'OPTIONS', { 'width': 'auto', 'height': '400', 'antialias': True, 'outline': True, 'quality': 'medium', 'fog': False })
import os try: from mfr import settings except ImportError: settings = {} config = settings.get('UNOCONV_EXTENSION_CONFIG', {}) UNOCONV_BIN = config.get('UNOCONV_BIN', '/usr/bin/unoconv') ADDRESS = config.get('SERVER', os.environ.get('UNOCONV_PORT_2002_TCP_ADDR', '127.0.0.1')) PORT = config.get('PORT', os.environ.get('UNOCONV_PORT_2002_TCP_PORT', '2002')) DEFAULT_RENDER = {'renderer': '.pdf', 'format': 'pdf'} RENDER_MAP = config.get('RENDER_MAP', { # 'csv': {'renderer': '.xlsx', 'format': 'xlsx'}, # 'ppt': {'renderer': '.pdf', 'format': 'pdf'}, # 'pptx': {'renderer': '.pdf', 'format': 'pdf'}, })
import os try: from mfr import settings except ImportError: settings = {} config = settings.get('UNOCONV_EXTENSION_CONFIG', {}) UNOCONV_BIN = config.get('UNOCONV_BIN', '/usr/bin/unoconv') ADDRESS = config.get('SERVER', os.environ.get('UNOCONV_PORT_2002_TCP_ADDR', '127.0.0.1')) PORT = config.get('PORT', os.environ.get('UNOCONV_PORT_2002_TCP_PORT', '2002')) DEFAULT_RENDER = {'renderer': '.pdf', 'format': 'pdf'} RENDER_MAP = config.get( 'RENDER_MAP', { # 'csv': {'renderer': '.xlsx', 'format': 'xlsx'}, # 'ppt': {'renderer': '.pdf', 'format': 'pdf'}, # 'pptx': {'renderer': '.pdf', 'format': 'pdf'}, })
try: from mfr import settings except ImportError: settings = {} config = settings.get('IMAGE_EXTENSION_CONFIG', {}) EXPORT_TYPE = config.get('EXPORT_TYPE', 'jpeg') EXPORT_MAXIMUM_SIZE = config.get('EXPORT_MAXIMUM_SIZE', '1200x1200') EXPORT_EXCLUSIONS = config.get('EXPORT_EXCLUSIONS', [ '.gif', '.ico', ])
from mfr.extensions.tabular import libs try: from mfr import settings except ImportError: settings = {} config = settings.get('TABULAR_EXTENSION_CONFIG', {}) MAX_SIZE = config.get('MAX_SIZE', 10000) TABLE_WIDTH = config.get('TABLE_WIDTH', 700) TABLE_HEIGHT = config.get('TABLE_HEIGHT', 600) LIBS = config.get('LIBS', { '.csv': [libs.csv_stdlib], '.tsv': [libs.csv_stdlib], '.xlsx': [libs.xlsx_xlrd], '.xls': [libs.xlsx_xlrd], '.dta': [libs.dta_pandas], '.sav': [libs.sav_pandas], # '.ods': [libs.ods_ezodf], }) SMALL_TABLE = config.get('SMALL_TABLE', { 'enableCellNavigation': True, 'enableColumnReorder': False, 'forceFitColumns': True, 'syncColumnCellResize': True, 'multiColumnSort': True,
from mfr.extensions.tabular import libs try: from mfr import settings except ImportError: settings = {} config = settings.get('TABULAR_EXTENSION_CONFIG', {}) MAX_SIZE = config.get('MAX_SIZE', 10000) TABLE_WIDTH = config.get('TABLE_WIDTH', 700) TABLE_HEIGHT = config.get('TABLE_HEIGHT', 600) LIBS = config.get( 'LIBS', { '.csv': [libs.csv_stdlib], '.tsv': [libs.csv_stdlib], '.gsheet': [libs.xlsx_xlrd], '.xlsx': [libs.xlsx_xlrd], '.xls': [libs.xlsx_xlrd], '.dta': [libs.dta_pandas], '.sav': [libs.sav_pandas], # '.ods': [libs.ods_ezodf], }) SMALL_TABLE = config.get( 'SMALL_TABLE', { 'enableCellNavigation': True, 'enableColumnReorder': False, 'forceFitColumns': True,