Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vvmruder committed Oct 18, 2016
1 parent 20a476e commit fa1acc2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pyramid_georest/lib/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
12 changes: 7 additions & 5 deletions pyramid_georest/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit fa1acc2

Please sign in to comment.