doctormo / python-gitlab3

Python wrapper for the entire GitLab API
GNU Lesser General Public License v3.0
46 stars 25 forks source link

Possible issue with DELETE group and project #6

Closed samrocketman closed 11 years ago

samrocketman commented 11 years ago

Now that I actually start using it I encountered an issue for Group. About to test project.

>>> git.Group(43).delete()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/gitlab3-0.5.1-py2.7.egg/gitlab3/__init__.py", line 206, in self_fn
    return self._delete(api._q_url)
  File "/usr/local/lib/python2.7/dist-packages/gitlab3-0.5.1-py2.7.egg/gitlab3/__init__.py", line 418, in _delete
    return self._request(requests.delete, api_url, addl_keys, data)
  File "/usr/local/lib/python2.7/dist-packages/gitlab3-0.5.1-py2.7.egg/gitlab3/__init__.py", line 429, in _request
    self._check_status_code(r.status_code, url, data)
  File "/usr/local/lib/python2.7/dist-packages/gitlab3-0.5.1-py2.7.egg/gitlab3/__init__.py", line 405, in _check_status_code
    raise self._code_to_exc[status_code](msg)
gitlab3.exceptions.ResourceNotFound: URL: https://example.com/api/v3/groups/:id, Data: None

And now for project...

>>> git.Project(185).delete()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/gitlab3-0.5.1-py2.7.egg/gitlab3/__init__.py", line 206, in self_fn
    return self._delete(api._q_url)
  File "/usr/local/lib/python2.7/dist-packages/gitlab3-0.5.1-py2.7.egg/gitlab3/__init__.py", line 418, in _delete
    return self._request(requests.delete, api_url, addl_keys, data)
  File "/usr/local/lib/python2.7/dist-packages/gitlab3-0.5.1-py2.7.egg/gitlab3/__init__.py", line 429, in _request
    self._check_status_code(r.status_code, url, data)
  File "/usr/local/lib/python2.7/dist-packages/gitlab3-0.5.1-py2.7.egg/gitlab3/__init__.py", line 405, in _check_status_code
    raise self._code_to_exc[status_code](msg)
gitlab3.exceptions.ResourceNotFound: URL: https://example.com/api/v3/projects/:id, Data: None
alexvh commented 11 years ago

You need to call the "group" and "project" functions (all lowercase) as opposed their constructors (alternatively, get_group/get_project). e.g. git.group(43).delete(), git.project(185).delete().

I should probably either make that usage work or throw an error.

samrocketman commented 11 years ago

That did it. It works :godmode: