diff --git a/.gitignore b/.gitignore index da9da46..c8b3cc8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,22 @@ -*.pyc +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +_build + +# pycharm files +.idea/ + +# Unit test / coverage reports .coverage -htmlcov -dist/ -*.egg-info/ -.tox/ -.idea/ \ No newline at end of file +.tox \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..016fb27 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +# Include the license file +include LICENSE.txt \ No newline at end of file diff --git a/multiurl.py b/multiurl.py index 3e3d539..0e0469b 100644 --- a/multiurl.py +++ b/multiurl.py @@ -2,13 +2,16 @@ from django.core import urlresolvers + class ContinueResolving(Exception): pass + def multiurl(*urls, **kwargs): exceptions = kwargs.get('catch', (ContinueResolving,)) return MultiRegexURLResolver(urls, exceptions) + class MultiRegexURLResolver(urlresolvers.RegexURLResolver): def __init__(self, urls, exceptions): super(MultiRegexURLResolver, self).__init__('', None) @@ -40,6 +43,7 @@ def resolve(self, path): return MultiResolverMatch(matched, self._exceptions, patterns_matched, path) raise urlresolvers.Resolver404({'tried': tried, 'path': path}) + class MultiResolverMatch(object): def __init__(self, matches, exceptions, patterns_matched, path): self.matches = matches diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..24cf69d --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[metadata] +description-file = README.rst + +[bdist_wheel] +universal=1 \ No newline at end of file diff --git a/setup.py b/setup.py index 6008ba4..daa002b 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,18 @@ -import os -from setuptools import setup - -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() +from setuptools import setup, find_packages setup( - name = 'django-multiurl', - version = '1.1.0', - description = 'Allow multiple views to match the same URL.', - license = 'BSD', - long_description = read('README.rst'), - url = 'https://github.com/jacobian/django-multiurl', - - author = 'Jacob Kaplan-Moss and Robert Roskam', - author_email = 'raiderrobert@gmail.com', - - py_modules = ['multiurl'], - install_requires = ['django>=1.5'], - - classifiers = ( + name='django-multiurl', + py_modules=['multiurl'], + version='1.1.0', + description='Allow multiple views to match the same URL.', + license='BSD', + url='https://github.com/raiderrobert/django-multiurl', + download_url='https://github.com/raiderrobert/django-multiurl/tarball/v1.1.0', + author='Jacob Kaplan-Moss and Robert Roskam', + author_email='raiderrobert@gmail.com', + install_requires=['django>=1.5'], + keywords='django urls', + classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Framework :: Django', @@ -29,5 +23,5 @@ def read(fname): 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', - ), + ], ) diff --git a/tests.py b/tests.py index 824bf2b..7d1fc02 100644 --- a/tests.py +++ b/tests.py @@ -1,12 +1,15 @@ from __future__ import unicode_literals +import unittest + from django.conf import settings from django.conf.urls import url from django.core.urlresolvers import RegexURLResolver, Resolver404, NoReverseMatch from django.http import HttpResponse -import unittest + from multiurl import multiurl, ContinueResolving + class MultiviewTests(unittest.TestCase): def setUp(self): # Patterns with a "catch all" view (thing) at the end.