コード例 #1
0
 def mochikit(self, environ, start_response):
     """
     Static path where MochiKit lives
     """
     app = urlparser.StaticURLParser(
         os.path.join(os.path.dirname(__file__), 'mochikit'))
     return app(environ, start_response)
コード例 #2
0
 def media(self, environ, start_response):
     """
     Static path where images and other files live
     """
     app = urlparser.StaticURLParser(
         os.path.join(os.path.dirname(__file__), 'media'))
     return app(environ, start_response)
コード例 #3
0
ファイル: admin.py プロジェクト: zorun/hookbox
    def __init__(self, server, config, outputter):
        outputter.add_observer(self._output)
        self.config = config
        self.server = server
        self._wsgi_app = urlmap.URLMap()
        self._csp = csp.Listener()
        self._wsgi_app['/csp'] = self._csp
        static_path = os.path.join(
            os.path.split(os.path.abspath(__file__))[0], 'static')
        self._wsgi_app['/'] = urlparser.StaticURLParser(static_path)
        self._rtjp_server = rtjp_eventlet.RTJPServer()

        self.console_buffer = ""
        self._wrap_output()

        self.conns = []
        self.watched_channels = {}
        self.watched_users = {}
        self.watched_connections = {}
        self.channel_list_watchers = []
        self.user_list_watchers = []
        self.watching_index = {}
        self.console_watchers = []

        self.webhooks_watchers = []
        self.webhooks_history = []

        eventlet.spawn(self._run)
コード例 #4
0
 def media(self, req):
     """Static path where images and other files live"""
     first_part = req.path_info_peek()
     if first_part in self.media_paths:
         req.path_info_pop()
         path = self.media_paths[first_part]
     else:
         path = resource_filename("weberror", "eval-media")
     app = urlparser.StaticURLParser(path)
     return app
コード例 #5
0
ファイル: app.py プロジェクト: mohalfaki/bungeni-portal
import os

from paste import urlparser

here = os.path.abspath(os.path.dirname(__file__))
static = urlparser.StaticURLParser(os.path.join(here, 'static'))


def make_static_serving_app(global_conf, document_root=""):
    def app(environ, start_response):
        environ['SCRIPT_NAME'] = ''
        path_info = environ.get('PATH_INFO', '')
        environ['PATH_INFO'] = document_root + environ['PATH_INFO']
        return static(environ, start_response)

    return app


def sync_xml_files():
    """ Merges deliverance's rules.xml
        with proxy server configuration
        to generate actual configuration xml
    """
    deliverance_conf_path = os.path.abspath(
        os.path.join(os.path.dirname(__file__),
                     "../../../../deliverance-proxy.conf"))

    if os.path.exists(deliverance_conf_path):

        conf_file = open(deliverance_conf_path, 'r')
        conf_data = conf_file.read()