Example #1
0
File: pypi.py Project: mrc75/pyppi
    def dispatch(self, request, *args, **kwargs):
        """ Root view of the package index, handle incoming actions from distutils
        or redirect to a more user friendly view """
        if not request.user.is_authenticated():
            user = login_basic_auth(request)
            if user:
                login(request, user)

        if request.method == 'POST':
            if request.META['CONTENT_TYPE'] == 'text/xml':
                log.debug('XMLRPC request received')
                return parse_xmlrpc_request(request)
            log.debug('Distutils request received')
            parse_distutils_request(request)
            action = request.POST.get(':action', '')
        else:
            action = request.GET.get(':action', '')

        if action == 'submit':
            return RegisterView.as_view()(request, *args, **kwargs)
        elif action == 'file_upload':
            return UploadView.as_view()(request, *args, **kwargs)
        elif action == 'list_classifiers':
            return ClassifierView.as_view()(request, *args, **kwargs)
        elif action == '':
            return ReleaseIndex.as_view()(request, *args, **kwargs)
        else:
            log.error('Invalid action encountered: `%s`', action)
            return HttpResponseNotAllowed(action)
Example #2
0
File: urls.py Project: mrc75/pyppi

    # url(r'^pypi/(?P<package>[\w\d_\.\-]+)/$','packages.details',
    #     name='djangopypi-package'),
    # url(r'^pypi/(?P<package>[\w\d_\.\-]+)/rss/$', ReleaseFeed(),
    #     name='djangopypi-package-rss'),
    # url(r'^pypi/(?P<package>[\w\d_\.\-]+)/doap.rdf$','packages.doap',
    #     name='djangopypi-package-doap'),
    # url(r'^pypi/(?P<package>[\w\d_\.\-]+)/manage/$','packages.manage',
    #     name='djangopypi-package-manage'),
    # url(r'^pypi/(?P<package>[\w\d_\.\-]+)/manage/versions/$','packages.manage_versions',
    #     name='djangopypi-package-manage-versions'),
    #

    url(r'^pypi/$',
        ReleaseIndex.as_view(),
        name='pyppi-release-list'),

    url(r'^pypi/(?P<package>[\w\d_\.\-]+)/(?P<version>[\w\d_\.\-]+)/$',
        ReleaseDetail.as_view(), name='pyppi-release'),

    # url(r'^pypi/(?P<package>[\w\d_\.\-]+)/(?P<version>[\w\d_\.\-]+)/doap.rdf$',
    #     'releases.doap',name='djangopypi-release-doap'),
    # url(r'^pypi/(?P<package>[\w\d_\.\-]+)/(?P<version>[\w\d_\.\-]+)/manage/$',
    #     'releases.manage',name='djangopypi-release-manage'),
    # url(r'^pypi/(?P<package>[\w\d_\.\-]+)/(?P<version>[\w\d_\.\-]+)/metadata/$',
    #     'releases.manage_metadata',name='djangopypi-release-manage-metadata'),
    # url(r'^pypi/(?P<package>[\w\d_\.\-]+)/(?P<version>[\w\d_\.\-]+)/files/$',
    #     'releases.manage_files',name='djangopypi-release-manage-files'),
    # url(r'^pypi/(?P<package>[\w\d_\.\-]+)/(?P<version>[\w\d_\.\-]+)/files/upload/$',
    #     'releases.upload_file',name='djangopypi-release-upload-file'),