Revision: 164
Author: janne.t.harkonen
Date: Sun Aug 26 21:30:03 2012
Log: make ClientConfiguration easier to initialize
http://code.google.com/p/robotframework-sshlibrary/source/detail?r=164
Modified:
/trunk/src/SSHLibrary/__init__.py
/trunk/src/SSHLibrary/core.py
=======================================
--- /trunk/src/SSHLibrary/__init__.py Fri Aug 24 05:10:16 2012
+++ /trunk/src/SSHLibrary/__init__.py Sun Aug 26 21:30:03 2012
@@ -148,8 +148,11 @@
| Open Connection | myhost.net | term_type=ansi | width=40 |
| ${id} = | Open Connection | myhost.net |
"""
+ timeout = timeout or self._config.timeout
+ newline = newline or self._config.newline
+ prompt = prompt or self._config.prompt
config = ClientConfig(host, alias, port, timeout, newline, prompt,
- term_type, width, height, self._config)
+ term_type, width, height)
return self._cache.register(SSHClient(config), config.alias)
def switch_connection(self, index_or_alias):
=======================================
--- /trunk/src/SSHLibrary/core.py Fri Aug 24 05:10:06 2012
+++ /trunk/src/SSHLibrary/core.py Sun Aug 26 21:30:03 2012
@@ -22,18 +22,18 @@
class ClientConfig(Configuration):
- def __init__(self, host, alias, port, timeout, newline, prompt,
- term_type, width, height, defaults):
+ def __init__(self, host, alias=None, port=22, timeout=3, newline='LF',
+ prompt=None, term_type='vt100', width=80, height=24):
Configuration.__init__(self,
host=StringEntry(host),
alias=StringEntry(alias),
- port=IntegerEntry(port or 22),
- timeout=TimeEntry(timeout or defaults.timeout),
- newline=NewlineEntry(newline or defaults.newline),
- prompt=StringEntry(prompt or defaults.prompt),
- term_type=StringEntry(term_type or 'vt100'),
- width=IntegerEntry(width or 80),
- height=IntegerEntry(height or 24))
+ port=IntegerEntry(port),
+ timeout=TimeEntry(timeout),
+ newline=NewlineEntry(newline),
+ prompt=StringEntry(prompt),
+ term_type=StringEntry(term_type),
+ width=IntegerEntry(width),
+ height=IntegerEntry(height))
class SSHClientException(RuntimeError):