-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
[10.0][MIG] Pingen #124
[10.0][MIG] Pingen #124
Conversation
af0d8b5
to
860f381
Compare
if not response.ok: | ||
raise ConnectionError( | ||
"%s: %s" % (response.json['errorcode'], | ||
response.json['errormessage'])) |
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.
What is the rationale for removing this? I think you should at least use response.raise_for_status(), otherwise you might have no json at all if you receive an HTTP response with another status code than 200
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.
When a connection error really happens, i.e. no internet, a ConnectionError (from python lib requests.exceptions) will be raised by the previous instruction response = method(complete_url, **kwargs)
and this code won't be executed at all.
The logic was simply, if there's a response it's not a ConnectionError but an APIError instead.
Maybe I'm missing a use case ?
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.
@grindtildeath are authentication error expected as API errors ?
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.
In case the API key is wrong, here is the reponse we get :
(Pdb) response.json()
{u'errorcode': 99400, u'errormessage': u'Your token is invalid or expired', u'error': True}
So it will be catched as an API error and the message will be displayed correctly on pingen.document
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.
Few nitpickings otherwise LGTM
if not response.ok: | ||
raise ConnectionError( | ||
"%s: %s" % (response.json['errorcode'], | ||
response.json['errormessage'])) |
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.
@grindtildeath are authentication error expected as API errors ?
9d0752c
to
62366a3
Compare
@guewen can we merge this, was your question answered ? |
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.
Found some more nitpickings related to my previous review with the +
in concat strings, not that much an issue but for one where a space is missing.
pingen/models/pingen_document.py
Outdated
'\n%s') % (self.name, e) | ||
except Exception as e: | ||
_logger.exception( | ||
'Unexpected Error when updating ' + |
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.
Here is another unnecessary +
pingen/models/pingen_document.py
Outdated
self.pingen_color) | ||
except ConnectionError: | ||
_logger.exception( | ||
'Connection Error when asking for sending ' + |
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.
+
to remove
pingen/models/pingen_document.py
Outdated
raise | ||
except APIError: | ||
_logger.exception( | ||
'API Error when asking for sending ' + |
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.
+
to remove
pingen/models/pingen_document.py
Outdated
'state': 'sendcenter', | ||
'post_id': post_id}) | ||
_logger.info( | ||
'Pingen Document %s: asked for' + |
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.
+
to remove and warning about missing space
pingen/models/pingen_document.py
Outdated
raise | ||
except APIError: | ||
_logger.exception( | ||
'API Error when asking for sending ' + |
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.
+
to remove
/ocabot merge |
Hey, thanks for contributing! Proceeding to merge this for you. |
@yvaucher your merge command was aborted due to failed check(s), which you can inspect on this commit of 10.0-ocabot-merge-pr-124-by-yvaucher-bump-no. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
e2324a9
to
2568fb3
Compare
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
2568fb3
to
ecf84b7
Compare
Hey @grindtildeath, thank you for your Pull Request. It looks like some users haven't signed our Contributor License Agreement, yet.
Appreciation of efforts, |
attachment_id not needed Pingen get_pingen_session fixed
Do not raise ConnectionError if we get a response Use ConnectionError from requests lib instead of overriding it Fix push_to_pingen (writes on state as for cron), remove unneeded loops
on pingen ir.attachment. When multiple module redefine create, write it can lead to TypeError
ecf84b7
to
d2b16d8
Compare
/ocabot merge nobump |
On my way to merge this fine PR! |
It looks like something changed on |
Congratulations, your PR was merged at c9d3377. Thanks a lot for contributing to OCA. ❤️ |
Supersedes : #114