Revision: 2062
Author: pekka.klarck
Date: Mon Jul 27 05:36:36 2009
Log: Implemented converting values given to Set Environment Variable to  
strings automatically (issue 354).
http://code.google.com/p/robotframework/source/detail?r=2062

Modified:
  /trunk/src/robot/libraries/OperatingSystem.py

=======================================
--- /trunk/src/robot/libraries/OperatingSystem.py       Sun Apr 19 13:26:54 2009
+++ /trunk/src/robot/libraries/OperatingSystem.py       Mon Jul 27 05:36:36 2009
@@ -27,7 +27,6 @@
      from robot.utils import get_version, ConnectionCache, seq2str, \
          timestr_to_secs, secs_to_timestr, plural_or_not, get_time, \
          secs_to_timestamp, timestamp_to_secs
-
      __version__ = get_version()
      PROCESSES = ConnectionCache('No active processes')

@@ -851,7 +850,16 @@
          return ret

      def set_environment_variable(self, name, value):
-        """Sets an environment variable to a specified value."""
+        """Sets an environment variable to a specified value.
+
+        Starting from Robot Framework 2.1.1, values are converted to  
strings
+        automatically.
+        """
+        # Cannot convert to Unicode because they aren't generally  
supported in
+        # environment variables, but don't want to change deliberately  
given
+        # Unicode strings either.
+        if not isinstance(value, basestring):
+            value = str(value)
          os.environ[name] = value
          self._info("Environment variable '%s' set to value '%s'" % (name,  
value))


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"robotframework-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/robotframework-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to