Use oslo.utils.encodeutils instead of strutils
Change-Id: Id8adb40a88d1bbaacbb75e2eeafd723d92d7de29
This commit is contained in:
parent
89ee4ce263
commit
a18b4e606d
@ -15,11 +15,11 @@
|
||||
import functools
|
||||
import uuid
|
||||
|
||||
from oslo.utils import encodeutils
|
||||
from oslo.utils import timeutils
|
||||
import redis
|
||||
|
||||
from zaqar.common import decorators
|
||||
from zaqar.openstack.common import strutils
|
||||
from zaqar.queues import storage
|
||||
from zaqar.queues.storage import errors
|
||||
from zaqar.queues.storage.redis import models
|
||||
@ -215,7 +215,7 @@ class MessageController(storage.Message):
|
||||
|
||||
info = {
|
||||
# NOTE(kgriffs): A "None" claim is serialized as an empty str
|
||||
'id': strutils.safe_decode(claim[0]) or None,
|
||||
'id': encodeutils.safe_decode(claim[0]) or None,
|
||||
'expires': int(claim[1]),
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ class MessageController(storage.Message):
|
||||
offset_msgsets += len(msgset_keys)
|
||||
|
||||
for msgset_key in msgset_keys:
|
||||
msgset_key = strutils.safe_decode(msgset_key)
|
||||
msgset_key = encodeutils.safe_decode(msgset_key)
|
||||
|
||||
# NOTE(kgriffs): Drive the claim controller GC from
|
||||
# here, because we already know the queue and project
|
||||
|
@ -16,10 +16,9 @@ import functools
|
||||
import uuid
|
||||
|
||||
import msgpack
|
||||
from oslo.utils import encodeutils
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from zaqar.openstack.common import strutils
|
||||
|
||||
|
||||
_pack = msgpack.Packer(encoding='utf-8', use_bin_type=True).pack
|
||||
_unpack = functools.partial(msgpack.unpackb, encoding='utf-8')
|
||||
@ -76,19 +75,19 @@ class Message(object):
|
||||
def from_redis(doc):
|
||||
claim_id = doc[b'c']
|
||||
if claim_id:
|
||||
claim_id = strutils.safe_decode(claim_id)
|
||||
claim_id = encodeutils.safe_decode(claim_id)
|
||||
else:
|
||||
claim_id = None
|
||||
|
||||
# NOTE(kgriffs): Under Py3K, redis-py converts all strings
|
||||
# into binary. Woohoo!
|
||||
return Message(
|
||||
id=strutils.safe_decode(doc[b'id']),
|
||||
id=encodeutils.safe_decode(doc[b'id']),
|
||||
ttl=int(doc[b't']),
|
||||
created=int(doc[b'cr']),
|
||||
expires=int(doc[b'e']),
|
||||
|
||||
client_uuid=strutils.safe_decode(doc[b'u']),
|
||||
client_uuid=encodeutils.safe_decode(doc[b'u']),
|
||||
|
||||
claim_id=claim_id,
|
||||
claim_expires=int(doc[b'c.e']),
|
||||
|
@ -17,12 +17,12 @@ import sys
|
||||
import time
|
||||
import uuid
|
||||
|
||||
from oslo.utils import encodeutils
|
||||
import redis
|
||||
import six
|
||||
|
||||
from zaqar.i18n import _
|
||||
from zaqar.openstack.common import log as logging
|
||||
from zaqar.openstack.common import strutils
|
||||
from zaqar.queues.storage import errors
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -198,7 +198,7 @@ class QueueListCursor(object):
|
||||
def next(self):
|
||||
curr = next(self.queue_iter)
|
||||
queue = self.client.hmget(curr, ['c', 'm'])
|
||||
return self.denormalizer(queue, strutils.safe_decode(curr))
|
||||
return self.denormalizer(queue, encodeutils.safe_decode(curr))
|
||||
|
||||
def __next__(self):
|
||||
return self.next()
|
Loading…
Reference in New Issue
Block a user