| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7453895 commit 064e2b4
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ | |||
| 9 | 9 | # get | |
| 10 | 10 | snippet = gl.snippets.get(snippet_id) | |
| 11 | 11 | # get the content | |
| 12 | - content = snippet.content() | ||
| 12 | + content = snippet.raw() | ||
| 13 | 13 | # end get | |
| 14 | 14 | ||
| 15 | 15 | # create | |
@@ -19,7 +19,7 @@ | |||
| 19 | 19 | # end create | |
| 20 | 20 | ||
| 21 | 21 | # update | |
| 22 | - snippet.visibility_level = gitlab.VISIBILITY_PUBLIC | ||
| 22 | + snippet.visibility_level = gitlab.Project.VISIBILITY_PUBLIC | ||
| 23 | 23 | snippet.save() | |
| 24 | 24 | # end update | |
| 25 | 25 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1026,7 +1026,7 @@ class Snippet(GitlabObject): | |||
| 1026 | 1026 | optionalUpdateAttrs = ['title', 'file_name', 'content', 'visibility_level'] | |
| 1027 | 1027 | shortPrintAttr = 'title' | |
| 1028 | 1028 | ||
| 1029 | - def content(self, streamed=False, action=None, chunk_size=1024, **kwargs): | ||
| 1029 | + def raw(self, streamed=False, action=None, chunk_size=1024, **kwargs): | ||
| 1030 | 1030 | """Return the raw content of a snippet. | |
| 1031 | 1031 | ||
| 1032 | 1032 | Args: | |
@@ -1038,14 +1038,13 @@ def content(self, streamed=False, action=None, chunk_size=1024, **kwargs): | |||
| 1038 | 1038 | chunk_size (int): Size of each chunk. | |
| 1039 | 1039 | ||
| 1040 | 1040 | Returns: | |
| 1041 | - str: The snippet content | ||
| 1041 | + str: The snippet content. | ||
| 1042 | 1042 | ||
| 1043 | 1043 | Raises: | |
| 1044 | 1044 | GitlabConnectionError: If the server cannot be reached. | |
| 1045 | 1045 | GitlabGetError: If the server fails to perform the request. | |
| 1046 | 1046 | """ | |
| 1047 | - url = ("/snippets/%(snippet_id)s/raw" % | ||
| 1048 | - {'snippet_id': self.id}) | ||
| 1047 | + url = ("/snippets/%(snippet_id)s/raw" % {'snippet_id': self.id}) | ||
| 1049 | 1048 | r = self.gitlab._raw_get(url, **kwargs) | |
| 1050 | 1049 | raise_error_from_response(r, GitlabGetError) | |
| 1051 | 1050 | return utils.response_content(r, streamed, action, chunk_size) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -483,9 +483,9 @@ def resp_content_fail(self, url, request): | |||
| 483 | 483 | def test_content(self): | |
| 484 | 484 | with HTTMock(self.resp_content): | |
| 485 | 485 | data = b'content' | |
| 486 | - content = self.obj.content() | ||
| 486 | + content = self.obj.raw() | ||
| 487 | 487 | self.assertEqual(content, data) | |
| 488 | 488 | ||
| 489 | 489 | def test_blob_fail(self): | |
| 490 | 490 | with HTTMock(self.resp_content_fail): | |
| 491 | - self.assertRaises(GitlabGetError, self.obj.content) | ||
| 491 | + self.assertRaises(GitlabGetError, self.obj.raw) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments