Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
IllDepence committed Nov 3, 2018
1 parent bdf2f46 commit d23a174
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
3 changes: 2 additions & 1 deletion jsonkeeper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def make_json_error(error):

@app.after_request
def set_response_headers(response):
response.headers['Cache-Control'] = 'private, no-store, no-cache, must-revalidate'
response.headers['Cache-Control'] = ('private, no-store, no-cache,'
' must-revalidate')
# response.headers['Pragma'] = 'no-cache'
# response.headers['Expires'] = '0'
return response
Expand Down
4 changes: 2 additions & 2 deletions jsonkeeper/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def log_cfg(self, cp, msg):
# https://www.bugs.python.org/issue27805
# side note: stat.S_ISCHR(os.stat(fn).st_mode) doesn't seem to work for
# in an alpine linux docker container running canvas indexer
# with gunicorn although manually executing it on a python shell
# in the container works
# with gunicorn although manually executing it on a python
# shell in the container works
if log_file == '/dev/stdout':
mode = 'w'
else:
Expand Down
2 changes: 1 addition & 1 deletion jsonkeeper/subroutines.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def remove_document_from_actstr(to_rem_id):
only the first AS page with a matching activity is deleted.
"""

return # currently not used because Delete Activities were introduced
return # currently not used because Delete Activities were introduced

coll_json = get_actstr_collection()
if coll_json:
Expand Down
8 changes: 4 additions & 4 deletions jsonkeeper/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
acceptable_content_type,
CORS_preflight_response,
add_CORS_headers,
get_access_token,
get_JSON_string_by_ID,
get_JSON_metadata_by_ID,
get_actstr_collection_pages,
get_actstr_collection,
handle_post_request,
Expand Down Expand Up @@ -136,8 +134,10 @@ def api_json_id_range(json_id, r_num):
return abort(404, 'JSON document with ID {} not found'.format(json_id))


@jk.route('/{}/<regex("{}"):json_id>/status'.format(current_app.cfg.api_path(),
current_app.cfg.doc_id_patt()),
@jk.route('/{}/<regex("{}"):json_id>/status'.format(
current_app.cfg.api_path(),
current_app.cfg.doc_id_patt()
),
methods=['GET', 'PATCH', 'OPTIONS'])
def api_json_id_status(json_id):
""" API endpoint for retrieving and changing JSON documents' metadata.
Expand Down
9 changes: 5 additions & 4 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def test_status_endpoint(self):
headers={'Accept': 'application/json',
'Content-Type': 'application/json',
'X-Access-Token': 'foo',
'X-Unlisted':'true'},
'X-Unlisted': 'true'},
data='{"baz":"bam"}')
location = resp.headers.get('Location')
resp = self.tc.get('{}/status'.format(location),
Expand Down Expand Up @@ -458,7 +458,7 @@ def test_anon_AS(self):
resp = self.tc.post('/{}'.format(self.app.cfg.api_path()),
headers={'Accept': 'application/json',
'Content-Type': 'application/ld+json',
'X-Unlisted':'false'},
'X-Unlisted': 'false'},
data=curation_json)
resp = self.tc.get('/{}'.format(self.app.cfg.as_coll_url()))
self.assertEqual(resp.status, '404 NOT FOUND')
Expand All @@ -476,7 +476,7 @@ def test_unlisted_AS(self):
resp = self.tc.post('/{}'.format(self.app.cfg.api_path()),
headers={'Accept': 'application/json',
'Content-Type': 'application/ld+json',
'X-Unlisted':'true'},
'X-Unlisted': 'true'},
data=curation_json)

resp = self.tc.get('/{}'.format(self.app.cfg.as_coll_url()))
Expand All @@ -487,7 +487,7 @@ def test_unlisted_AS(self):
headers={'Accept': 'application/json',
'Content-Type': 'application/ld+json',
'X-Access-Token': 'foo',
'X-Unlisted':'false'},
'X-Unlisted': 'false'},
data=curation_json)
location = resp.headers.get('Location')

Expand All @@ -508,5 +508,6 @@ def test_unlisted_AS(self):
# a Delete Action should have been added
self.assertEqual(json_obj.get('totalItems'), 2)


if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletions util/iiif.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""

import json
import uuid
from collections import OrderedDict


Expand Down Expand Up @@ -120,7 +119,6 @@ def get_range_summary(self):
'>>> {}'.format(json.dumps(w))))
ret_lst.append(dic)
ret_dic[dic['ran']] = dic['man']
import pprint
return ret_lst, ret_dic

def _extract_manifest_id(self, dic):
Expand Down

0 comments on commit d23a174

Please sign in to comment.