[FIX] Load the C Library of strptime
authorStephane Wirtel <stephane@openerp.com>
Thu, 16 Dec 2010 14:41:39 +0000 (15:41 +0100)
committerStephane Wirtel <stephane@openerp.com>
Thu, 16 Dec 2010 14:41:39 +0000 (15:41 +0100)
Because this strptime function does a lazy load of
the library we can have a bug if we use the strptime in the expression

bzr revid: stephane@openerp.com-20101216144139-14ln2c0xyqy2y38t

bin/tools/safe_eval.py

index ce89a3c..665b534 100644 (file)
@@ -269,6 +269,8 @@ def safe_eval(expr, globals_dict=None, locals_dict=None, mode="eval", nocopy=Fal
                 'set' : set
             }
     )
+
+    import _strptime
     return eval(test_expr(expr,_SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: