5 new revisions:

Revision: c0a85b2bba65
Author:   Anssi Syrjäsalo <anssi.syrjas...@eficode.com>
Date:     Wed Jul 10 05:27:17 2013
Log:      Fixed encoding argument position
http://code.google.com/p/robotframework-sshlibrary/source/detail?r=c0a85b2bba65

Revision: 5c5dede50a88
Author:   Anssi Syrjäsalo <anssi.syrjas...@eficode.com>
Date:     Wed Jul 10 06:25:04 2013
Log:      Fixed a typo in docstring
http://code.google.com/p/robotframework-sshlibrary/source/detail?r=5c5dede50a88

Revision: d7739cb6433b
Author:   Anssi Syrjäsalo <anssi.syrjas...@eficode.com>
Date:     Wed Jul 10 06:25:57 2013
Log:      Updated docs to mention the encoding setting
http://code.google.com/p/robotframework-sshlibrary/source/detail?r=d7739cb6433b

Revision: de075e289633
Author:   Anssi Syrjäsalo <anssi.syrjas...@eficode.com>
Date:     Wed Jul 10 06:27:03 2013
Log:      General refactoring of method/variable names
http://code.google.com/p/robotframework-sshlibrary/source/detail?r=de075e289633

Revision: ec52c500dfce
Author:   Anssi Syrjäsalo <anssi.syrjas...@eficode.com>
Date:     Wed Jul 10 06:27:15 2013
Log:      UTF-8 is the default setting
http://code.google.com/p/robotframework-sshlibrary/source/detail?r=ec52c500dfce

==============================================================================
Revision: c0a85b2bba65
Author:   Anssi Syrjäsalo <anssi.syrjas...@eficode.com>
Date:     Wed Jul 10 05:27:17 2013
Log:      Fixed encoding argument position

http://code.google.com/p/robotframework-sshlibrary/source/detail?r=c0a85b2bba65

Modified:
 /src/SSHLibrary/abstractclient.py
 /src/SSHLibrary/library.py

=======================================
--- /src/SSHLibrary/abstractclient.py   Wed Jul 10 05:02:36 2013
+++ /src/SSHLibrary/abstractclient.py   Wed Jul 10 05:27:17 2013
@@ -33,8 +33,8 @@
 class ClientConfig(Configuration):

     def __init__(self, host, alias=None, port=22, timeout=3, newline='LF',
- prompt=None, encoding='utf-8', term_type='vt100', width=80,
-                 height=24):
+                 prompt=None, term_type='vt100', width=80, height=24,
+                 encoding='UTF-8'):
         Configuration.__init__(self,
                 host=StringEntry(host),
                 alias=StringEntry(alias),
@@ -42,10 +42,10 @@
                 timeout=TimeEntry(timeout),
                 newline=NewlineEntry(newline),
                 prompt=StringEntry(prompt),
-                encoding=StringEntry(encoding),
                 term_type=StringEntry(term_type),
                 width=IntegerEntry(width),
-                height=IntegerEntry(height))
+                height=IntegerEntry(height),
+                encoding=StringEntry(encoding))


 class AbstractSSHClient(object):
@@ -55,11 +55,11 @@
     """

     def __init__(self, host, alias=None, port=22, timeout=3, newline='LF',
- prompt=None, encoding='utf-8', term_type='vt100', width=80,
-                 height=24):
+                 prompt=None, term_type='vt100', width=80, height=24,
+                 encoding='UTF-8'):
         """Create new SSHClient based on arguments."""
         self.config = ClientConfig(host, alias, port, timeout, newline,
- prompt, encoding, term_type, width, height) + prompt, term_type, width, height, encoding)
         self.client = self._create_client()
         self._commands = []

@@ -135,6 +135,7 @@

     def start_command(self, command):
         """Execute given command over existing connection."""
+        command = command.encode(self.config.encoding)
         self._commands.append(self._start_command(command))

     def read_command_output(self):
@@ -150,6 +151,7 @@
         :param str text: the text to be written, must be ASCII.
:param bool add_newline: if True, a newline will be added to `text`.
         """
+        text = text.encode(self.config.encoding)
         self._ensure_prompt_is_set()
         if add_newline:
             text += self.config.newline
=======================================
--- /src/SSHLibrary/library.py  Wed Jul 10 05:02:36 2013
+++ /src/SSHLibrary/library.py  Wed Jul 10 05:27:17 2013
@@ -56,12 +56,12 @@
     ROBOT_LIBRARY_SCOPE = 'GLOBAL'
     ROBOT_LIBRARY_VERSION = __version__

