File tree Expand file tree Collapse file tree 4 files changed +21
-3
lines changed Expand file tree Collapse file tree 4 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 9
9
- DJANGO=1.6
10
10
- DJANGO=1.7
11
11
- DJANGO=1.8
12
+ - DJANGO=1.9
12
13
install :
13
14
- pip install -q Django==$DJANGO
14
15
script :
@@ -21,3 +22,6 @@ matrix:
21
22
22
23
- python : " 2.6"
23
24
env : DJANGO=1.8
25
+
26
+ - python : " 2.6"
27
+ env : DJANGO=1.9
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ month - (0?([1-9])|10|11|12)
17
17
day - ((0|1|2)?([1-9])|[1-3]0|31)
18
18
id - \d+
19
19
pk - \d+
20
+ page - \d+
20
21
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}
21
22
```
22
23
@@ -98,8 +99,7 @@ urlpatterns = patterns(
98
99
Standard Django urls example
99
100
100
101
``` python
101
- from django.conf.urls import patterns
102
- from macrosurl import url
102
+ from django.conf.urls import patterns, url
103
103
from project.portal.views import IndexView
104
104
105
105
Original file line number Diff line number Diff line change 5
5
_macros_library = {
6
6
'id' : r'\d+' ,
7
7
'pk' : r'\d+' ,
8
+ 'page' : r'\d+' ,
8
9
'slug' : r'[\w-]+' ,
9
10
'year' : r'\d{4}' ,
10
11
'month' : r'(0?([1-9])|10|11|12)' ,
Original file line number Diff line number Diff line change
1
+ import sys
1
2
import uuid
2
3
3
4
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
5
10
6
11
from macrosurl import MacroUrlPattern , url
7
12
@@ -42,6 +47,14 @@ def test_pk(self):
42
47
'^product/(?P<pk>\d+)/(?P<product_pk>\d+)$' )
43
48
self .assertEqual (MacroUrlPattern ('product/:pk/:product_pk/:news_pk' ).compiled ,
44
49
'^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+)$' )
45
58
46
59
def test_slug (self ):
47
60
self .assertEqual (MacroUrlPattern ('page/:slug' ).compiled , '^page/(?P<slug>[\w-]+)$' )
You can’t perform that action at this time.
0 commit comments