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

make things that were worse before better in the hopes of unbreaking … #2

Merged
merged 1 commit into from
Apr 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,17 @@ def handle_envelope_hash(self, envelope):
LOGGER.info("did fail request because random data was bad")

def write_secure(self, chunk):
newchunk = chunk
if isinstance(chunk, dict):
newchunk = chunk.copy()
if self.signed_hash is not None:
newchunk["signed_memorabilia"] = str(base64.b64encode(self.signed_hash), 'ascii')
self.signed_hash = None

self.write(newchunk)
new_chunk = chunk
try:
if isinstance(chunk, dict):
new_chunk = chunk.copy()
if self.signed_hash is not None:
new_chunk["signed_memorabilia"] = str(base64.b64encode(self.signed_hash), 'ascii')
self.signed_hash = None
except AttributeError:
LOGGER.info("did fail request because data was even worse")

self.write(new_chunk)

class APIHandler(BaseAPIHandler):
RETURNS_JSON = 1
Expand Down