Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit610bde8

Browse files
author
Gauvain Pocentek
committed
document the API migration from 0.10
1 parent5ea6d0a commit610bde8

File tree

2 files changed

+126
-0
lines changed

2 files changed

+126
-0
lines changed

‎docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Contents:
1414
install
1515
cli
1616
api-usage
17+
upgrade-from-0.10
1718
api/gitlab
1819

1920

‎docs/upgrade-from-0.10.rst

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#############################################
2+
Upgrading from python-gitlab 0.10 and earlier
3+
#############################################
4+
5+
``python-gitlab`` 0.11 introduces new objects which make the API cleaner and
6+
easier to use. The feature set is unchanged but some methods have been
7+
deprecated in favor of the new manager objects.
8+
9+
Deprecated methods will be remove in a future release.
10+
11+
Gitlab object migration
12+
=======================
13+
14+
The objects constructor methods are deprecated:
15+
16+
* ``Hook()``
17+
* ``Project()``
18+
* ``UserProject()``
19+
* ``Group()``
20+
* ``Issue()``
21+
* ``User()``
22+
* ``Team()``
23+
24+
Use the new managers objects instead. For example:
25+
26+
..code-block::python
27+
28+
# Deprecated syntax
29+
p1= gl.Project({'name':'myCoolProject'})
30+
p1.save()
31+
p2= gl.Project(id=1)
32+
p_list= gl.Project()
33+
34+
# New syntax
35+
p1= gl.projects.create({'name':'myCoolProject'})
36+
p2= gl.projects.get(1)
37+
p_list= gl.projects.list()
38+
39+
The following methods are also deprecated:
40+
41+
* ``search_projects()``
42+
* ``owned_projects()``
43+
* ``all_projects()``
44+
45+
Use the ``projects`` manager instead:
46+
47+
..code-block::python
48+
49+
# Deprecated syntax
50+
l1= gl.search_projects('whatever')
51+
l2= gl.owned_projects()
52+
l3= gl.all_projects()
53+
54+
# New syntax
55+
l1= gl.projects.search('whatever')
56+
l2= gl.projects.owned()
57+
l3= gl.projects.all()
58+
59+
GitlabObject objects migration
60+
==============================
61+
62+
The following constructor methods are deprecated in favor of the matching
63+
managers:
64+
65+
..list-table::
66+
:header-rows: 1
67+
68+
* - Deprecated method
69+
- Matching manager
70+
* - ``User.Key()``
71+
- ``User.keys``
72+
* - ``CurrentUser.Key()``
73+
- ``CurrentUser.keys``
74+
* - ``Group.Member()``
75+
- ``Group.members``
76+
* - ``ProjectIssue.Note()``
77+
- ``ProjectIssue.notes``
78+
* - ``ProjectMergeRequest.Note()``
79+
- ``ProjectMergeRequest.notes``
80+
* - ``ProjectSnippet.Note()``
81+
- ``ProjectSnippet.notes``
82+
* - ``Project.Branch()``
83+
- ``Project.branches``
84+
* - ``Project.Commit()``
85+
- ``Project.commits``
86+
* - ``Project.Event()``
87+
- ``Project.events``
88+
* - ``Project.File()``
89+
- ``Project.files``
90+
* - ``Project.Hook()``
91+
- ``Project.hooks``
92+
* - ``Project.Key()``
93+
- ``Project.keys``
94+
* - ``Project.Issue()``
95+
- ``Project.issues``
96+
* - ``Project.Label()``
97+
- ``Project.labels``
98+
* - ``Project.Member()``
99+
- ``Project.members``
100+
* - ``Project.MergeRequest()``
101+
- ``Project.mergerequests``
102+
* - ``Project.Milestone()``
103+
- ``Project.milestones``
104+
* - ``Project.Note()``
105+
- ``Project.notes``
106+
* - ``Project.Snippet()``
107+
- ``Project.snippets``
108+
* - ``Project.Tag()``
109+
- ``Project.tags``
110+
* - ``Team.Member()``
111+
- ``Team.members``
112+
* - ``Team.Project()``
113+
- ``Team.projects``
114+
115+
For example:
116+
117+
..code-block::python
118+
119+
# Deprecated syntax
120+
p= gl.Project(id=2)
121+
issues= p.Issue()
122+
123+
# New syntax
124+
p= gl.projects.get(2)
125+
issues= p.issues.list()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp