-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Endpoint-shuffle (Use URL to signal the data-shape returned).
- Loading branch information
Showing
6 changed files
with
88 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,52 @@ | ||
from __future__ import absolute_import | ||
from flask import url_for | ||
|
||
|
||
class InvalidQueryString(Exception): | ||
code = 400 | ||
description = "Invalid query-string" | ||
|
||
def __init__(self, querystring_key, querystring_value, reason=None): | ||
Exception.__init__(self) | ||
self.message = """ | ||
Error parsing query-string - could not parse this section: | ||
'{0}={1}'\n | ||
""".format(querystring_key, querystring_value) | ||
if reason: | ||
self.message+= " - " + reason | ||
self.message += " - " + reason | ||
|
||
|
||
class IvornNotFound(Exception): | ||
code = 422 | ||
description = 'IVORN not found' | ||
def __init__(self, ivorn): | ||
|
||
def __init__(self, ivorn, suggested_ivorn_url=None): | ||
Exception.__init__(self) | ||
|
||
self.message = """ | ||
Sorry, IVORN: '{0}' not found in the cache. | ||
Sorry, IVORN: '{0}' not found in the database. | ||
If your IVORN has been truncated at the '#' character, | ||
then it probably just needs to be | ||
<a href="http://meyerweb.com/eric/tools/dencoder/">URL-encoded</a>. | ||
IVORN listings can be found at <a href="{1}">{1}</a>. | ||
""".format(ivorn,url_for('apiv1.ivorn')) | ||
""".format(ivorn) | ||
if suggested_ivorn_url: | ||
self.message += ( | ||
'IVORN listings can be found at <a href="{0}">{0}</a>.'.format( | ||
suggested_ivorn_url)) | ||
|
||
|
||
class IvornNotSupplied(Exception): | ||
code = 400 | ||
description = "No IVORN supplied" | ||
def __init__(self): | ||
|
||
def __init__(self, suggested_ivorn_url=None): | ||
Exception.__init__(self) | ||
self.message = """ | ||
Please append an | ||
<a href="http://meyerweb.com/eric/tools/dencoder/">URL-encoded</a> | ||
IVORN to the URL. IVORN listings can be found at | ||
<a href="{0}">{0}</a>. | ||
""".format(url_for('apiv1.ivorn')) | ||
IVORN to the URL. | ||
""" | ||
if suggested_ivorn_url: | ||
self.message += ( | ||
'IVORN listings can be found at <a href="{0}">{0}</a>.'.format( | ||
suggested_ivorn_url)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.