Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #80 from matakuka/type_check
Browse files Browse the repository at this point in the history
add exceptions for invalid ids in url
  • Loading branch information
toirl authored Jul 31, 2017
2 parents 60cc2e9 + 3e8d288 commit e91ab2f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ringo/resources.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.exc import DataError
from pyramid.httpexceptions import HTTPNotFound
from ringo.lib.helpers import get_item_modul

Expand Down Expand Up @@ -53,9 +54,12 @@ def _load_item(self, id, request):
try:
factory = self.__model__.get_item_factory()
return factory.load(id, request.db)
except DataError:
raise HTTPNotFound()
except NoResultFound:
raise HTTPNotFound()


def _get_item_permissions(self, request):
return self.__model__._get_permissions(self.__modul__,
self.item, request)

0 comments on commit e91ab2f

Please sign in to comment.