Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe fetching for things and placements #5

Open
wants to merge 7 commits into
base: devel
Choose a base branch
from
Open

Conversation

s-kostyuk
Copy link
Owner

A version of fetchers for Things and Placements that doesn't raise an exception if corresponding was not found by the specified ID. They return 'default' argument value instead of it (instead of raising exception).

This approach has upsides and downsides. As upside, it will work faster for handling of requests for non-existing data. As a downside, handling of requests for existing data objects is slightly slower.

@s-kostyuk
Copy link
Owner Author

s-kostyuk commented Sep 7, 2017

It looks like Django uses try-catch approach for non-existing objects: one, two. If object can't be fetched, than ObjectDoesNotExist exception is raised. Than this exception is caught in some sort of router / root handler / etc. and is processed by a registered 404 request handler.

@ghost ghost assigned s-kostyuk Sep 8, 2017
@ghost ghost added the in progress label Sep 8, 2017
@ghost ghost added the in progress label Sep 12, 2017
@s-kostyuk s-kostyuk added this to the Not planned milestone Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant