Revision: e06f38a146b4
Branch:   default
Author:   Mika Hänninen <[email protected]>
Date:     Thu Apr 18 23:20:08 2013
Log:      connectioncache: added get_connection method
http://code.google.com/p/robotframework/source/detail?r=e06f38a146b4

Modified:
 /src/robot/utils/connectioncache.py

=======================================
--- /src/robot/utils/connectioncache.py Tue Mar  6 00:46:30 2012
+++ /src/robot/utils/connectioncache.py Thu Apr 18 23:20:08 2013
@@ -51,6 +51,16 @@
     def switch(self, index_or_alias):
         """Switches to the connection specified by given index or alias.

+ If alias is given it must be a string. Indexes can be either integers
+        or strings that can be converted into integer. Raises RuntimeError
+        if no connection with given index or alias found.
+        """
+ self.current, self.current_index = self.get_connection(index_or_alias)
+        return self.current
+
+    def get_connection(self, index_or_alias):
+        """Get the connection specified by given index or alias.
+
If alias is given it must be a string. Indexes can be either integers
         or strings that can be converted into integer. Raises RuntimeError
         if no connection with given index or alias found.
@@ -59,9 +69,7 @@
             index = self._get_index(index_or_alias)
         except ValueError:
raise RuntimeError("Non-existing index or alias '%s'" % index_or_alias)
-        self.current = self._connections[index-1]
-        self.current_index = index
-        return self.current
+        return self._connections[index-1], index

     def close_all(self, closer_method='close'):
         """Closes connections using given closer method and empties cache.

--

--- 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.


Reply via email to