Switch to oslo.utils

Change-Id: Ie040478db7773dc90f98b876a97893f3a63162e5
This commit is contained in:
Fei Long Wang 2014-08-26 11:33:03 +12:00
parent b4a5e4c72d
commit 28df6f5cb0
18 changed files with 21 additions and 21 deletions

View File

@ -16,4 +16,5 @@ stevedore>=0.14
six>=1.7.0 six>=1.7.0
oslo.config>=1.4.0.0a3 oslo.config>=1.4.0.0a3
oslo.i18n>=0.2.0 # Apache-2.0 oslo.i18n>=0.2.0 # Apache-2.0
oslo.utils>=0.2.0
SQLAlchemy>=0.8.4,<=0.8.99,>=0.9.7,<=0.9.99 SQLAlchemy>=0.8.4,<=0.8.99,>=0.9.7,<=0.9.99

View File

@ -15,4 +15,5 @@ stevedore>=0.14
six>=1.7.0 six>=1.7.0
oslo.config>=1.4.0.0a3 oslo.config>=1.4.0.0a3
oslo.i18n>=0.2.0 # Apache-2.0 oslo.i18n>=0.2.0 # Apache-2.0
oslo.utils>=0.2.0
SQLAlchemy>=0.8.4,<=0.8.99,>=0.9.7,<=0.9.99 SQLAlchemy>=0.8.4,<=0.8.99,>=0.9.7,<=0.9.99

View File

