Skip to content

Conversation

@hardbyte
Copy link
Collaborator

@hardbyte hardbyte commented Feb 20, 2020

Replaces #503. I can't review because I opened this PR.

@hardbyte hardbyte requested a review from wilko77 February 21, 2020 00:48
Copy link
Collaborator

@wilko77 wilko77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the deletion of the tempfile should be sorted though. Otherwise it's fine.

safe_fail_request(400, message='Missing CLK and Blocks information')
# fail condition5 - unknown element in JSON
if 'clks' not in clk_json and 'clknblocks' not in clk_json:
safe_fail_request(400, message='Unknown upload element - expect "clks" or "clknblocks"')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this function would throw an exception instead of calling safe_fail_request it would be nicely unit-testable.

raise ValueError('can only handle CLKs at the moment.')
binary_data = b'\n'.join(''.join(clk.split('\n')).encode() for clk in data['clks']) + b'\n'
buffer = io.BytesIO(binary_data)
#### END GLUE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the most beautiful glue code I have ever seen.

@wilko77 wilko77 merged commit b5a7705 into develop Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants