]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove unused serialize_args method
authorGorka Eguileor <geguileo@redhat.com>
Tue, 14 Jul 2015 18:40:58 +0000 (20:40 +0200)
committerGorka Eguileor <geguileo@redhat.com>
Tue, 14 Jul 2015 18:40:58 +0000 (20:40 +0200)
In cinder/objects/base.py there is a method called serialize_args that
is unused.  It looks like a leftover from when we didn't use Versioned
Object Serializer.

This patch removes this method.

Change-Id: I3e0ad4e6c037def7d5aa56e7f0552453618d164d

cinder/objects/base.py

index 240cb61793263e7a70b08e2420596b9b642dd302..dfb1d67382f240cce0b4318eb9d395069567aa53 100644 (file)
 
 import contextlib
 import datetime
-import functools
-import traceback
 
 from oslo_log import log as logging
 from oslo_versionedobjects import base
 from oslo_versionedobjects import fields
-import six
 
 from cinder import exception
 from cinder import objects
@@ -144,27 +141,3 @@ class ObjectListBase(base.ObjectListBase):
 
 class CinderObjectSerializer(base.VersionedObjectSerializer):
     OBJ_BASE_CLASS = CinderObject
-
-
-def serialize_args(fn):
-    """Decorator that will do the arguments serialization before remoting."""
-    def wrapper(obj, *args, **kwargs):
-        for kw in kwargs:
-            value_arg = kwargs.get(kw)
-            if kw == 'exc_val' and value_arg:
-                kwargs[kw] = str(value_arg)
-            elif kw == 'exc_tb' and (
-                    not isinstance(value_arg, six.string_types) and value_arg):
-                kwargs[kw] = ''.join(traceback.format_tb(value_arg))
-            elif isinstance(value_arg, datetime.datetime):
-                kwargs[kw] = value_arg.isoformat()
-        if hasattr(fn, '__call__'):
-            return fn(obj, *args, **kwargs)
-        # NOTE(danms): We wrap a descriptor, so use that protocol
-        return fn.__get__(None, obj)(*args, **kwargs)
-
-    # NOTE(danms): Make this discoverable
-    wrapper.remotable = getattr(fn, 'remotable', False)
-    wrapper.original_fn = fn
-    return (functools.wraps(fn)(wrapper) if hasattr(fn, '__call__')
-            else classmethod(wrapper))