#836: Allow for standard Crossbar a.c..d style pattern URIs to be used with Pattern
This commit is contained in:
@@ -160,6 +160,7 @@ class Pattern(object):
|
|||||||
components = uri.split('.')
|
components = uri.split('.')
|
||||||
pl = []
|
pl = []
|
||||||
nc = {}
|
nc = {}
|
||||||
|
group_count = 0
|
||||||
for i in range(len(components)):
|
for i in range(len(components)):
|
||||||
component = components[i]
|
component = components[i]
|
||||||
|
|
||||||
@@ -185,6 +186,7 @@ class Pattern(object):
|
|||||||
raise Exception("logic error")
|
raise Exception("logic error")
|
||||||
|
|
||||||
pl.append("(?P<{0}>[a-z0-9_]+)".format(name))
|
pl.append("(?P<{0}>[a-z0-9_]+)".format(name))
|
||||||
|
group_count += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
match = Pattern._URI_NAMED_COMPONENT.match(component)
|
match = Pattern._URI_NAMED_COMPONENT.match(component)
|
||||||
@@ -195,6 +197,7 @@ class Pattern(object):
|
|||||||
|
|
||||||
nc[name] = str
|
nc[name] = str
|
||||||
pl.append("(?P<{0}>[a-z0-9_]+)".format(name))
|
pl.append("(?P<{0}>[a-z0-9_]+)".format(name))
|
||||||
|
group_count += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
match = Pattern._URI_COMPONENT.match(component)
|
match = Pattern._URI_COMPONENT.match(component)
|
||||||
@@ -202,6 +205,12 @@ class Pattern(object):
|
|||||||
pl.append(component)
|
pl.append(component)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if component == '':
|
||||||
|
group_count += 1
|
||||||
|
pl.append("([a-z0-9][a-z0-9_\-]*)")
|
||||||
|
nc[group_count] = str
|
||||||
|
continue
|
||||||
|
|
||||||
raise Exception("invalid URI")
|
raise Exception("invalid URI")
|
||||||
|
|
||||||
if nc:
|
if nc:
|
||||||
|
|||||||
Reference in New Issue
Block a user