Skip to content

Commit 141f21a

Browse files
author
Gauvain Pocentek
committed
Fix project update
1 parent 00ab7d0 commit 141f21a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

gitlab/cli.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ def _populate_sub_parser_by_class(cls, sub_parser):
106106
required=True)
107107

108108
attrs = (cls.requiredUpdateAttrs
109-
if cls.requiredUpdateAttrs is not None
109+
if (cls.requiredUpdateAttrs or cls.optionalUpdateAttrs)
110110
else cls.requiredCreateAttrs)
111111
[sub_parser_action.add_argument("--%s" % x.replace('_', '-'),
112112
required=True)
113113
for x in attrs if x != cls.idAttr]
114114

115115
attrs = (cls.optionalUpdateAttrs
116-
if cls.optionalUpdateAttrs is not None
116+
if (cls.requiredUpdateAttrs or cls.optionalUpdateAttrs)
117117
else cls.optionalCreateAttrs)
118118
[sub_parser_action.add_argument("--%s" % x.replace('_', '-'),
119119
required=False)

gitlab/objects.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -728,9 +728,6 @@ class ProjectCommitStatus(GitlabObject):
728728
requiredUrlAttrs = ['project_id', 'commit_id']
729729
requiredCreateAttrs = ['state']
730730
optionalCreateAttrs = ['description', 'name', 'ref', 'target_url']
731-
requiredGetAttrs = []
732-
requiredUpdateAttrs = []
733-
requiredDeleteAttrs = []
734731

735732

736733
class ProjectCommitStatusManager(BaseManager):
@@ -1079,11 +1076,15 @@ class Project(GitlabObject):
10791076
_url = '/projects'
10801077
_constructorTypes = {'owner': 'User', 'namespace': 'Group'}
10811078
requiredCreateAttrs = ['name']
1082-
requiredUpdateAttrs = []
10831079
optionalCreateAttrs = ['default_branch', 'issues_enabled', 'wall_enabled',
10841080
'merge_requests_enabled', 'wiki_enabled',
10851081
'snippets_enabled', 'public', 'visibility_level',
10861082
'namespace_id', 'description', 'path', 'import_url']
1083+
optionalUpdateAttrs = ['name', 'default_branch', 'issues_enabled',
1084+
'wall_enabled', 'merge_requests_enabled',
1085+
'wiki_enabled', 'snippets_enabled', 'public',
1086+
'visibility_level', 'namespace_id', 'description',
1087+
'path', 'import_url']
10871088
shortPrintAttr = 'path'
10881089
managers = [
10891090
('branches', ProjectBranchManager, [('project_id', 'id')]),

0 commit comments

Comments
 (0)