-    def __init__(self, timeout=3, newline='LF', prompt=None,
-                 encoding='utf-8', loglevel='INFO'):
+ def __init__(self, timeout=3, newline='LF', prompt=None, loglevel='INFO',
+                 encoding='UTF-8'):
         """SSH Library allows some import time configuration.

-        `timeout`, `newline` and `prompt` set default values for new
-        connections opened with `Open Connection`. The default values may
+ `timeout`, `newline`, `prompt` and `encoding` set default values for + new connections opened with `Open Connection`. The default values may
         later be changed using `Set Default Configuration` and settings
         of a single connection with `Set Client Configuration`.

@@ -82,7 +82,7 @@
         return self._cache.current

     def set_default_configuration(self, timeout=None, newline=None,
- prompt=None, encoding=None, loglevel=None): + prompt=None, loglevel=None, encoding=None):
         """Update the default configuration values.

         Only parameters whose value is other than `None` are updated.
@@ -94,8 +94,8 @@
                             loglevel=loglevel, encoding=encoding)

def set_client_configuration(self, timeout=None, newline=None, prompt=None, - encoding=None, term_type='vt100', width=80,
-                                 height=24):
+                                 term_type='vt100', width=80, height=24,
+                                 encoding=None):
         """Update the client configuration values.

         Works on the currently selected connection. At least one connection
@@ -107,13 +107,13 @@
             | Set Client Configuration | term_type=ansi | timeout=2 hours |
         """
         self.ssh_client.config.update(timeout=timeout, newline=newline,
-                                      prompt=prompt, encoding=encoding,
-                                      term_type=term_type,
-                                      width=width, height=height)
+                                      prompt=prompt, term_type=term_type,
+                                      width=width, height=height,
+                                      encoding=encoding)

     def open_connection(self, host, alias=None, port=22, timeout=None,
-                        newline=None, prompt=None, encoding=None,
-                        term_type='vt100', width=80, height=24):
+ newline=None, prompt=None, term_type='vt100', width=80,
+                        height=24, encoding=None):
         """Opens a new SSH connection to given `host` and `port`.

         Possible already opened connections are cached.
@@ -149,7 +149,7 @@
         prompt = prompt or self._config.prompt
         encoding = encoding or self._config.encoding
         client = SSHClient(host, alias, port, timeout, newline, prompt,
-                           encoding, term_type, width, height)
+                           term_type, width, height, encoding)
         return self._cache.register(client, alias)

     def get_connection_id(self):
@@ -323,7 +323,6 @@
         """
         self._info("Executing command '%s'" % command)
opts = self._output_options(return_stdout, return_stderr, return_rc)
-        command = command.encode(self._config.encoding)
         stdout, stderr, rc = self.ssh_client.execute_command(command)
         return self._return_command_output(stdout, stderr, rc, *opts)

@@ -405,7 +404,6 @@
     def _write(self, text, add_newline=False):
         self._info("Writing %s" % text)
         try:
-            text = text.encode(self._config.encoding)
             self.ssh_client.write(text, add_newline)
         except SSHClientException, e:
             raise RuntimeError(e)

==============================================================================
Revision: 5c5dede50a88
Author:   Anssi Syrjäsalo <anssi.syrjas...@eficode.com>
Date:     Wed Jul 10 06:25:04 2013
Log:      Fixed a typo in docstring

http://code.google.com/p/robotframework-sshlibrary/source/detail?r=5c5dede50a88

Modified:
 /src/SSHLibrary/abstractclient.py

=======================================
--- /src/SSHLibrary/abstractclient.py   Wed Jul 10 05:27:17 2013
+++ /src/SSHLibrary/abstractclient.py   Wed Jul 10 06:25:04 2013
@@ -76,7 +76,7 @@
         """Log SSH events to file.

         :param path: A filename where the log events are written
-        :returns: Whether logging was succesfully enabled.
+        :returns: Whether logging was successfully enabled.
         """
         raise NotImplementedError


==============================================================================
Revision: d7739cb6433b
Author:   Anssi Syrjäsalo <anssi.syrjas...@eficode.com>
Date:     Wed Jul 10 06:25:57 2013
Log:      Updated docs to mention the encoding setting

http://code.google.com/p/robotframework-sshlibrary/source/detail?r=d7739cb6433b

Modified:
 /src/SSHLibrary/abstractclient.py
 /src/SSHLibrary/library.py

=======================================
--- /src/SSHLibrary/abstractclient.py   Wed Jul 10 06:25:04 2013
+++ /src/SSHLibrary/abstractclient.py   Wed Jul 10 06:25:57 2013
@@ -148,7 +148,7 @@
     def write(self, text, add_newline=False):
         """Write `text` in shell session.

-        :param str text: the text to be written, must be ASCII.
+        :param str text: the text to be written
:param bool add_newline: if True, a newline will be added to `text`.
         """
         text = text.encode(self.config.encoding)
=======================================
--- /src/SSHLibrary/library.py  Wed Jul 10 05:27:17 2013
+++ /src/SSHLibrary/library.py  Wed Jul 10 06:25:57 2013
@@ -126,9 +126,9 @@
         switching between connections similarly as the index. See `Switch
         Connection` for more details about that.

- If `timeout`, `newline` or `prompt` are not given, the default values
-        set in `library importing` are used. See also `Set Default
-        Configuration`.
+        If `timeout`, `newline`, `prompt` or `encoding` are not given,
+        the default values set in `library importing` are used.
+        See also `Set Default Configuration`.

         Starting from SSHLibrary 1.1, a shell session is also opened
