Skip to content

Commit f7275ef

Browse files
committed
README fixes
2 parents 3b98b12 + b3986ba commit f7275ef

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99
- DJANGO=1.6
1010
- DJANGO=1.7
1111
- DJANGO=1.8
12+
- DJANGO=1.9
1213
install:
1314
- pip install -q Django==$DJANGO
1415
script:
@@ -21,3 +22,6 @@ matrix:
2122

2223
- python: "2.6"
2324
env: DJANGO=1.8
25+
26+
- python: "2.6"
27+
env: DJANGO=1.9

README.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ month - (0?([1-9])|10|11|12)
1717
day - ((0|1|2)?([1-9])|[1-3]0|31)
1818
id - \d+
1919
pk - \d+
20+
page - \d+
2021
uuid - [a-fA-F0-9]{8}-?[a-fA-F0-9]{4}-?[1345][a-fA-F0-9]{3}-?[a-fA-F0-9]{4}-?[a-fA-F0-9]{12}
2122
```
2223

@@ -98,8 +99,7 @@ urlpatterns = patterns(
9899
Standard Django urls example
99100

100101
```python
101-
from django.conf.urls import patterns
102-
from macrosurl import url
102+
from django.conf.urls import patterns, url
103103
from project.portal.views import IndexView
104104

105105

macrosurl/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
_macros_library = {
66
'id': r'\d+',
77
'pk': r'\d+',
8+
'page': r'\d+',
89
'slug': r'[\w-]+',
910
'year': r'\d{4}',
1011
'month': r'(0?([1-9])|10|11|12)',

tests/urls.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
import sys
12
import uuid
23

34
from django.conf.urls import include
4-
from django.utils import unittest
5+
6+
if sys.version_info >= (2, 7):
7+
import unittest
8+
else:
9+
from django.utils import unittest
510

611
from macrosurl import MacroUrlPattern, url
712

@@ -42,6 +47,14 @@ def test_pk(self):
4247
'^product/(?P<pk>\d+)/(?P<product_pk>\d+)$')
4348
self.assertEqual(MacroUrlPattern('product/:pk/:product_pk/:news_pk').compiled,
4449
'^product/(?P<pk>\d+)/(?P<product_pk>\d+)/(?P<news_pk>\d+)$')
50+
51+
def test_page(self):
52+
self.assertEqual(MacroUrlPattern('page/:page').compiled, '^page/(?P<page>\d+)$')
53+
self.assertEqual(MacroUrlPattern('product/:product_page').compiled, '^product/(?P<product_page>\d+)$')
54+
self.assertEqual(MacroUrlPattern('product/:page/:product_page').compiled,
55+
'^product/(?P<page>\d+)/(?P<product_page>\d+)$')
56+
self.assertEqual(MacroUrlPattern('product/:page/:product_page/:news_page').compiled,
57+
'^product/(?P<page>\d+)/(?P<product_page>\d+)/(?P<news_page>\d+)$')
4558

4659
def test_slug(self):
4760
self.assertEqual(MacroUrlPattern('page/:slug').compiled, '^page/(?P<slug>[\w-]+)$')

0 commit comments

Comments
 (0)