@@ -424,8 +424,8 @@ def getprojectevents(self, id_, page=1, per_page=20):
424
424
def createproject (self , name , namespace_id = None , description = "" ,
425
425
issues_enabled = 0 , wall_enabled = 0 ,
426
426
merge_requests_enabled = 0 , wiki_enabled = 0 ,
427
- snippets_enabled = 0 , public = 0 , sudo = "" ,
428
- import_url = "" ):
427
+ snippets_enabled = 0 , public = 0 , visibility_level = - 1 ,
428
+ sudo = "" , import_url = "" ):
429
429
"""
430
430
Create a project
431
431
:param name: Obligatory
@@ -443,12 +443,22 @@ def createproject(self, name, namespace_id=None, description="",
443
443
if sudo != "" :
444
444
data ['sudo' ] = sudo
445
445
446
- # if gitlab is the new 6th version, there is a public option for the
447
- # project creation
446
+ # to define repository visibilty to other users, in gitlab version 6
447
+ # there is a public option and in gitlab version 7 there is a
448
+ # visibility_level option for the project creation.
448
449
if type (public ) != int :
449
450
raise TypeError
451
+ if type (visibility_level ) != int :
452
+ raise TypeError
453
+
454
+ if visibility_level > 0 :
455
+ if public != 0 :
456
+ raise ValueError ('Only one of public and visibility_level arguments may be provided' )
457
+ data ['visibility_level' ] = visibility_level
458
+
450
459
if public != 0 :
451
460
data ['public' ] = public
461
+
452
462
request = requests .post (self .projects_url , headers = self .headers ,
453
463
data = data , verify = self .verify_ssl )
454
464
if request .status_code == 201 :
0 commit comments