Skip to content

Commit 99d959f

Browse files
committed
fix: do not require empty data dict for create()
1 parent e5afb55 commit 99d959f

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

docs/gl_objects/access_requests.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ List access requests from projects and groups::
3737

3838
Create an access request::
3939

40-
p_ar = project.accessrequests.create({})
41-
g_ar = group.accessrequests.create({})
40+
p_ar = project.accessrequests.create()
41+
g_ar = group.accessrequests.create()
4242

4343
Approve an access request::
4444

docs/gl_objects/projects.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Delete a project::
103103

104104
Fork a project::
105105

106-
fork = project.forks.create({})
106+
fork = project.forks.create()
107107

108108
# fork to a specific namespace
109109
fork = project.forks.create({'namespace': 'myteam'})
@@ -255,7 +255,7 @@ generated by GitLab you need to:
255255

256256
# Create the export
257257
p = gl.projects.get(my_project)
258-
export = p.exports.create({})
258+
export = p.exports.create()
259259

260260
# Wait for the 'finished' status
261261
export.refresh()

gitlab/mixins.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def get_create_attrs(self):
170170
return getattr(self, "_create_attrs", (tuple(), tuple()))
171171

172172
@exc.on_http_error(exc.GitlabCreateError)
173-
def create(self, data, **kwargs):
173+
def create(self, data=None, **kwargs):
174174
"""Create a new object.
175175
176176
Args:
@@ -186,6 +186,9 @@ def create(self, data, **kwargs):
186186
GitlabAuthenticationError: If authentication is not correct
187187
GitlabCreateError: If the server cannot perform the request
188188
"""
189+
if data is None:
190+
data = {}
191+
189192
self._check_missing_create_attrs(data)
190193
files = {}
191194

tools/python_test_v4.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@
949949
[current_project.delete() for current_project in projects]
950950

951951
# project import/export
952-
ex = admin_project.exports.create({})
952+
ex = admin_project.exports.create()
953953
ex.refresh()
954954
count = 0
955955
while ex.export_status != "finished":

0 commit comments

Comments
 (0)