Merge lp:~cjwatson/lazr.restful/py3-params-ordering into lp:lazr.restful

Proposed by Colin Watson
Status: Merged
Merged at revision: 292
Proposed branch: lp:~cjwatson/lazr.restful/py3-params-ordering
Merge into: lp:lazr.restful
Diff against target: 79 lines (+14/-5)
4 files modified
NEWS.rst (+7/-0)
setup.py (+1/-1)
src/lazr/restful/declarations.py (+3/-2)
src/lazr/restful/docs/webservice-declarations.rst (+3/-2)
To merge this branch: bzr merge lp:~cjwatson/lazr.restful/py3-params-ordering
Reviewer Review Type Date Requested Status
Cristian Gonzalez (community) Approve
Review via email: mp+398129@code.launchpad.net

Commit message

Preserve specified parameter ordering in export_factory_operation.

Description of the change

Preserve specified parameter ordering in export_factory_operation and BaseResourceOperationAdapter. This can make a difference when creating objects, by ensuring that validators are called in the correct order.

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS.rst'
--- NEWS.rst 2021-01-21 14:33:34 +0000
+++ NEWS.rst 2021-02-16 16:53:00 +0000
@@ -2,6 +2,13 @@
2NEWS for lazr.restful2NEWS for lazr.restful
3=====================3=====================
44
51.0.1
6=====
7
8Preserve specified parameter ordering in ``export_factory_operation`` and
9``BaseResourceOperationAdapter``. This can make a difference when creating
10objects, by ensuring that validators are called in the correct order.
11
51.0.0 (2021-01-21)121.0.0 (2021-01-21)
6==================13==================
714
815
=== modified file 'setup.py'
--- setup.py 2021-01-21 11:48:06 +0000
+++ setup.py 2021-02-16 16:53:00 +0000
@@ -61,7 +61,7 @@
61 'pytz',61 'pytz',
62 'setuptools',62 'setuptools',
63 'simplejson>=2.1.0',63 'simplejson>=2.1.0',
64 'six>=1.12.0',64 'six>=1.13.0',
65 'testtools',65 'testtools',
66 'van.testing',66 'van.testing',
67 'wsgiref; python_version < "3"',67 'wsgiref; python_version < "3"',
6868
=== modified file 'src/lazr/restful/declarations.py'
--- src/lazr/restful/declarations.py 2020-08-17 11:46:51 +0000
+++ src/lazr/restful/declarations.py 2021-02-16 16:53:00 +0000
@@ -43,6 +43,7 @@
43 'webservice_error',43 'webservice_error',
44 ]44 ]
4545
46from collections import OrderedDict
46import copy47import copy
47import itertools48import itertools
48import sys49import sys
@@ -1019,7 +1020,7 @@
1019 # pylint: disable-msg=W02311020 # pylint: disable-msg=W0231
1020 _check_called_from_interface_def('%s()' % self.__class__.__name__)1021 _check_called_from_interface_def('%s()' % self.__class__.__name__)
1021 self.interface = interface1022 self.interface = interface
1022 self.params = {}1023 self.params = OrderedDict()
1023 for name in field_names:1024 for name in field_names:
1024 field = interface.get(name)1025 field = interface.get(name)
1025 if field is None:1026 if field is None:
@@ -1519,7 +1520,7 @@
1519 (param_def.__name__, orig_name)1520 (param_def.__name__, orig_name)
1520 for orig_name, param_def in self._export_info['params'].items()1521 for orig_name, param_def in self._export_info['params'].items()
1521 if param_def.__name__ != orig_name)1522 if param_def.__name__ != orig_name)
1522 params = {}1523 params = OrderedDict()
1523 for name, value in kwargs.items():1524 for name, value in kwargs.items():
1524 name = renames.get(name, name)1525 name = renames.get(name, name)
1525 params[name] = value1526 params[name] = value
15261527
=== modified file 'src/lazr/restful/docs/webservice-declarations.rst'
--- src/lazr/restful/docs/webservice-declarations.rst 2021-01-18 11:58:31 +0000
+++ src/lazr/restful/docs/webservice-declarations.rst 2021-02-16 16:53:00 +0000
@@ -56,11 +56,12 @@
56elements.56elements.
5757
58 >>> from pprint import pformat58 >>> from pprint import pformat
59 >>> from six.moves.collections_abc import Mapping
59 >>> def print_export_tag(element):60 >>> def print_export_tag(element):
60 ... """Print the content of the 'lazr.restful.exported' tag."""61 ... """Print the content of the 'lazr.restful.exported' tag."""
61 ... def format_value(value):62 ... def format_value(value):
62 ... if isinstance(value, dict):63 ... if isinstance(value, Mapping):
63 ... return pformat(value, width=40)64 ... return pformat(dict(value), width=40)
64 ... else:65 ... else:
65 ... return repr(value)66 ... return repr(value)
66 ... tag = element.queryTaggedValue('lazr.restful.exported')67 ... tag = element.queryTaggedValue('lazr.restful.exported')

Subscribers

People subscribed via source and target branches