From 05d906148ac7d27c93775a3fad00ddf6aedeb9ba Mon Sep 17 00:00:00 2001 From: Langenfeld Date: Fri, 12 Nov 2021 18:33:21 +0100 Subject: [PATCH] fixed trying to parse more gitea payloadcommit objects where there are non (e.g. listing commits) data is assigned to a inner_commit dictionary as commit is already taken by apiobject commit function and fixing that would cause too many things to break --- gitea/gitea.py | 5 ++++- setup.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gitea/gitea.py b/gitea/gitea.py index 3b00933..4551749 100644 --- a/gitea/gitea.py +++ b/gitea/gitea.py @@ -240,7 +240,8 @@ class Branch(GiteaApiObject): return hash(self.commit) ^ hash(self.name) fields_to_parsers = { - "commit": lambda gitea, c: Commit.parse_response(gitea, c) + # This is not a commit object + #"commit": lambda gitea, c: Commit.parse_response(gitea, c) } @classmethod @@ -561,8 +562,10 @@ class Commit(GiteaApiObject): @classmethod def parse_response(cls, gitea, result): + commit_cache = result["commit"] api_object = cls(gitea) cls._initialize(gitea, api_object, result) + BasicGiteaApiObject._add_readonly_property("inner_commit", commit_cache, api_object) return api_object diff --git a/setup.py b/setup.py index 5cdecd0..2d2aedb 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open('README.md') as readme_file: setup_args = dict( name='py-gitea', - version='0.1.7', + version='0.1.8', description='A python wrapper for the Gitea API', long_description_content_type="text/markdown", long_description=README,