Revision: 88b3ece09ed8
Branch: default
Author: Mikko Korpela <[email protected]>
Date: Tue Mar 12 05:40:41 2013
Log: Add support to use scalar variables as list variables
http://code.google.com/p/robotframework/source/detail?r=88b3ece09ed8
Modified:
/src/robot/variables/variables.py
=======================================
--- /src/robot/variables/variables.py Wed Jan 9 06:43:16 2013
+++ /src/robot/variables/variables.py Tue Mar 12 05:40:41 2013
@@ -27,7 +27,7 @@
from robot.errors import DataError
from robot.output import LOGGER
-from .isvar import is_var, is_scalar_var
+from .isvar import is_var, is_scalar_var, is_list_var
from .variablesplitter import VariableSplitter
@@ -73,9 +73,11 @@
except ValueError:
try: return self._get_list_var_as_scalar(name)
except ValueError:
- try: return self._get_extended_var(name)
+ try: return self._get_scalar_as_list_var(name)
except ValueError:
- raise DataError("Non-existing variable '%s'." %
name)
+ try: return self._get_extended_var(name)
+ except ValueError:
+ raise DataError("Non-existing
variable '%s'." % name)
def _validate_var_name(self, name):
if not is_var(name):
@@ -93,6 +95,16 @@
pass
raise ValueError
+ def _get_scalar_as_list_var(self, name):
+ if is_list_var(name):
+ try:
+ value =
utils.NormalizedDict.__getitem__(self, '$'+name[1:])
+ iter(value)
+ return value
+ except KeyError, TypeError:
+ pass
+ raise ValueError
+
def _get_extended_var(self, name):
err_pre = "Resolving variable '%s' failed: " % name
res = self._extended_var_re.search(name)
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.