summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2014-08-18 09:19:07 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-08-18 14:14:55 +0900
commitfc2b0b0f9c7d25ff41fe9f52086be5fe28bd7f3f (patch)
tree8100fdd905111561300242396d9e02c454ea1823
parent7a5b83daa6ea22938fcfbf177a94cacb4ff7aa7a (diff)
stringify: introduce _class_suffixes for easy jsonize
class variable '_class_suffixes' can be used for the same purpose as '_class_prefixes' but match with the suffix of the class name. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/lib/stringify.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ryu/lib/stringify.py b/ryu/lib/stringify.py
index f6b2dca4..1561ca35 100644
--- a/ryu/lib/stringify.py
+++ b/ryu/lib/stringify.py
@@ -105,6 +105,7 @@ class StringifyMixin(object):
"""
_class_prefixes = []
+ _class_suffixes = []
def stringify_attrs(self):
"""an override point for sub classes"""
@@ -133,6 +134,9 @@ class StringifyMixin(object):
for p in cls._class_prefixes:
if k.startswith(p):
return True
+ for p in cls._class_suffixes:
+ if k.endswith(p):
+ return True
return False
@classmethod