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

Commitf93b9b5

Browse files
authored
Merge pull request#1367 from JohnVillalovos/jlvillal/from_parent_attrs
fix: checking if RESTManager._from_parent_attrs is set
2 parentsde73ea7 +8224b40 commitf93b9b5

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

‎gitlab/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,12 @@ def _compute_path(self, path: Optional[str] = None) -> Optional[str]:
290290
path=self._path
291291
ifpathisNone:
292292
returnNone
293-
ifself._parentisNoneornothasattr(self,"_from_parent_attrs"):
293+
ifself._parentisNoneornotself._from_parent_attrs:
294294
returnpath
295295

296296
data= {
297297
self_attr:getattr(self._parent,parent_attr,None)
298-
forself_attr,parent_attrinself._from_parent_attrs.items()# type: ignore
298+
forself_attr,parent_attrinself._from_parent_attrs.items()
299299
}
300300
self._parent_attrs=data
301301
returnpath%data

‎gitlab/v4/cli.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def do_custom(self):
6969
# Get the object (lazy), then act
7070
ifin_obj:
7171
data= {}
72-
ifhasattr(self.mgr,"_from_parent_attrs"):
72+
ifself.mgr._from_parent_attrs:
7373
forkinself.mgr._from_parent_attrs:
7474
data[k]=self.args[k]
7575
ifgitlab.mixins.GetWithoutIdMixinnotininspect.getmro(self.cls):
@@ -138,13 +138,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):
138138

139139
sub_parser_action=sub_parser.add_parser(action_name)
140140
sub_parser_action.add_argument("--sudo",required=False)
141-
ifhasattr(mgr_cls,"_from_parent_attrs"):
142-
[
141+
ifmgr_cls._from_parent_attrs:
142+
forxinmgr_cls._from_parent_attrs:
143143
sub_parser_action.add_argument(
144144
"--%s"%x.replace("_","-"),required=True
145145
)
146-
forxinmgr_cls._from_parent_attrs
147-
]
148146

149147
ifaction_name=="list":
150148
ifhasattr(mgr_cls,"_list_filters"):
@@ -221,13 +219,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):
221219
foraction_nameincli.custom_actions[name]:
222220
sub_parser_action=sub_parser.add_parser(action_name)
223221
# Get the attributes for URL/path construction
224-
ifhasattr(mgr_cls,"_from_parent_attrs"):
225-
[
222+
ifmgr_cls._from_parent_attrs:
223+
forxinmgr_cls._from_parent_attrs:
226224
sub_parser_action.add_argument(
227225
"--%s"%x.replace("_","-"),required=True
228226
)
229-
forxinmgr_cls._from_parent_attrs
230-
]
231227
sub_parser_action.add_argument("--sudo",required=False)
232228

233229
# We need to get the object somehow
@@ -256,13 +252,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):
256252
name=mgr_cls.__name__
257253
foraction_nameincli.custom_actions[name]:
258254
sub_parser_action=sub_parser.add_parser(action_name)
259-
ifhasattr(mgr_cls,"_from_parent_attrs"):
260-
[
255+
ifmgr_cls._from_parent_attrs:
256+
forxinmgr_cls._from_parent_attrs:
261257
sub_parser_action.add_argument(
262258
"--%s"%x.replace("_","-"),required=True
263259
)
264-
forxinmgr_cls._from_parent_attrs
265-
]
266260
sub_parser_action.add_argument("--sudo",required=False)
267261

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp