summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--designate/api/v2/controllers/rest.py20
-rw-r--r--designate/sqlalchemy/base.py5
-rw-r--r--designate/sqlalchemy/types.py1
-rw-r--r--designate/tests/test_storage/test_sqlalchemy.py3
4 files changed, 19 insertions, 10 deletions
diff --git a/designate/api/v2/controllers/rest.py b/designate/api/v2/controllers/rest.py
index e6de3593..7f6c2c92 100644
--- a/designate/api/v2/controllers/rest.py
+++ b/designate/api/v2/controllers/rest.py
@@ -62,7 +62,7 @@ class RestController(pecan.rest.RestController):
else:
return criterion
- def _handle_post(self, method, remainder):
+ def _handle_post(self, method, remainder, request=None):
'''
Routes ``POST`` actions to the appropriate controller.
'''
@@ -75,7 +75,8 @@ class RestController(pecan.rest.RestController):
controller = getattr(self, remainder[0], None)
if controller and not inspect.ismethod(controller):
- return pecan.routing.lookup_controller(controller, remainder[1:])
+ return pecan.routing.lookup_controller(controller, remainder[1:],
+ request=request)
# finally, check for the regular post_one/post requests
controller = self._find_controller('post_one', 'post')
@@ -84,7 +85,7 @@ class RestController(pecan.rest.RestController):
pecan.abort(405)
- def _handle_patch(self, method, remainder):
+ def _handle_patch(self, method, remainder, request=None):
'''
Routes ``PATCH`` actions to the appropriate controller.
'''
@@ -97,7 +98,8 @@ class RestController(pecan.rest.RestController):
controller = getattr(self, remainder[0], None)
if controller and not inspect.ismethod(controller):
- return pecan.routing.lookup_controller(controller, remainder[1:])
+ return pecan.routing.lookup_controller(controller, remainder[1:],
+ request=request)
# finally, check for the regular patch_one/patch requests
controller = self._find_controller('patch_one', 'patch')
@@ -106,7 +108,7 @@ class RestController(pecan.rest.RestController):
pecan.abort(405)
- def _handle_put(self, method, remainder):
+ def _handle_put(self, method, remainder, request=None):
'''
Routes ``PUT`` actions to the appropriate controller.
'''
@@ -119,7 +121,8 @@ class RestController(pecan.rest.RestController):
controller = getattr(self, remainder[0], None)
if controller and not inspect.ismethod(controller):
- return pecan.routing.lookup_controller(controller, remainder[1:])
+ return pecan.routing.lookup_controller(controller, remainder[1:],
+ request=request)
# finally, check for the regular put_one/put requests
controller = self._find_controller('put_one', 'put')
@@ -128,7 +131,7 @@ class RestController(pecan.rest.RestController):
pecan.abort(405)
- def _handle_delete(self, method, remainder):
+ def _handle_delete(self, method, remainder, request=None):
'''
Routes ``DELETE`` actions to the appropriate controller.
'''
@@ -141,7 +144,8 @@ class RestController(pecan.rest.RestController):
controller = getattr(self, remainder[0], None)
if controller and not inspect.ismethod(controller):
- return pecan.routing.lookup_controller(controller, remainder[1:])
+ return pecan.routing.lookup_controller(controller, remainder[1:],
+ request=request)
# finally, check for the regular delete_one/delete requests
controller = self._find_controller('delete_one', 'delete')
diff --git a/designate/sqlalchemy/base.py b/designate/sqlalchemy/base.py
index 905e4b40..d72f36ca 100644
--- a/designate/sqlalchemy/base.py
+++ b/designate/sqlalchemy/base.py
@@ -21,7 +21,7 @@ from oslo_db import exception as oslo_db_exception
from oslo_db.sqlalchemy import utils as oslodb_utils
from oslo_log import log as logging
from oslo_utils import timeutils
-from sqlalchemy import select, or_, between, func, distinct
+from sqlalchemy import select, or_, between, func, distinct, inspect
from designate import exceptions
from designate import objects
@@ -96,6 +96,9 @@ class SQLAlchemy(object, metaclass=abc.ABCMeta):
def rollback(self):
self.session.rollback()
+ def get_inspector(self):
+ return inspect(self.engine)
+
@staticmethod
def _apply_criterion(table, query, criterion):
if criterion is not None:
diff --git a/designate/sqlalchemy/types.py b/designate/sqlalchemy/types.py
index b576e8bf..6063454d 100644
--- a/designate/sqlalchemy/types.py
+++ b/designate/sqlalchemy/types.py
@@ -27,6 +27,7 @@ class UUID(TypeDecorator):
Copied verbatim from SQLAlchemy documentation.
"""
+ cache_ok = True
impl = CHAR
def load_dialect_impl(self, dialect):
diff --git a/designate/tests/test_storage/test_sqlalchemy.py b/designate/tests/test_storage/test_sqlalchemy.py
index c70dec91..9a4bf321 100644
--- a/designate/tests/test_storage/test_sqlalchemy.py
+++ b/designate/tests/test_storage/test_sqlalchemy.py
@@ -53,7 +53,8 @@ class SqlalchemyStorageTest(StorageTestCase, TestCase):
u'zone_transfer_requests',
u'zones'
]
- self.assertEqual(table_names, self.storage.engine.table_names())
+ inspector = self.storage.get_inspector()
+ self.assertEqual(table_names, inspector.get_table_names())
def test_schema_table_indexes(self):
indexes_t = self.storage.engine.execute("SELECT * FROM sqlite_master WHERE type = 'index';") # noqa