コード例 #1
0
ファイル: view.py プロジェクト: diascreative/VaingloriousEye
    def __init__(self, db, data_dir, table_prefix='', _synchronous=False,
                 site_title='The Vainglorious Eye: '):
        """Instantiate/configure the object.

        `db` is a SQLAlchemy connection string

        `data_dir` is a directory where pickle caches are kept

        `_synchronous` can be set to True to avoid spawning any
        threads (even when summaries are slow)

        `site_title` is used in templates, a simple view customization
        """
        self.request_tracker = RequestTracker(db, table_prefix=table_prefix)
        self.data_dir = data_dir
        self.lookup = TemplateLookup(directories=[os.path.join(os.path.dirname(__file__), 'templates')])
        self._synchronous = _synchronous
        self.site_title = site_title
        if _synchronous:
            self.view_summary = self.summary
        else:
            self.view_summary = wsgi_unwrap(WaitForIt(wsgi_wrap(self.summary).wsgi_app,
                                                      time_limit=10, poll_time=5))
コード例 #2
0
ファイル: view.py プロジェクト: diascreative/VaingloriousEye
 def __call__(self, environ, start_response):
     """WSGI Interface"""
     req = Request(environ, charset='utf8')
     req.base_url = req.application_url
     return wsgi_wrap(self.app).wsgi_app(environ, start_response)