-
Couldn't load subscription status.
- Fork 79
Add HTML summary to the artifacts #1694
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
Changes from 8 commits
0bd7d0f
ff3e2fb
7bb82e0
48238d9
2cc5459
a55379f
72f863a
7d2b4c8
7b19ea9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,46 @@ def get(self, artifact_id): | |
|
|
||
| self.write(response) | ||
|
|
||
| @authenticate_oauth | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a test, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noticed comment below. |
||
| def patch(self, artifact_id): | ||
| """Patches the filepaths of the artifact | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. filepaths or filepath? AFAIK there is only one, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "PATCH" request will allow us to update the filepaths attribute of the artifact. Currently, I'm only allowing to add a new filepath, which should be the html-summary, by using |
||
|
|
||
| Parameter | ||
| --------- | ||
| artifact_id : str | ||
| The id of the artifact whole filepaths information is being updated | ||
|
||
|
|
||
| Returns | ||
| ------- | ||
| dict | ||
| Format: | ||
| {'success': bool, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On previous return dictionaries, we were using a slightly different scheme, is there a good motivation to change that? I'm referring to the dictionaries that have a "status" and a "message" key, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. The difference between here and the other dictionaries is that this is part of the REST api that we put in place for the plugins, while the other ones are used in the GUI. It turns out that we did not catch those differences when we reviewed the GUI code adding this structure. If you feel strong about it I can change but I will need to change all the qiita_db handlers plus the plugins consuming that API. I would prefer to not change it right now, given that we should end up changing this entire API to not return the success keyword but rather raising an HTTP error in case the call is not successful. Does it make sense? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we are going to change the API regardless, I'm fine and I think we already have an issue open, I've added a note there to make sure we don't forget about this. |
||
| 'error': str} | ||
| - success: whether the request is successful or not | ||
| - error: in case that success is false, it contains the error msg | ||
| """ | ||
| req_op = self.get_argument('op') | ||
| req_path = self.get_argument('path') | ||
| req_value = self.get_argument('value') | ||
|
|
||
| if req_op == 'add': | ||
| req_path = [v for v in req_path.split('/') if v] | ||
| if len(req_path) != 1 or req_path[0] != 'html_summary': | ||
| success = False | ||
| error_msg = 'Incorrect path parameter value' | ||
| else: | ||
| artifact, success, error_msg = _get_artifact(artifact_id) | ||
| if success: | ||
| artifact.html_summary_fp = req_value | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean that we are going to store the full path? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, the setter of that property calls internally "insert_filepaths" which moves the file to the correct location in the file system and inserts the correct relative path to the DB |
||
| else: | ||
| success = False | ||
| error_msg = ('Operation "%s" not supported. Current supported ' | ||
| 'operations: add' % req_op) | ||
|
|
||
| response = {'success': success, 'error': error_msg} | ||
|
|
||
| self.write(response) | ||
|
|
||
|
|
||
| class ArtifactMappingHandler(OauthBaseHandler): | ||
| @authenticate_oauth | ||
|
|
||
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.
Can you describe what
valueis?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.
nix that, didn't see the parameter below.