| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
From http://docs.python.org/3.1/whatsnew/3.0.html:
"Python 3.0 uses the concepts of text and (binary) data instead of
Unicode strings and 8-bit strings."
Use six.text_type to Type for representing (Unicode) textual data. This
is unicode() in Python 2 and str in Python 3.
Change-Id: I3da268a714a34a8e626a2590f01b86e414dc3411
Signed-off-by: Chuck Short <chuck.short@canonical.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to_primitive included many checks that were executed before any usual
types have been checked. It's safe to reorder / duplicate the most
common ones. Especially built-in types can be checked before other
more complicated scenarios. This is important since to_primitive gets
called over a million times in usual test run and many more times in a
live environment.
This change strips around 4% of nova testing time on my machine and the
function itself is ~5x faster on average according to the profiler.
Change-Id: I71e0c06bbcc31793a1cdcebb36d4e3d8c5876f73
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reverts part of a94b9b4 which added an extra LOG.error
statement when max_depth is hit.
This is causing spurious errors to get logged in some of our
projects which have adopted this changed.
Related to: https://bugs.launchpad.net/nova/+bug/1140133
Change-Id: Ie7939e41797da000dd8b269f905f351df0b7116d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
depth of 3, but there is at least on case in Nova (Security
group Rules) which requires a depth beyond this.
https://bugs.launchpad.net/nova/+bug/1118608
Specifically security_group_rule_get_by_security_group
returns a set of rules which have the structure:
rule -> grantee_group -> Instance -> Instance_type
Rather than just bumping the depth limit, which might break some
other user of to_primitive we make it a specific parameter that
defaults to the current value but can be over-ridden when
required and log a warning when the depth is exceeded
Change-Id: I1eaebd484e20cb2eae09a693289709973de9943c
|
|
|
|
|
|
|
|
|
|
|
|
| |
In preparation for having nova.db.api not return any sqlalchemy objects.
nova.db.api will return only primitives, except for datetime.datetime
objects.
Uses functools.partial to make code DRYING
Partially implements bp db-api-cleanup
Change-Id: I9980d8c4e20b05bbe734cf90ac209e4e7e89befb
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added both a tox test-env for pyflakes and fixed the current pyflakes errors.
This did actually fix a couple of bugs.
The CI team has started using pyflakes on its projects and also has started
using oslo for things, so ignoring pyflakes warnings on the oslo code was
starting to get old. However, additionally, pyflakes is pretty solid, so we
should maybe consider gating on it across the board. (% locals() is the
biggest thing that we do that it doesn't like)
Change-Id: Iac1ca62db301892b7863711162fcbc74807eb24f
|
|
|
|
|
|
|
|
| |
When calling jsonutils.to_primitive() recursively, the convert_instances
argument should be passed along. This change fixes one place where it
was not.
Change-Id: I536e1ca05bb4e613fba71298797879587e8b4b00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change jsonutils.to_primitive() to increase the recursion depth counter
when calling to_primitive() on the result of iteritems() from the
current element. Previously, the only time the counter was increased
was when converting the __dict__ from an object. The iteritems() case
risks cycles, as well.
I hit a problem with this when trying to call to_primitive on an
instance of nova.db.sqlalchemy.models.Instance. An Instance includes a
reference to InstanceInfoCache, which has a reference back to the
Instance. Without this change, to_primitive() would raise an exception
for an Instance due to excessive recursion.
Related to nova blueprint no-db-messaging.
Change-Id: Ifb878368d97e92ab6c361a4dd5f5ab2e68fc16e2
|
|
|
|
|
|
|
|
|
|
|
| |
This patch updates jsonutils.to_primitive() to use timeutils.strtime()
to convert a datimetime object to a string instead of just using str().
This ensures that we can easily convert the string back to a datetime
using timeutils.parse_strtime().
Required for the nova blueprint no-db-messaging.
Change-Id: I725b333695930e12e2832378102514326fec639c
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes bug #1017765
After version 3.3.2, the anyjson library will throw a KeyError if
filedecoder isn't present. The filedecoder is just like the decoder
except it takes a file instead of a string, like json.load() instead
of json.loads().
Change-Id: I7bd012a7b4afa9b1ec987c3e6393cc922b5dadff
|
|
|
|
|
|
|
|
| |
Fixes bug #1009848
Fixed jsonutils.dumps to receive other parameters
Change-Id: I34836ae89359bccb689a36a7b486e85bb41d70e4
|
|
|
|
|
|
|
|
|
| |
Fixes bug 1010124
Convert xmlrpclib.DateTime types to datetime so they can be serialized
without creating an exception.
Change-Id: Ifcab69ad81d39d7f4066df5c71c6ab6734fb1fab
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 72840edc736b7f4d2366b5049f6516d8f5b901ff.
This change breaks kombu, so revert it since there is no specific need
for it.
Fixes bug 1009127.
Change-Id: Id0ef8b3948b63d0151289cb7ce8e617d9816bb4b
|
|
|
|
|
|
| |
Fixes bug #1008065
Change-Id: I72aba29eea4637643cb7742f2fd4b1f05d15667f
|
|
This patch creates a new module, jsonutils. It is based on some code
from nova.utils that is used by nova.rpc. It is being added to
openstack-common as another step toward being able to eventually move
nova.rpc to openstack-common.
This module provides a few things:
1) A handy function for getting an object down to something that can
be JSON serialized. See to_primitive().
2) Wrappers around loads() and dumps(). The dumps() wrapper will
automatically use to_primitive() for you if needed.
3) This sets up anyjson to use the loads() and dumps() wrappers if
anyjson is available.
Change-Id: I41e5759360d515ed53defe69f3e8247aafbcc83a
|