wsgi/routes: add regex pattern for each REST component

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Isaku Yamahata 2012-10-26 05:51:25 +09:00 committed by FUJITA Tomonori
parent 4b90f751ca
commit d347dce3c4
3 changed files with 9 additions and 1 deletions

View File

@ -29,6 +29,10 @@ gflags.DEFINE_string('wsapi_host', '', 'webapp listen host')
gflags.DEFINE_integer('wsapi_port', 8080, 'webapp listen port') gflags.DEFINE_integer('wsapi_port', 8080, 'webapp listen port')
HEX_PATTERN = r'0x[0-9a-z]+'
DIGIT_PATTERN = r'[1-9][0-9]*'
class ControllerBase(object): class ControllerBase(object):
special_vars = ['action', 'controller'] special_vars = ['action', 'controller']

View File

@ -18,7 +18,9 @@
# string representation is in hex without '0x' # string representation is in hex without '0x'
_DPID_LEN = 16 _DPID_LEN = 16
_DPID_FMT = '%0' + str(_DPID_LEN) + 'x' _DPID_LEN_STR = str(_DPID_LEN)
_DPID_FMT = '%0' + _DPID_LEN_STR + 'x'
DPID_PATTERN = r'[0-9a-f]{%d}' % _DPID_LEN
def dpid_to_str(dpid): def dpid_to_str(dpid):

View File

@ -16,6 +16,8 @@
import itertools import itertools
# string representation
HADDR_PATTERN = r'([0-9a-f]{2}:){5}[0-9a-f]{2}'
# Internal representation of mac address is string[6] # Internal representation of mac address is string[6]
_HADDR_LEN = 6 _HADDR_LEN = 6