src/pyams_utils/tales.py
changeset 201 8953ed9beeba
parent 87 ea6759f5c279
child 216 8a6c250fe655
--- a/src/pyams_utils/tales.py	Sun Jun 17 16:31:07 2018 +0200
+++ b/src/pyams_utils/tales.py	Tue Jun 19 11:54:53 2018 +0200
@@ -56,11 +56,16 @@
         if arg.startswith('"') or arg.startswith("'"):
             # may be a quoted string...
             return arg[1:-1]
-        args = arg.split('.')
-        result = econtext.get(args.pop(0))
-        for arg in args:
-            result = getattr(result, arg)
-        return result
+        try:
+            arg = int(arg)  # check integer value
+        except ValueError:
+            args = arg.split('.')
+            result = econtext.get(args.pop(0))
+            for arg in args:
+                result = getattr(result, arg)
+            return result
+        else:
+            return arg
 
     name = name.strip()
     context = econtext.get('context')