Skip to content

Commit cc3a548

Browse files
committed
allow specifying names for visibility_level
1 parent ec92d39 commit cc3a548

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

gitlab/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,17 @@ def createproject(self, name, namespace_id=None, description="",
449449
if type(public) != int:
450450
raise TypeError
451451
if type(visibility_level) != int:
452-
raise TypeError
452+
if type(visibility_level) == str:
453+
if visibility_level.lower() == "private":
454+
visibility_level = 0
455+
elif visibility_level.lower() == "internal":
456+
visibility_level = 10
457+
elif visibility_level.lower() == "public":
458+
visibility_level = 20
459+
else:
460+
raise ValueError
461+
else:
462+
raise TypeError
453463

454464
if visibility_level > 0:
455465
if public != 0:

0 commit comments

Comments
 (0)