I am using Django 1.5 with Piston. Whenever I try to curl the following url:
http://127.0.0.1:8000/search/?limit=20&uri=
I get the following error:
["NotFound"]
The url pattern:
search_resource = Resource(handler=SearchHandler)
urlpatterns = patterns('',
url(r'^', annotation_resource),
url(r'^search/$', search_resource),
)
and the handler for the request:
class SearchHandler(AnonymousBaseHandler):
allowed_methods = ('GET',)
def read(self, request, id=None):
non_query_args = ['offset', 'limit', 'all_fields']
offset = int(request.GET.get('offset', 0))
limit = int(request.GET.get('limit', 20))
query=dict([(k,v) for k,v in request.GET.items() if not k in non_query_args])
notes = Annotations.find(query).limit(limit).skip(offset) #.sort([(, pymongo.DESCENDING if orderDesc else pymongo.ASCENDING)])
return {'results': [dict([(k,v) if k!='_id' else ('id',v) for k,v in item.items()]) for item in notes],
'total': notes.count()}
I couldn't figure the issue due to the lack of verbosity in the error. /Thanks