diff --git a/pyramid_georest/lib/rest.py b/pyramid_georest/lib/rest.py index cddb180..bf5c040 100644 --- a/pyramid_georest/lib/rest.py +++ b/pyramid_georest/lib/rest.py @@ -22,7 +22,7 @@ from pyramid_georest.lib.description import ModelDescription from pyramid_georest.lib.renderer import RenderProxy from pyramid_georest.lib.database import Connection -from pyramid_georest.views import RestProxy +from pyramid_georest.routes import read_filter_method from sqlalchemy import or_, and_ from sqlalchemy import cast from sqlalchemy import String @@ -474,7 +474,7 @@ def read(self, request, session): :rtype: pyramid.response.Response """ query = session.query(self.orm_model) - if request.method == RestProxy.read_filter_method: + if request.method == read_filter_method: rest_filter = Filter(self.model_description, **request.json_body.get('filter')) query = rest_filter.filter(query) results = query.all() diff --git a/pyramid_georest/routes.py b/pyramid_georest/routes.py index 48e96d4..af8d05a 100644 --- a/pyramid_georest/routes.py +++ b/pyramid_georest/routes.py @@ -18,14 +18,16 @@ __author__ = 'Clemens Rudert' +read_method = 'GET' +read_filter_method = 'POST' +create_method = 'POST' +update_method = 'PUT' +delete_method = 'DELETE' + def includeme(config): + global read_method, read_filter_method, create_method, update_method, delete_method from pyramid_georest import CREATE, UPDATE, DELETE, READ, READ_FILTER - read_method = 'GET' - read_filter_method = 'POST' - create_method = 'POST' - update_method = 'PUT' - delete_method = 'DELETE' # set methods from ini configuration if set. Use standard if not. if CREATE is not None: