Commit 4204008e authored by Mark Moissette's avatar Mark Moissette

added uuid argument extraction handling

parent 942a67c0
...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment