stream.py: Don't use class decorators.
authorReid Price <reid@nicira.com>
Wed, 17 Oct 2012 00:23:26 +0000 (17:23 -0700)
committerJustin Pettit <jpettit@nicira.com>
Wed, 17 Oct 2012 00:41:26 +0000 (17:41 -0700)
Commit 8cc820 (python/ovs/stream: teach stream.py tcp socket) made a
change that used class decorators.  Unfortunately, they were not
introduced until Python 2.6.  XenServer uses Python 2.4, so the change
caused some Python-based daemons not to start.  This commit uses an
alternate syntax suggested by Reid Price.

Bug #13580

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Reid Price <reid@nicira.com>
python/ovs/stream.py

index 8cc820282550c5c167d4ecbdbfe3dd555790c98b..6bd0ccbe8b22c931e07e22644de410631801f2d1 100644 (file)
@@ -344,16 +344,15 @@ Passive %s connection methods:
   punix:FILE              Listen on Unix domain socket FILE""" % (name, name)
 
 
-@Stream.register_method("unix")
 class UnixStream(Stream):
     @staticmethod
     def _open(suffix, dscp):
         connect_path = suffix
         return  ovs.socket_util.make_unix_socket(socket.SOCK_STREAM,
                                                  True, None, connect_path)
+UnixStream = Stream.register_method("unix")(UnixStream)
 
 
-@Stream.register_method("tcp")
 class TCPStream(Stream):
     @staticmethod
     def _open(suffix, dscp):
@@ -362,3 +361,4 @@ class TCPStream(Stream):
         if not error:
             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
         return error, sock
+TCPStream = Stream.register_method("tcp")(TCPStream)