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

[10.0][MIG] Pingen #124

Merged
merged 5 commits into from
Mar 30, 2022
Merged

[10.0][MIG] Pingen #124

merged 5 commits into from
Mar 30, 2022

Conversation

grindtildeath
Copy link
Contributor

Supersedes : #114

@grindtildeath grindtildeath force-pushed the 10.0_mig_pingen branch 4 times, most recently from af0d8b5 to 860f381 Compare January 11, 2018 16:26
if not response.ok:
raise ConnectionError(
"%s: %s" % (response.json['errorcode'],
response.json['errormessage']))
Copy link
Member

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

Copy link
Contributor Author

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 ?

Copy link
Member

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 ?

Copy link
Contributor Author

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

Copy link
Member

@yvaucher yvaucher left a 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

pingen/models/ir_attachment.py Outdated Show resolved Hide resolved
pingen/models/ir_attachment.py Outdated Show resolved Hide resolved
pingen/models/ir_attachment.py Outdated Show resolved Hide resolved
if not response.ok:
raise ConnectionError(
"%s: %s" % (response.json['errorcode'],
response.json['errormessage']))
Copy link
Member

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 ?

pingen/models/pingen_document.py Outdated Show resolved Hide resolved
pingen/models/pingen_document.py Outdated Show resolved Hide resolved
pingen/models/pingen_document.py Outdated Show resolved Hide resolved
pingen/models/pingen_document.py Outdated Show resolved Hide resolved
pingen/models/pingen_document.py Outdated Show resolved Hide resolved
pingen/README.rst Outdated Show resolved Hide resolved
@grindtildeath grindtildeath force-pushed the 10.0_mig_pingen branch 2 times, most recently from 9d0752c to 62366a3 Compare January 12, 2018 14:42
@yvaucher
Copy link
Member

yvaucher commented Feb 2, 2018

@guewen can we merge this, was your question answered ?

@max3903 max3903 added this to the 10.0 milestone Jun 12, 2018
Copy link
Member

@yvaucher yvaucher left a 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.

'\n%s') % (self.name, e)
except Exception as e:
_logger.exception(
'Unexpected Error when updating ' +
Copy link
Member

Choose a reason for hiding this comment

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

Here is another unnecessary +

self.pingen_color)
except ConnectionError:
_logger.exception(
'Connection Error when asking for sending ' +
Copy link
Member

Choose a reason for hiding this comment

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

+ to remove

raise
except APIError:
_logger.exception(
'API Error when asking for sending ' +
Copy link
Member

Choose a reason for hiding this comment

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

+ to remove

'state': 'sendcenter',
'post_id': post_id})
_logger.info(
'Pingen Document %s: asked for' +
Copy link
Member

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

raise
except APIError:
_logger.exception(
'API Error when asking for sending ' +
Copy link
Member

Choose a reason for hiding this comment

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

+ to remove

@yvaucher
Copy link
Member

yvaucher commented Mar 5, 2020

/ocabot merge

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 10.0-ocabot-merge-pr-124-by-yvaucher-bump-no, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Mar 5, 2020
Signed-off-by yvaucher
@OCA-git-bot
Copy link
Contributor

@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.

@github-actions
Copy link

github-actions bot commented Dec 5, 2021

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.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Dec 5, 2021
@github-actions github-actions bot closed this Jan 9, 2022
@simahawk simahawk reopened this Mar 18, 2022
@simahawk simahawk added no stale Use this label to prevent the automated stale action from closing this PR/Issue. and removed stale PR/Issue without recent activity, it'll be soon closed automatically. labels Mar 18, 2022
@oca-clabot
Copy link

Hey @grindtildeath, thank you for your Pull Request.

It looks like some users haven't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here: http://odoo-community.org/page/cla
Here is a list of the users:

Appreciation of efforts,
OCA CLAbot

grindtildeath and others added 4 commits March 21, 2022 16:05
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
@sebalix
Copy link
Contributor

sebalix commented Mar 30, 2022

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 10.0-ocabot-merge-pr-124-by-sebalix-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Mar 30, 2022
Signed-off-by sebalix
@OCA-git-bot
Copy link
Contributor

It looks like something changed on 10.0 in the meantime.
Let me try again (no action is required from you).
Prepared branch 10.0-ocabot-merge-pr-124-by-sebalix-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit e0775ed into OCA:10.0 Mar 30, 2022
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at c9d3377. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged 🎉 no stale Use this label to prevent the automated stale action from closing this PR/Issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants