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 99 - DJANGO=1.6
1010 - DJANGO=1.7
1111 - DJANGO=1.8
12+ - DJANGO=1.9
1213install :
1314 - pip install -q Django==$DJANGO
1415script :
@@ -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
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ month - (0?([1-9])|10|11|12)
1717day - ((0|1|2)?([1-9])|[1-3]0|31)
1818id - \d+
1919pk - \d+
20+ page - \d+
2021uuid - [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(
9899Standard 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
103103from project.portal.views import IndexView
104104
105105
Original file line number Diff line number Diff line change 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)' ,
Original file line number Diff line number Diff line change 1+ import sys
12import uuid
23
34from 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
611from 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-]+)$' )
You can’t perform that action at this time.
0 commit comments