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: checking if RESTManager._from_parent_attrs is set#1367

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/from_parent_attrs
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletionsgitlab/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -290,12 +290,12 @@ def _compute_path(self, path: Optional[str] = None) -> Optional[str]:
path = self._path
if path is None:
return None
if self._parent is None or nothasattr(self, "_from_parent_attrs"):
if self._parent is None or not self._from_parent_attrs:
return path

data = {
self_attr: getattr(self._parent, parent_attr, None)
for self_attr, parent_attr in self._from_parent_attrs.items() # type: ignore
for self_attr, parent_attr in self._from_parent_attrs.items()
}
self._parent_attrs = data
return path % data
Expand Down
20 changes: 7 additions & 13 deletionsgitlab/v4/cli.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,7 +69,7 @@ def do_custom(self):
# Get the object (lazy), then act
if in_obj:
data = {}
ifhasattr(self.mgr, "_from_parent_attrs"):
if self.mgr._from_parent_attrs:
for k in self.mgr._from_parent_attrs:
data[k] = self.args[k]
if gitlab.mixins.GetWithoutIdMixin not in inspect.getmro(self.cls):
Expand DownExpand Up@@ -138,13 +138,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):

sub_parser_action = sub_parser.add_parser(action_name)
sub_parser_action.add_argument("--sudo", required=False)
ifhasattr(mgr_cls, "_from_parent_attrs"):
[
if mgr_cls._from_parent_attrs:
for x in mgr_cls._from_parent_attrs:
sub_parser_action.add_argument(
"--%s" % x.replace("_", "-"), required=True
)
for x in mgr_cls._from_parent_attrs
]

if action_name == "list":
if hasattr(mgr_cls, "_list_filters"):
Expand DownExpand Up@@ -221,13 +219,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):
for action_name in cli.custom_actions[name]:
sub_parser_action = sub_parser.add_parser(action_name)
# Get the attributes for URL/path construction
ifhasattr(mgr_cls, "_from_parent_attrs"):
[
if mgr_cls._from_parent_attrs:
for x in mgr_cls._from_parent_attrs:
sub_parser_action.add_argument(
"--%s" % x.replace("_", "-"), required=True
)
for x in mgr_cls._from_parent_attrs
]
sub_parser_action.add_argument("--sudo", required=False)

# We need to get the object somehow
Expand DownExpand Up@@ -256,13 +252,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):
name = mgr_cls.__name__
for action_name in cli.custom_actions[name]:
sub_parser_action = sub_parser.add_parser(action_name)
ifhasattr(mgr_cls, "_from_parent_attrs"):
[
if mgr_cls._from_parent_attrs:
for x in mgr_cls._from_parent_attrs:
sub_parser_action.add_argument(
"--%s" % x.replace("_", "-"), required=True
)
for x in mgr_cls._from_parent_attrs
]
sub_parser_action.add_argument("--sudo", required=False)

required, optional, dummy = cli.custom_actions[name][action_name]
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp