Skip to content

Commit

Permalink
Fix project update
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauvain Pocentek committed Jan 30, 2016
1 parent 00ab7d0 commit 141f21a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions gitlab/cli.py
Expand Up @@ -106,14 +106,14 @@ def _populate_sub_parser_by_class(cls, sub_parser):
required=True)

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

attrs = (cls.optionalUpdateAttrs
if cls.optionalUpdateAttrs is not None
if (cls.requiredUpdateAttrs or cls.optionalUpdateAttrs)
else cls.optionalCreateAttrs)
[sub_parser_action.add_argument("--%s" % x.replace('_', '-'),
required=False)
Expand Down
9 changes: 5 additions & 4 deletions gitlab/objects.py
Expand Up @@ -728,9 +728,6 @@ class ProjectCommitStatus(GitlabObject):
requiredUrlAttrs = ['project_id', 'commit_id']
requiredCreateAttrs = ['state']
optionalCreateAttrs = ['description', 'name', 'ref', 'target_url']
requiredGetAttrs = []
requiredUpdateAttrs = []
requiredDeleteAttrs = []


class ProjectCommitStatusManager(BaseManager):
Expand Down Expand Up @@ -1079,11 +1076,15 @@ class Project(GitlabObject):
_url = '/projects'
_constructorTypes = {'owner': 'User', 'namespace': 'Group'}
requiredCreateAttrs = ['name']
requiredUpdateAttrs = []
optionalCreateAttrs = ['default_branch', 'issues_enabled', 'wall_enabled',
'merge_requests_enabled', 'wiki_enabled',
'snippets_enabled', 'public', 'visibility_level',
'namespace_id', 'description', 'path', 'import_url']
optionalUpdateAttrs = ['name', 'default_branch', 'issues_enabled',
'wall_enabled', 'merge_requests_enabled',
'wiki_enabled', 'snippets_enabled', 'public',
'visibility_level', 'namespace_id', 'description',
'path', 'import_url']
shortPrintAttr = 'path'
managers = [
('branches', ProjectBranchManager, [('project_id', 'id')]),
Expand Down

0 comments on commit 141f21a

Please sign in to comment.