Here's updated one. >From 47245dc8a6aa97bbe5dcd2506b0f3ce196dbda91 Mon Sep 17 00:00:00 2001 Message-Id: <47245dc8a6aa97bbe5dcd2506b0f3ce196dbda91.1351198185.git.yamah...@valinux.co.jp> In-Reply-To: <[email protected]> References: <[email protected]> From: Isaku Yamahata <[email protected]> Date: Tue, 7 Aug 2012 17:07:59 +0900 Subject: [PATCH] wsgi/routes: add regex pattern for each REST component
Signed-off-by: Isaku Yamahata <[email protected]> --- ryu/app/wsgi.py | 4 ++++ ryu/lib/dpid.py | 4 +++- ryu/lib/mac.py | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ryu/app/wsgi.py b/ryu/app/wsgi.py index e21a5cb..3880992 100644 --- a/ryu/app/wsgi.py +++ b/ryu/app/wsgi.py @@ -29,6 +29,10 @@ gflags.DEFINE_string('wsapi_host', '', 'webapp listen host') 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): special_vars = ['action', 'controller'] diff --git a/ryu/lib/dpid.py b/ryu/lib/dpid.py index 8c8bf75..1224ae0 100644 --- a/ryu/lib/dpid.py +++ b/ryu/lib/dpid.py @@ -18,7 +18,9 @@ # string representation is in hex without '0x' _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): diff --git a/ryu/lib/mac.py b/ryu/lib/mac.py index 2082643..3cb2df3 100644 --- a/ryu/lib/mac.py +++ b/ryu/lib/mac.py @@ -16,6 +16,8 @@ import itertools +# string representation +HADDR_PATTERN = r'([0-9a-f]{2}:){5}[0-9a-f]{2}' # Internal representation of mac address is string[6] _HADDR_LEN = 6 -- 1.7.10.4 -- yamahata ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
