Rev 60: Get rid of the silly parameter order for server constructor. in file:///net/bigmamac/Volumes/home/vila/.bazaar/plugins/local_test_server/

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Feb 24 21:15:01 GMT 2009


At file:///net/bigmamac/Volumes/home/vila/.bazaar/plugins/local_test_server/

------------------------------------------------------------
revno: 60
revision-id: v.ladeuil+lp at free.fr-20090224211501-hmyvwxvfullemhoi
parent: v.ladeuil+lp at free.fr-20090224204704-tu83y5m3uoe91zrs
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: local_test_server
timestamp: Tue 2009-02-24 22:15:01 +0100
message:
  Get rid of the silly parameter order for server constructor.
  
  * server.py:
  (Server.__init__): Swap parameter order since *all* daughter
  classes were swapping them anyway.
-------------- next part --------------
=== modified file 'server.py'
--- a/server.py	2009-02-23 13:12:18 +0000
+++ b/server.py	2009-02-24 21:15:01 +0000
@@ -130,15 +130,15 @@
     # The command used to start the server
     _server_command_name = None
 
-    def __init__(self, config, port=-1):
+    def __init__(self, port, conf):
         self.host = 'localhost'
         if port == -1:
             # For tests only
             self.port = _get_available_port()
         else:
             self.port = port
