← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/kill-xmlrpc-export into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/kill-xmlrpc-export into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jtv/maas/kill-xmlrpc-export/+merge/119918

Profiling guided me towards this one.  All in all, our test coverage seems to be very high — with some notable gaps in the worker code, probably because we get too close to the metal.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/kill-xmlrpc-export/+merge/119918
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/kill-xmlrpc-export into lp:maas.
=== modified file 'src/provisioningserver/utils.py'
--- src/provisioningserver/utils.py	2012-08-15 07:53:03 +0000
+++ src/provisioningserver/utils.py	2012-08-16 13:10:35 +0000
@@ -18,7 +18,6 @@
     "MainScript",
     "parse_key_value_file",
     "ShellTemplate",
-    "xmlrpc_export",
     ]
 
 from argparse import ArgumentParser
@@ -37,7 +36,6 @@
 from provisioningserver.config import Config
 import tempita
 from twisted.internet.defer import maybeDeferred
-from zope.interface.interface import Method
 
 
 def deferred(func):
@@ -52,28 +50,6 @@
     return wrapper
 
 
-def xmlrpc_export(iface):
-    """Class decorator to alias methods of a class with an "xmlrpc_" prefix.
-
-    For each method defined in the given interface, the concrete method in the
-    decorated class is copied to a new name of "xmlrpc_%(original_name)s". In
-    combination with :class:`XMLRPC`, and the rest of the Twisted stack, this
-    has the effect of exposing the method via XML-RPC.
-
-    The decorated class must implement `iface`.
-    """
-    def decorate(cls):
-        assert iface.implementedBy(cls), (
-            "%s does not implement %s" % (cls.__name__, iface.__name__))
-        for name in iface:
-            element = iface[name]
-            if isinstance(element, Method):
-                method = getattr(cls, name)
-                setattr(cls, "xmlrpc_%s" % name, method)
-        return cls
-    return decorate
-
-
 def _write_temp_file(content, filename):
     """Write the given `content` in a temporary file next to `filename`."""
     # Write the file to a temporary place (next to the target destination,