]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Replace to_dict() calls with a function decorator
authorJohn Schwarz <jschwarz@redhat.com>
Mon, 27 Jul 2015 09:09:10 +0000 (12:09 +0300)
committerJohn Schwarz <jschwarz@redhat.com>
Mon, 3 Aug 2015 08:42:25 +0000 (11:42 +0300)
commit12ff4d6b5890c2fd1e0a3e58f974be3e1f1465ca
treeba5c0ab6867ff3e50ec55026037b647dd9e9b39b
parentb0fd13daefe360cffb488824576889ef4e73d9d4
Replace to_dict() calls with a function decorator

Up until now, API server functions would need to return simple iterable
objects, such as dicts and lists of dicts. This patch introduces a
decorator which allows such functions to return non-simple objects (as
long as the returned object implements the 'to_dict()' method, or is a
list of such objects) and converts them on its own, simplifying the
user's code and removing code duplication.

Change-Id: Ib30a9213b86b33826291197cf01f00bc1dd3db52
neutron/db/db_base_plugin_common.py
neutron/services/qos/qos_plugin.py
neutron/tests/unit/db/test_db_base_plugin_common.py