automatically by this keyword. `term_type` defines the terminal type

==============================================================================
Revision: de075e289633
Author:   Anssi Syrjäsalo <anssi.syrjas...@eficode.com>
Date:     Wed Jul 10 06:27:03 2013
Log:      General refactoring of method/variable names

http://code.google.com/p/robotframework-sshlibrary/source/detail?r=de075e289633

Modified:
 /src/SSHLibrary/abstractclient.py
 /src/SSHLibrary/javaclient.py
 /src/SSHLibrary/library.py
 /src/SSHLibrary/pythonclient.py

=======================================
--- /src/SSHLibrary/abstractclient.py   Wed Jul 10 06:25:57 2013
+++ /src/SSHLibrary/abstractclient.py   Wed Jul 10 06:27:03 2013
@@ -427,4 +427,4 @@

         :return: a 3-tuple of stdout, stderr and return code.
         """
-        return self._read_outputs()
+        raise NotImplementedError
=======================================
--- /src/SSHLibrary/javaclient.py       Wed Jul 10 05:02:36 2013
+++ /src/SSHLibrary/javaclient.py       Wed Jul 10 06:27:03 2013
@@ -155,10 +155,7 @@

 class RemoteCommand(AbstractCommand):

-    def _execute(self):
-        self._session.execCommand(self._command)
-
-    def _read_outputs(self):
+    def read_outputs(self):
         stdout = self._read_from_stream(self._session.getStdout())
         stderr = self._read_from_stream(self._session.getStderr())
         rc = self._session.getExitStatus()
@@ -173,3 +170,6 @@
             result += line + '\n'
             line = reader.readLine()
         return result
+
+    def _execute(self):
+        self._session.execCommand(self._command)
=======================================
--- /src/SSHLibrary/library.py  Wed Jul 10 06:25:57 2013
+++ /src/SSHLibrary/library.py  Wed Jul 10 06:27:03 2013
@@ -339,7 +339,7 @@
         | Start Command | some command |
         """
         self._info("Starting command '%s'" % command)
-        self._command = command
+        self._last_command = command
         self.ssh_client.start_command(command)

     def read_command_output(self, return_stdout=True, return_stderr=False,
@@ -352,7 +352,7 @@
         See `Execute Command` for examples about how the return value can
be configured using `return_stdout`, `return_stderr` and `return_rc`.
         """
-        self._info("Reading output of command '%s'" % self._command)
+        self._info("Reading output of command '%s'" % self._last_command)
opts = self._output_options(return_stdout, return_stderr, return_rc)
         stdout, stderr, rc = self.ssh_client.read_command_output()
         return self._return_command_output(stdout, stderr, rc, *opts)
@@ -368,8 +368,8 @@
             return True, True, rc
         return stdout, stderr, rc

-    def _return_command_output(self, stdout, stderr, rc,
-                               return_stdout, return_stderr, return_rc):
+    def _return_command_output(self, stdout, stderr, rc, return_stdout,
+                               return_stderr, return_rc):
         ret = []
         if return_stdout:
             ret.append(stdout.rstrip('\n'))
=======================================
--- /src/SSHLibrary/pythonclient.py     Wed Jul 10 05:02:36 2013
+++ /src/SSHLibrary/pythonclient.py     Wed Jul 10 06:27:03 2013
@@ -148,12 +148,13 @@

 class RemoteCommand(AbstractCommand):

-    def _execute(self):
-        self._session.exec_command(self._command)
-
-    def _read_outputs(self):
+    def read_outputs(self):
stdout = self._session.makefile('rb', -1).read().decode(self._encoding) - stderr = self._session.makefile_stderr('rb', -1).read().decode(self._encoding)
+        stderr = self._session.makefile_stderr('rb', -1).read().decode(
+            self._encoding)
         rc = self._session.recv_exit_status()
         self._session.close()
         return stdout, stderr, rc
+
+    def _execute(self):
+        self._session.exec_command(self._command)

==============================================================================
Revision: ec52c500dfce
Author:   Anssi Syrjäsalo <anssi.syrjas...@eficode.com>
Date:     Wed Jul 10 06:27:15 2013
Log:      UTF-8 is the default setting

http://code.google.com/p/robotframework-sshlibrary/source/detail?r=ec52c500dfce

Modified:
 /src/SSHLibrary/library.py

=======================================
--- /src/SSHLibrary/library.py  Wed Jul 10 06:27:03 2013
+++ /src/SSHLibrary/library.py  Wed Jul 10 06:27:15 2013
@@ -615,4 +615,4 @@
                 newline=NewlineEntry(newline or 'LF'),
                 prompt=StringEntry(prompt),
                 loglevel=LogLevelEntry(loglevel or 'INFO'),
-                encoding=StringEntry(encoding))
+                encoding=StringEntry(encoding or 'UTF-8'))

--

--- 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 robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to