Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: catch invalid type used to initialize RESTObject#1487

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nejch merged 1 commit intopython-gitlab:masterfromJohnVillalovos:jlvillal/check_attrs
Jun 10, 2021
Merged

fix: catch invalid type used to initialize RESTObject#1487

nejch merged 1 commit intopython-gitlab:masterfromJohnVillalovos:jlvillal/check_attrs
Jun 10, 2021

Conversation

JohnVillalovos
Copy link
Member

@JohnVillalovosJohnVillalovos commentedMay 31, 2021
edited
Loading

Sometimes we have errors where we don't get a dictionary passed toRESTObject.__init__() method. This breaks things but in confusingways.Check in the __init__() method and raise an exception if it occurs.

@JohnVillalovos
Copy link
MemberAuthor

Interested to get some feedback on this. Not sure if that is the correct exception to use.

@codecov-commenter
Copy link

codecov-commenter commentedMay 31, 2021
edited
Loading

Codecov Report

Merging#1487 (c7bcc25) intomaster (161bb0b) willincrease coverage by0.00%.
The diff coverage is100.00%.

@@           Coverage Diff           @@##           master    #1487   +/-   ##=======================================  Coverage   91.04%   91.05%           =======================================  Files          74       74             Lines        4145     4148    +3     =======================================+ Hits         3774     3777    +3  Misses        371      371
FlagCoverage Δ
cli_func_v480.68% <66.66%> (-0.02%)⬇️
py_func_v479.96% <66.66%> (-0.01%)⬇️
unit82.18% <100.00%> (+0.01%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

Impacted FilesCoverage Δ
gitlab/base.py89.44% <100.00%> (+0.20%)⬆️

@nejch
Copy link
Member

Is the original idea behind this due to the malformed/unexpected response we got in the 301/302 redirect issue with POST? What exactly was the traceback there? :)

@JohnVillalovos
Copy link
MemberAuthor

JohnVillalovos commentedJun 1, 2021
edited
Loading

Is the original idea behind this due to the malformed/unexpected response we got in the 301/302 redirect issue with POST?

Yes. When thePOST got changed to aGET we end up getting alist returned.

What exactly was the traceback there? :)

Like in#1477

Traceback (most recent call last):  File "./turris-os-milestone-rename.py", line 60, in <module>    main()  File "./turris-os-milestone-rename.py", line 20, in main    issue.notes.create({'body': 'note content'})  File "/usr/lib/python3.8/site-packages/gitlab/exceptions.py", line 287, in wrapped_f    return f(*args, **kwargs)  File "/usr/lib/python3.8/site-packages/gitlab/mixins.py", line 325, in create    return self._obj_cls(self, server_data)  File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 62, in __init__    self._create_managers()  File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 151, in _create_managers    manager = cls(self.manager.gitlab, parent=self)  File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 290, in __init__    self._computed_path = self._compute_path()  File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 305, in _compute_path    data = {  File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 306, in <dictcomp>    self_attr: getattr(self._parent, parent_attr, None)  File "/usr/lib/python3.8/site-packages/gitlab/base.py", line 80, in __getattr__    value = self.__dict__["_attrs"][name]TypeError: list indices must be integers or slices, not str

Copy link
Member

@nejchnejch left a comment

Choose a reason for hiding this comment

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

Ok, thanks! Just a small thought from my side.

Sometimes we have errors where we don't get a dictionary passed toRESTObject.__init__() method. This breaks things but in confusingways.Check in the __init__() method and raise an exception if it occurs.
@nejchnejch merged commit600a2c1 intopython-gitlab:masterJun 10, 2021
@JohnVillalovosJohnVillalovos deleted the jlvillal/check_attrs branchJune 10, 2021 21:55
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nejchnejchAwaiting requested review from nejch

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@JohnVillalovos@codecov-commenter@nejch

[8]ページ先頭

©2009-2025 Movatter.jp