Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
corepost
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
nexlab
corepost
Commits
4204008e
Commit
4204008e
authored
Jun 16, 2012
by
Mark Moissette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added uuid argument extraction handling
parent
942a67c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
routing.py
corepost/routing.py
+4
-3
No files found.
corepost/routing.py
View file @
4204008e
...
@@ -17,6 +17,7 @@ from twisted.web.http import parse_qs
...
@@ -17,6 +17,7 @@ from twisted.web.http import parse_qs
from
twisted.python
import
log
from
twisted.python
import
log
import
re
,
copy
,
exceptions
,
yaml
,
json
,
logging
import
re
,
copy
,
exceptions
,
yaml
,
json
,
logging
from
xml.etree
import
ElementTree
from
xml.etree
import
ElementTree
import
uuid
advanced_json
=
False
advanced_json
=
False
try
:
try
:
...
@@ -28,9 +29,9 @@ except ImportError: pass
...
@@ -28,9 +29,9 @@ except ImportError: pass
class
UrlRouter
:
class
UrlRouter
:
''' Common class for containing info related to routing a request to a function '''
''' Common class for containing info related to routing a request to a function '''
__urlMatcher
=
re
.
compile
(
r"<(int|float|):?([^/]+)>"
)
__urlMatcher
=
re
.
compile
(
r"<(int|float|
uuid|
):?([^/]+)>"
)
__urlRegexReplace
=
{
""
:
r"(?P<arg>([^/]+))"
,
"int"
:
r"(?P<arg>\d+)"
,
"float"
:
r"(?P<arg>\d+.?\d*)"
}
__urlRegexReplace
=
{
""
:
r"(?P<arg>([^/]+))"
,
"int"
:
r"(?P<arg>\d+)"
,
"float"
:
r"(?P<arg>\d+.?\d*)"
,
"uuid"
:
r"(?P<arg>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})"
}
__typeConverters
=
{
"int"
:
int
,
"float"
:
float
}
__typeConverters
=
{
"int"
:
int
,
"float"
:
float
,
"uuid"
:
uuid
.
UUID
}
def
__init__
(
self
,
f
,
url
,
methods
,
accepts
,
produces
,
cache
):
def
__init__
(
self
,
f
,
url
,
methods
,
accepts
,
produces
,
cache
):
self
.
__f
=
f
self
.
__f
=
f
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment