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

Commit2eac071

Browse files
author
Gauvain Pocentek
committed
add a decode method for ProjectFile
1 parentd3a5701 commit2eac071

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

‎gitlab/objects.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from __future__importprint_function
1919
from __future__importdivision
2020
from __future__importabsolute_import
21+
importbase64
2122
importcopy
2223
importitertools
2324
importjson
@@ -922,6 +923,14 @@ class ProjectFile(GitlabObject):
922923
shortPrintAttr='file_path'
923924
getRequiresId=False
924925

926+
defdecode(self):
927+
"""Returns the decoded content.
928+
929+
Returns:
930+
(str): the decoded content.
931+
"""
932+
returnbase64.b64decode(self.content)
933+
925934

926935
classProjectFileManager(BaseManager):
927936
obj_cls=ProjectFile

‎tools/python_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
'branch_name':'master',
111111
'content':'Initial content',
112112
'commit_message':'New commit'})
113+
assert(readme.decode()=='Initial content')
113114

114115
# labels
115116
label1=admin_project.labels.create({'name':'label1','color':'#778899'})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp