The screen parameter must be an integer.
I also chnaged it to variable parameter with the reasonable default.
---
repos/domain/screenshot.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/repos/domain/screenshot.py b/repos/domain/screenshot.py
index d73e980..3e727a7 100644
--- a/repos/domain/screenshot.py
+++ b/repos/domain/screenshot.py
@@ -7,8 +7,8 @@ import mimetypes
import libvirt
-required_params = ('guestname', 'screen', 'filename',)
-optional_params = ()
+required_params = ('guestname', 'filename',)
+optional_params = ('screen',)
def saver(stream, data, file_):
return file_.write(data)
@@ -24,7 +24,8 @@ def screenshot(params):
dom = conn.lookupByName(params['guestname'])
st = conn.newStream(0)
- mime = dom.screenshot(st, params['screen'], 0)
+ screen = params.get('screen', 0)
+ mime = dom.screenshot(st, int('screen'), 0)
ext = mimetypes.guess_extension(mime) or '.ppm'
filename = params['filename'] + ext
--
1.7.8.5
Show replies by date
The screen parameter must be an integer.
I also chnaged it to variable parameter with the reasonable default.
---
v2:
- fixed "'screen'" to "screen" (stupid typo)
repos/domain/screenshot.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/repos/domain/screenshot.py b/repos/domain/screenshot.py
index d73e980..3c0f85b 100644
--- a/repos/domain/screenshot.py
+++ b/repos/domain/screenshot.py
@@ -7,8 +7,8 @@ import mimetypes
import libvirt
-required_params = ('guestname', 'screen', 'filename',)
-optional_params = ()
+required_params = ('guestname', 'filename',)
+optional_params = ('screen',)
def saver(stream, data, file_):
return file_.write(data)
@@ -24,7 +24,8 @@ def screenshot(params):
dom = conn.lookupByName(params['guestname'])
st = conn.newStream(0)
- mime = dom.screenshot(st, params['screen'], 0)
+ screen = params.get('screen', 0)
+ mime = dom.screenshot(st, int(screen), 0)
ext = mimetypes.guess_extension(mime) or '.ppm'
filename = params['filename'] + ext
--
1.7.8.5
On 2012年04月13日 23:53, Martin Kletzander wrote:
The screen parameter must be an integer.
I also chnaged it to variable parameter with the reasonable default.
s/chnaged/changed/
ACK with the nit fixed.
Osier