-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
Will this still work on Python 2? If not, we should mention it maybe in the commit message and also change the requirements section in the README.md. |
@SolidifiedRay, would you mind taking a look at #39, #40, #41, #42 and see if updating those breaks anything? |
This still work on Python 2. I will take a look at other updates soon. |
Thanks for checking. Let's merge them in then. |
Request.is_xhr has been deprecated as it is not reliable, according to issue #1077 in Werkzeug(WSGI) repo Signed-off-by: SolidifiedRay <[email protected]>
I go back to have another look at
Maybe we should also remove the check for |
Signed-off-by: SolidifiedRay <[email protected]>
Flask on python3 won't work with StringIO as send_file only expects to be given binary file-like objects and it wouldn't know how to encode the string to bytes, according to issue #3358 in Flask repo Signed-off-by: SolidifiedRay <[email protected]>
e7a52e0
to
07e5a97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @SolidifiedRay!
install in-toto directly instead of installing in an editable way and a dev version Signed-off-by: SolidifiedRay <[email protected]>
Signed-off-by: SolidifiedRay <[email protected]>
Signed-off-by: SolidifiedRay <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @SolidifiedRay!
@@ -362,7 +362,7 @@ def ajax_flash_messages(response): | |||
show_messages(repsonse.messages). | |||
""" | |||
|
|||
if (request.is_xhr and | |||
if (request.headers.get("X-Requested-With") == "XMLHttpRequest" and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC you are re-implementing the check that the deprecated request.is_xhr
used to perform, right?
Did you have a chance to check if the jquery ajax call we use still sets that header, so that our ajax_flash_messages
hook still works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a ton for the review @lukpueh !!
I checked the ajax_flash_messages
hook and unfortunately something is not right.
For example, when I upload the functionary's public key in the functionaries page, the flash messages show up only after I manually refresh the page. When I try to remove the functionary that already has a pubkey, I also have to refresh the page to see the change and the flash message. I am not sure if there is something wrong with the ajax call or the ajax_flash_messages
hook, but I will try to find up why this happened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a follow-up, I will work on rule generation first, which seems to have a higher priority than this problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found ajax_flash_messages
working again.
I check the jquery ajax call with the browser's network console, and it does include the X-Requested-With
header with the value XMLHttpRequest
. So I believe there is no problem with the code here. I doubt that it failed previously is because my Virtual Machine didn't run the WSGI server correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge then. Thanks for the updates!
Make some changes due to the latest frontend and Python 3.
See commit messages for the details.