From cac13a1da36bf76bf475ec1cdd7bcb8572bf45c9 Mon Sep 17 00:00:00 2001 From: inpos Date: Tue, 14 Aug 2018 15:04:52 +0300 Subject: [PATCH] add regexp by Ext.re('/regexp/i') --- orun/extjs/base.py | 3 +++ orun/js.py | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/orun/extjs/base.py b/orun/extjs/base.py index 1ef6229..2374d9d 100644 --- a/orun/extjs/base.py +++ b/orun/extjs/base.py @@ -36,6 +36,9 @@ def getCmp(id): def getBody(): return js.JsNode('Ext.getBody()') +def re(pattern): + return js.RE(pattern) + tip = js.JsNode('Ext.tip') class Component(js.JsObject): diff --git a/orun/js.py b/orun/js.py index 7b0e904..c2cbcf5 100644 --- a/orun/js.py +++ b/orun/js.py @@ -7,10 +7,9 @@ js_ajax = None live_methods = {} -class STUB: - def stub_method(self): - pass -stub_class = STUB() +class RE: + def __init__(self, re): + self.re = re class FuncWithParams: def __init__(self, func, args = [], params = {}): @@ -28,6 +27,8 @@ def dict2extjs(d): def encode(o): if isinstance(o, JsNode): return str(o) + if isinstance(o, RE): + return o.re elif isinstance(o, (list, tuple)): return list2extjs(o) elif isinstance(o, bool):