コード例 #1
0
    def get_app(self):
        self.packages = spy(mappers.PackageMapper(empty_stub()))
        self.cache = spy(cache.Cache(self.packages, None, None))
        self.pypi_fallback = "http://pypi.python.org/simple/%s/"

        return web.Application([
                web.url(r'/distutils/',
                    handlers.DistutilsDownloadHandler, dict(packages=self.packages, cache=self.cache)
                ),
                web.url(r'/distutils/(?P<id_>%s)/' % viper.identifier(),
                    handlers.DistutilsDownloadHandler, dict(packages=self.packages, cache=self.cache),
                    name='distutils_package'
                ),
                web.url(r'/distutils/(?P<id_>%s)/(?P<version>%s)' % (viper.identifier(), viper.identifier()),
                    handlers.DistutilsDownloadHandler, dict(packages=self.packages, cache=self.cache),
                    name='distutils_package_with_version'
                ),
                web.url(r'/packages/(?P<id_>%s)' % viper.identifier(),
                    handlers.PackageHandler, dict(packages=self.packages, cache=self.cache),
                    name='package'
                ),
                web.url(r'/files/(?P<id_>%s)' % viper.identifier(),
                    handlers.FileHandler, dict(files=None),
                    name='file'
                )
            ],
            debug=True,
            template_path=os.path.join(os.path.dirname(handlers.__file__), 'templates'),
            static_path=os.path.join(os.path.dirname(handlers.__file__), 'static'),
            pypi_fallback=self.pypi_fallback
        )
コード例 #2
0
    def get_app(self):
        self.packages = spy(mappers.PackageMapper(empty_stub()))
        self.cache = spy(cache.Cache(self.packages, None, None))

        return web.Application([
                web.url(r'/packages/(?P<id_>%s)' % viper.identifier(),
                    handlers.PackageHandler, dict(packages=self.packages, cache=self.cache),
                    name='package'
                ),
                web.url(r'/packages/(?P<id_>%s)/(?P<version>%s)' % (viper.identifier(), viper.identifier()),
                    handlers.PackageHandler, dict(packages=self.packages, cache=self.cache),
                    name='package_with_version'
                )
            ],
            debug=True,
            template_path=os.path.join(os.path.dirname(handlers.__file__), 'templates'),
            static_path=os.path.join(os.path.dirname(handlers.__file__), 'static')
        )
コード例 #3
0
    def get_app(self):
        self.packages = spy(mappers.PackageMapper(empty_stub()))
        self.cache = spy(cache.Cache(self.packages, None, None))

        return web.Application(
            [
                web.url(r'/packages/(?P<id_>%s)' % viper.identifier(),
                        handlers.PackageHandler,
                        dict(packages=self.packages, cache=self.cache),
                        name='package'),
                web.url(r'/packages/(?P<id_>%s)/(?P<version>%s)' %
                        (viper.identifier(), viper.identifier()),
                        handlers.PackageHandler,
                        dict(packages=self.packages, cache=self.cache),
                        name='package_with_version')
            ],
            debug=True,
            template_path=os.path.join(os.path.dirname(handlers.__file__),
                                       'templates'),
            static_path=os.path.join(os.path.dirname(handlers.__file__),
                                     'static'))
コード例 #4
0
    def get_app(self):
        self.files = spy(mappers.FileMapper(None))

        return web.Application([
                web.url(r'/files/(?P<id_>%s)' % viper.identifier(),
                    handlers.FileHandler, dict(files=self.files),
                    name='file'
                )
            ],
            debug=True,
            template_path=os.path.join(os.path.dirname(handlers.__file__), 'templates'),
            static_path=os.path.join(os.path.dirname(handlers.__file__), 'static')
        )
コード例 #5
0
    def get_app(self):
        self.files = spy(mappers.FileMapper(None))

        return web.Application(
            [
                web.url(r'/files/(?P<id_>%s)' % viper.identifier(),
                        handlers.FileHandler,
                        dict(files=self.files),
                        name='file')
            ],
            debug=True,
            template_path=os.path.join(os.path.dirname(handlers.__file__),
                                       'templates'),
            static_path=os.path.join(os.path.dirname(handlers.__file__),
                                     'static'))
コード例 #6
0
    def get_app(self):
        self.packages = spy(mappers.PackageMapper(empty_stub()))

        return web.Application(
            [
                web.url(r'/packages', handlers.AllPackagesHandler,
                        dict(packages=self.packages)),
                web.url(r'/packages/(?P<id_>%s)' % viper.identifier(),
                        handlers.PackageHandler,
                        dict(packages=self.packages, pypi=None, files=None),
                        name='package')
            ],
            debug=True,
            template_path=os.path.join(os.path.dirname(handlers.__file__),
                                       'templates'),
            static_path=os.path.join(os.path.dirname(handlers.__file__),
                                     'static'))
コード例 #7
0
    def get_app(self):
        self.packages = spy(mappers.PackageMapper(empty_stub()))

        return web.Application(
            [
                web.url(r"/packages", handlers.AllPackagesHandler, dict(packages=self.packages)),
                web.url(
                    r"/packages/(?P<id_>%s)" % viper.identifier(),
                    handlers.PackageHandler,
                    dict(packages=self.packages, pypi=None, files=None),
                    name="package",
                ),
            ],
            debug=True,
            template_path=os.path.join(os.path.dirname(handlers.__file__), "templates"),
            static_path=os.path.join(os.path.dirname(handlers.__file__), "static"),
        )