-        config.values.update(host=self.host, port=self.port)
-        self.config = config
+        conf.values.update(host=self.host, port=self.port)
+        self.config = conf
 
     def is_installed(self):
         """Is the server installed.
@@ -398,11 +398,10 @@
 
     _stopped_re = re.compile("\[notice\] caught SIGTERM, shutting down$")
 
-    def __init__(self, port, _conf=None):
-        if _conf is None:
-            _conf = config.Apache2()
-        # FIXME: it's weird to reverse parameter order
-        super(Apache2, self).__init__(_conf, port)
+    def __init__(self, port, conf=None):
+        if conf is None:
+            conf = config.Apache2()
+        super(Apache2, self).__init__(port, conf)
         self.output_config_path = self.config.abspath('etc/apache2.conf')
 
     def _start(self):
@@ -448,19 +447,19 @@
 
 class Apache2DAV(Apache2):
 
-    def __init__(self, port, _conf=None):
-        if _conf is None:
-            _conf = config.Apache2DAV()
-        super(Apache2DAV, self).__init__(port, _conf=_conf)
+    def __init__(self, port, conf=None):
+        if conf is None:
+            conf = config.Apache2DAV()
+        super(Apache2DAV, self).__init__(port, conf)
         self.output_config_path = self.config.abspath('etc/apache2-dav.conf')
 
 
 class Apache2HTTPS(Apache2):
 
-    def __init__(self, port, _conf=None):
-        if _conf is None:
-            _conf = config.Apache2HTTPS()
-        super(Apache2HTTPS, self).__init__(port, _conf=_conf)
+    def __init__(self, port, conf=None):
+        if conf is None:
+            conf = config.Apache2HTTPS()
+        super(Apache2HTTPS, self).__init__(port, conf)
         self.output_config_path = self.config.abspath('etc/apache2-https.conf')
 
     def _start(self):
@@ -504,19 +503,19 @@
 
 class Apache2SVN(Apache2):
 
-    def __init__(self, port, _conf=None):
-        if _conf is None:
-            _conf = config.Apache2SVN()
-        super(Apache2SVN, self).__init__(port, _conf=_conf)
+    def __init__(self, port, conf=None):
+        if conf is None:
+            conf = config.Apache2SVN()
+        super(Apache2SVN, self).__init__(port, conf)
         self.output_config_path = self.config.abspath('etc/apache2-svn.conf')
 
 
 class Apache2Kerberos(Apache2):
 
-    def __init__(self, port, _conf=None):
-        if _conf is None:
-            _conf = config.Apache2Kerberos()
-        super(Apache2Kerberos, self).__init__(port, _conf=_conf)
+    def __init__(self, port, conf=None):
+        if conf is None:
+            conf = config.Apache2Kerberos()
+        super(Apache2Kerberos, self).__init__(port, conf)
         self.output_config_path = self.config.abspath('etc/apache2-krb5.conf')
 
     def is_installed(self):
@@ -529,11 +528,10 @@
 
     _server_command_name = 'cherokee'
 
-    def __init__(self, port, _conf=None):
-        if _conf is None:
-            _conf = config.Cherokee()
-        # FIXME: it's weird to reverse parameter order
-        super(Cherokee, self).__init__(_conf, port)
+    def __init__(self, port, conf=None):
+        if conf is None:
+            conf = config.Cherokee()
+        super(Cherokee, self).__init__(port, conf)
         self.output_config_path = self.config.abspath('etc/cherokee.conf')
 
     def _start(self):
@@ -557,11 +555,10 @@
 
     _started_re = re.compile("server started $") # Note the final space...
 
-    def __init__(self, port, _conf=None):
-        if _conf is None:
-            _conf = config.Lighttpd()
-        # FIXME: it's weird to reverse parameter order
-        super(Lighttpd, self).__init__(_conf, port)
+    def __init__(self, port, conf=None):
+        if conf is None:
+            conf = config.Lighttpd()
+        super(Lighttpd, self).__init__(port, conf)
         self.output_config_path = self.config.abspath('etc/lighttpd.conf')
 
     def _start(self):
@@ -603,10 +600,10 @@
 
 class LighttpdDAV(Lighttpd):
 
-    def __init__(self, port, _conf=None):
-        if _conf is None:
-            _conf = config.LighttpdDAV()
-        super(LighttpdDAV, self).__init__(port, _conf=_conf)
+    def __init__(self, port, conf=None):
+        if conf is None:
+            conf = config.LighttpdDAV()
+        super(LighttpdDAV, self).__init__(port, conf)
         self.output_config_path = self.config.abspath('etc/lighttpd-dav.conf')
 
 
@@ -614,11 +611,10 @@
 
     _server_command_name = 'vsftpd'
 
-    def __init__(self, port, _conf=None):
-        if _conf is None:
-            _conf = config.Vsftpd()
-        # FIXME: it's weird to reverse parameter order
-        super(Vsftpd, self).__init__(_conf, port)
+    def __init__(self, port, conf=None):
+        if conf is None:
+            conf = config.Vsftpd()
+        super(Vsftpd, self).__init__(port, conf)
         self.output_config_path = self.config.abspath('etc/vsftpd.conf')
 
     def is_installed(self):
@@ -660,11 +656,10 @@
 
     _server_command_name = 'proftpd'
 
-    def __init__(self, port, _conf=None):
-        if _conf is None:
-            _conf = config.Proftpd()
-        # FIXME: it's weird to reverse parameter order
-        super(Proftpd, self).__init__(_conf, port)
+    def __init__(self, port, conf=None):
+        if conf is None:
+            conf = config.Proftpd()
+        super(Proftpd, self).__init__(port, conf)
         self.output_config_path = self.config.abspath('etc/proftpd.conf')
 
     def is_installed(self):
@@ -704,11 +699,10 @@
     _server_command_name = 'muddleftpd'
     _ftpwho_command_name = 'ftpwho'
 
-    def __init__(self, port, _conf=None):
-        if _conf is None:
-            _conf = config.Muddleftpd()
-        # FIXME: it's weird to reverse parameter order
-        super(Muddleftpd, self).__init__(_conf, port)
+    def __init__(self, port, conf=None):
+        if conf is None:
+            conf = config.Muddleftpd()
+        super(Muddleftpd, self).__init__(port, conf)
         self.output_config_path = self.config.abspath('etc/muddleftpd.conf')
 
     def is_installed(self):



More information about the bazaar-commits mailing list