@ -19,13 +19,13 @@ import time
import uuid import uuid
import mock import mock
from oslo.utils import timeutils
from pymongo import cursor from pymongo import cursor
import pymongo.errors import pymongo.errors
import six import six
from testtools import matchers from testtools import matchers
from zaqar.openstack.common.cache import cache as oslo_cache from zaqar.openstack.common.cache import cache as oslo_cache
from zaqar.openstack.common import timeutils
from zaqar.queues import storage from zaqar.queues import storage
from zaqar.queues.storage import errors from zaqar.queues.storage import errors
from zaqar.queues.storage import mongodb from zaqar.queues.storage import mongodb
@ -273,7 +273,7 @@ class MongodbMessageTests(MongodbSetupMixin, base.MessageControllerTest):
self.assertIsNone(unchanged) self.assertIsNone(unchanged)
now = timeutils.utcnow() + datetime.timedelta(seconds=10) now = timeutils.utcnow() + datetime.timedelta(seconds=10)
timeutils_utcnow = 'zaqar.openstack.common.timeutils.utcnow' timeutils_utcnow = 'oslo.utils.timeutils.utcnow'
with mock.patch(timeutils_utcnow) as mock_utcnow: with mock.patch(timeutils_utcnow) as mock_utcnow:
mock_utcnow.return_value = now mock_utcnow.return_value = now
changed = self.queue_controller._inc_counter(queue_name, changed = self.queue_controller._inc_counter(queue_name,

View File

@ -24,9 +24,9 @@ Field Mappings:
import datetime import datetime
from bson import objectid from bson import objectid
from oslo.utils import timeutils
import zaqar.openstack.common.log as logging import zaqar.openstack.common.log as logging
from zaqar.openstack.common import timeutils
from zaqar.queues import storage from zaqar.queues import storage
from zaqar.queues.storage import errors from zaqar.queues.storage import errors
from zaqar.queues.storage.mongodb import utils from zaqar.queues.storage.mongodb import utils

View File

@ -25,12 +25,12 @@ import datetime
import time import time
from bson import objectid from bson import objectid
from oslo.utils import timeutils
import pymongo.errors import pymongo.errors
import pymongo.read_preferences import pymongo.read_preferences
from zaqar.i18n import _ from zaqar.i18n import _
import zaqar.openstack.common.log as logging import zaqar.openstack.common.log as logging
from zaqar.openstack.common import timeutils
from zaqar.queues import storage from zaqar.queues import storage
from zaqar.queues.storage import errors from zaqar.queues.storage import errors
from zaqar.queues.storage.mongodb import utils from zaqar.queues.storage.mongodb import utils

View File

@ -21,12 +21,12 @@ Field Mappings:
letter of their long name. letter of their long name.
""" """
from oslo.utils import timeutils
import pymongo.errors import pymongo.errors
from zaqar.common import decorators from zaqar.common import decorators
from zaqar.i18n import _ from zaqar.i18n import _
import zaqar.openstack.common.log as logging import zaqar.openstack.common.log as logging
from zaqar.openstack.common import timeutils
from zaqar.queues import storage from zaqar.queues import storage
from zaqar.queues.storage import errors from zaqar.queues.storage import errors
from zaqar.queues.storage.mongodb import utils from zaqar.queues.storage.mongodb import utils

View File

@ -24,11 +24,11 @@ import time
from bson import errors as berrors from bson import errors as berrors
from bson import objectid from bson import objectid
from bson import tz_util from bson import tz_util
from oslo.utils import timeutils
from pymongo import errors from pymongo import errors
from zaqar.i18n import _ from zaqar.i18n import _
import zaqar.openstack.common.log as logging import zaqar.openstack.common.log as logging
from zaqar.openstack.common import timeutils
from zaqar.queues.storage import errors as storage_errors from zaqar.queues.storage import errors as storage_errors

View File

@ -13,10 +13,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from oslo.utils import timeutils
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy.sql import func as sfunc from sqlalchemy.sql import func as sfunc
from zaqar.openstack.common import timeutils
from zaqar.queues import storage from zaqar.queues import storage
from zaqar.queues.storage import errors from zaqar.queues.storage import errors
from zaqar.queues.storage.sqlalchemy import tables from zaqar.queues.storage.sqlalchemy import tables

View File

@ -15,10 +15,10 @@
import calendar import calendar
from oslo.utils import timeutils
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy.sql import func as sfunc from sqlalchemy.sql import func as sfunc
from zaqar.openstack.common import timeutils
from zaqar.queues import storage from zaqar.queues import storage
from zaqar.queues.storage import errors from zaqar.queues.storage import errors
from zaqar.queues.storage.sqlalchemy import tables from zaqar.queues.storage.sqlalchemy import tables

View File

@ -12,10 +12,9 @@
# License for the specific language governing permissions and limitations under # License for the specific language governing permissions and limitations under
# the License. # the License.
from oslo.utils import timeutils
import sqlalchemy as sa import sqlalchemy as sa
from zaqar.openstack.common import timeutils
metadata = sa.MetaData() metadata = sa.MetaData()
now = timeutils.utcnow now = timeutils.utcnow

View File

@ -15,13 +15,13 @@
import functools import functools
from oslo.utils import encodeutils
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import exc from sqlalchemy import exc
from sqlalchemy.sql import func as sfunc from sqlalchemy.sql import func as sfunc
from zaqar.openstack.common import jsonutils from zaqar.openstack.common import jsonutils
from zaqar.openstack.common import log as logging from zaqar.openstack.common import log as logging
from zaqar.openstack.common import strutils
from zaqar.queues.storage import errors from zaqar.queues.storage import errors
from zaqar.queues.storage.sqlalchemy import tables from zaqar.queues.storage.sqlalchemy import tables
@ -128,7 +128,7 @@ def stat_message(message):
def json_encode(obj): def json_encode(obj):
return strutils.safe_encode(jsonutils.dumps(obj), 'utf-8') return encodeutils.safe_encode(jsonutils.dumps(obj), 'utf-8')
def json_decode(binary): def json_decode(binary):

View File

@ -15,7 +15,7 @@
import json import json
from zaqar.openstack.common import strutils from oslo.utils import encodeutils
class MalformedJSON(ValueError): class MalformedJSON(ValueError):
@ -44,7 +44,7 @@ def read_json(stream, len):
:param len: the number of bytes to read from stream :param len: the number of bytes to read from stream
""" """
try: try:
content = strutils.safe_decode(stream.read(len), 'utf-8') content = encodeutils.safe_decode(stream.read(len), 'utf-8')
return json.loads(content, parse_int=_json_int) return json.loads(content, parse_int=_json_int)
except UnicodeDecodeError as ex: except UnicodeDecodeError as ex:
raise MalformedJSON(ex) raise MalformedJSON(ex)

View File

@ -19,9 +19,9 @@ import multiprocessing
import os import os
import jsonschema import jsonschema
from oslo.utils import timeutils
import six import six
from zaqar.openstack.common import timeutils
from zaqar.queues.api.v1 import response as response_v1 from zaqar.queues.api.v1 import response as response_v1
from zaqar.queues.api.v1_1 import response as response_v1_1 from zaqar.queues.api.v1_1 import response as response_v1_1
from zaqar.queues import bootstrap from zaqar.queues import bootstrap

View File

@ -19,11 +19,11 @@ import time
import uuid import uuid
import ddt import ddt
from oslo.utils import timeutils
import six import six
from testtools import matchers from testtools import matchers
from zaqar.openstack.common.cache import cache as oslo_cache from zaqar.openstack.common.cache import cache as oslo_cache
from zaqar.openstack.common import timeutils
from zaqar.queues import bootstrap from zaqar.queues import bootstrap
from zaqar.queues import storage from zaqar.queues import storage
from zaqar.queues.storage import errors from zaqar.queues.storage import errors

View File

@ -19,10 +19,10 @@ import uuid
import ddt import ddt
import falcon import falcon
import mock import mock
from oslo.utils import timeutils
from testtools import matchers from testtools import matchers
from zaqar.openstack.common import jsonutils from zaqar.openstack.common import jsonutils
from zaqar.openstack.common import timeutils
from zaqar import tests as testing from zaqar import tests as testing
from zaqar.tests.queues.transport.wsgi import base from zaqar.tests.queues.transport.wsgi import base

View File

@ -19,12 +19,11 @@ import uuid
import ddt import ddt
import falcon import falcon
import mock import mock
from oslo.utils import timeutils
import six import six
from testtools import matchers from testtools import matchers
from zaqar.openstack.common import jsonutils from zaqar.openstack.common import jsonutils
from zaqar.openstack.common import timeutils
from zaqar.queues.transport import validation from zaqar.queues.transport import validation
from zaqar import tests as testing from zaqar import tests as testing
from zaqar.tests.queues.transport.wsgi import base from zaqar.tests.queues.transport.wsgi import base

View File

@ -20,10 +20,10 @@ import uuid
import ddt import ddt
import falcon import falcon
import mock import mock
from oslo.utils import timeutils
from testtools import matchers from testtools import matchers
from zaqar.openstack.common import jsonutils from zaqar.openstack.common import jsonutils
from zaqar.openstack.common import timeutils
from zaqar import tests as testing from zaqar import tests as testing
from zaqar.tests.queues.transport.wsgi import base from zaqar.tests.queues.transport.wsgi import base

View File

@ -19,11 +19,11 @@ import uuid
import ddt import ddt
import falcon import falcon
import mock import mock
from oslo.utils import timeutils
import six import six
from testtools import matchers from testtools import matchers
from zaqar.openstack.common import jsonutils from zaqar.openstack.common import jsonutils
from zaqar.openstack.common import timeutils
from zaqar.queues.transport import validation from zaqar.queues.transport import validation
from zaqar import tests as testing from zaqar import tests as testing
from zaqar.tests.queues.transport.wsgi import base from zaqar.tests.queues.transport.wsgi import base