Expression value column widget problem - Printable Version +- TACTIC Open Source (http://forum.southpawtech.com) +-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3) +--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4) +--- Thread: Expression value column widget problem (/showthread.php?tid=95) Pages:
1
2
|
RE: Expression value column widget problem - EricTsuei - 04-22-2020 this bug happens after save and refresh pages, not happens while just save. RE: Expression value column widget problem - remkonoteboom - 04-23-2020 It's possible that it TACTIC is caching the value and is pulling the value from the cache. The expression language is heavily cached and which will speed up repeated expressions considerably. Try replacing this: value = Search.eval(value, env_sobjects=env_sobjects) with: from pyasm.biz import ExpressionParser parser = ExpressionParser() parser.eval(value, env_sobjects=env_sobjects, use_cache=False) and let me know if this fixes the problem. RE: Expression value column widget problem - EricTsuei - 04-24-2020 sorry, but this code can't works. give me error RE: Expression value column widget problem - EricTsuei - 04-24-2020 I have try both of these code. both can't work. from pyasm.biz import ExpressionParser parser = ExpressionParser() parser.eval(value, env_sobjects=env_sobjects, use_cache=False) from pyasm.biz import ExpressionParser parser = ExpressionParser() value = parser.eval(value, env_sobjects=env_sobjects, use_cache=False) RE: Expression value column widget problem - EricTsuei - 04-24-2020 when I replace this value = parser.eval(value, env_sobjects=env_sobjects, use_cache=False) with this value = parser.eval(value, env_sobjects=env_sobjects) this code can run, but the results are the same as using Search.eval(). I have found a todo in expression_test.py TODO: add a use_cache=False kwargs to eval() maybe I am using tactic 4.5, use_cache kwargs not add yet? def _test_cache(my): expr = '@COUNT(unittest/person)' parser = ExpressionParser() result = parser.eval(expr, single=True) my.assertEquals(result, 8) person = Person.create( "new_person" , "Mr", "Z" , "Fake Unittest Person Z") person.set_value("age", "300") person.commit() """TODO: add a use_cache=False kwargs to eval() expr = '@SOBJECT( unittest/person)' search = Search('unittest/person') print "LEN ", len(search.get_sobjects()) parser = ExpressionParser() result = parser.eval(expr) print "RES ", result my.assertEquals(len(result), 9) """ RE: Expression value column widget problem - remkonoteboom - 04-24-2020 Yes. I checked the code and the use_cache kwarg is not in 4.5. There is another way, but it is a bit of a blunt instrument. You can clear the entire expression cache using. parser = ExpressionParser() parser.clear_cache() result = parser.eval(expr) The only impact is performance if a large number of similar expressions are called. This is why the use_cache kwarg is better, but clear_cache is available in 4.5 and if isolated to ExpressionValueWdg, it's not so bad. RE: Expression value column widget problem - EricTsuei - 04-26-2020 ok, seems works now. Thanks |