[kupfer: 1/4] obj.hosts.HostLeaf: allow to put custom slots in obj constructor



commit dc8c1786071910d8e734713963bf2cb3ffba428c
Author: Karol BÄ?dkowski <karol bedkowski gmail com>
Date:   Thu May 6 14:54:57 2010 +0200

    obj.hosts.HostLeaf: allow to put custom slots in obj constructor

 kupfer/obj/hosts.py |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/kupfer/obj/hosts.py b/kupfer/obj/hosts.py
index cc1a5db..912ab3c 100644
--- a/kupfer/obj/hosts.py
+++ b/kupfer/obj/hosts.py
@@ -5,7 +5,7 @@ Kupfer's Hosts API
 Main definition and *constructor* classes.
 """
 
-from kupfer.obj.grouping import GroupingLeaf 
+from kupfer.obj.grouping import GroupingLeaf
 
 __author__ = ("Ulrik Sverdrup <ulrik sverdrup gmail com>, "
               "Karol BÄ?dkowski <karol bedkowsk+gh gmail com>" )
@@ -16,6 +16,7 @@ HOST_SERVICE_NAME_KEY = "HOST_SERVICE_NAME"
 HOST_SERVICE_PORT_KEY = "HOST_SERVICE_PORT"
 HOST_SERVICE_USER_KEY = "HOST_SERVICE_USER"
 HOST_SERVICE_PASS_KEY = "HOST_SERVICE_PASS"
+HOST_SERVICE_REMOTE_PATH_KEY = "HOST_SERVICE_REMOTE_PATH"
 
 
 class HostLeaf(GroupingLeaf):
@@ -27,9 +28,9 @@ class HostLeaf(GroupingLeaf):
 
 class HostServiceLeaf(HostLeaf):
 	''' Leaf dedicated for well known services like ftp, ssh, vnc '''
-	def __init__(self, name, address, service, description, port=None, 
-			user=None, password=None ):
-		slots = {
+	def __init__(self, name, address, service, description, port=None,
+			user=None, password=None, slots=None):
+		_slots = {
 			HOST_NAME_KEY: name,
 			HOST_ADDRESS_KEY: address,
 			HOST_SERVICE_NAME_KEY: service,
@@ -37,7 +38,9 @@ class HostServiceLeaf(HostLeaf):
 			HOST_SERVICE_USER_KEY: user,
 			HOST_SERVICE_PASS_KEY: password,
 		}
-		HostLeaf.__init__(self, slots, name or address)
+		if slots:
+			_slots.update(slots)
+		HostLeaf.__init__(self, _slots, name or address)
 		self._description = description
 
 	def get_description(self):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]