From 041cbefbf2e68ffb05b5f729fb576b99af5c0295 Mon Sep 17 00:00:00 2001 From: Ling Thio Date: Mon, 11 Sep 2017 19:10:54 -0700 Subject: [PATCH] Obsoleted db_adapter.add_object. Renamed add_object2 to add_object. --- .../db_adapters/db_adapter_interface.py | 22 +++++++------------ flask_user/db_adapters/dynamo_db_adapter.py | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/flask_user/db_adapters/db_adapter_interface.py b/flask_user/db_adapters/db_adapter_interface.py index b8474c97..2375d669 100644 --- a/flask_user/db_adapters/db_adapter_interface.py +++ b/flask_user/db_adapters/db_adapter_interface.py @@ -40,15 +40,6 @@ def find_objects(self, ObjectClass, **kwargs): """ Retrieve all objects of type ``ObjectClass``, matching the filters specified in ``**kwargs`` -- case sensitive. """ - - raise NotImplementedError - - def get_object(self, ObjectClass, id): - """ Retrieve object of type ``ObjectClass`` by ``id``. - - | Returns object on success. - | Returns None otherwise. - """ raise NotImplementedError def find_first_object(self, ObjectClass, **kwargs): @@ -60,15 +51,18 @@ def find_first_object(self, ObjectClass, **kwargs): """ raise NotImplementedError - def ifind_first_object(self, ObjectClass, **kwargs): - """ Retrieve the first object of type ``ObjectClass``, - matching the filters specified in ``**kwargs`` -- case insensitive. + def get_object(self, ObjectClass, id): + """ Retrieve object of type ``ObjectClass`` by ``id``. - ``ifind_first_object(User, email='myname@example.com')`` translates to - ``User.query.filter(User.email.ilike('myname@example.com')).first()``. + | Returns object on success. + | Returns None otherwise. """ raise NotImplementedError + def save_object(self, object, **kwargs): + """ Save object. Only for non-session centric Object-Database Mappers.""" + raise NotImplementedError + # Database management methods # --------------------------- diff --git a/flask_user/db_adapters/dynamo_db_adapter.py b/flask_user/db_adapters/dynamo_db_adapter.py index acd47b9c..66ac8956 100644 --- a/flask_user/db_adapters/dynamo_db_adapter.py +++ b/flask_user/db_adapters/dynamo_db_adapter.py @@ -97,7 +97,7 @@ def find_first_object(self, ObjectClass, **kwargs): def save_object(self, object, **kwargs): """ Save object. Only for non-session centric Object-Database Mappers.""" - pass + self.db.engine.sync(object) def delete_object(self, object): """ Delete object specified by ``object``. """