Skip to content

Commit cadcf22

Browse files
[Fixes #107] Bug: patching not working properly
2 parents da634a7 + 6a02375 commit cadcf22

File tree

6 files changed

+22
-29
lines changed

6 files changed

+22
-29
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
88

99
[project]
1010
name = 'geonodectl'
11-
version="0.3.0"
11+
version="0.3.1"
1212
description="a commandline interface tool for Geonode Rest API v2"
1313
authors = [{ name = "marcel wallschlaeger", email="marcel.wallschlaeger@zalf.de" }]
1414
readme = "README.md"

src/geonoderest/datasets.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,18 @@ def upload(
176176
content_length=content_length,
177177
)
178178

179-
180-
def patch(
181-
self,
182-
pk: int,
183-
json_content: Optional[Dict] = None,
184-
**kwargs,
185-
):
186-
# remove attribute fields if present
187-
if json_content is not None and "attribute" in json_content:
188-
json_content.pop("attribute", None)
189-
if json_content is not None and "attribute_set" in json_content:
190-
json_content.pop("attribute_set", None)
191-
192-
return super(GeonodeResourceHandler, self).patch(
193-
pk=pk, json_content=json_content, **kwargs
194-
)
179+
def patch(
180+
self,
181+
pk: int,
182+
json_content: Optional[Dict] = None,
183+
**kwargs,
184+
):
185+
# remove attribute fields if present
186+
if json_content is not None and "attribute" in json_content:
187+
json_content.pop("attribute", None)
188+
if json_content is not None and "attribute_set" in json_content:
189+
json_content.pop("attribute_set", None)
190+
191+
return super(GeonodeResourceHandler, self).patch(
192+
pk=pk, json_content=json_content, **kwargs
193+
)

src/geonoderest/geonodectl.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,6 @@ def geonodectl():
10841084
raise NameError(
10851085
f"provided geonode url: {url} not ends with 'api/v2/'. Please make sure to provide full rest v2api url ..."
10861086
)
1087-
10881087
geonode_env = GeonodeApiConf(url=url, auth_basic=basic, verify=args.ssl_verify)
10891088
g_obj: Union[GeonodeObjectHandler, GeonodeExecutionRequestHandler]
10901089
match args.command:

src/geonoderest/geonodeobject.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ def patch(
132132
json_content: Optional[Dict] = None,
133133
**kwargs,
134134
):
135-
obj = self.http_patch(endpoint=f"{self.ENDPOINT_NAME}/{pk}/", json=json_content)
135+
obj = self.http_patch(
136+
endpoint=f"{self.ENDPOINT_NAME}/{pk}/", json_content=json_content
137+
)
136138
return obj
137139

138140
def cmd_describe(self, pk: int, **kwargs):

src/geonoderest/maps.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,3 @@ def create(
310310
if r is None:
311311
return None
312312
return r[self.SINGULAR_RESOURCE_NAME]
313-
314-
# def patch(
315-
# self,
316-
# pk: int,
317-
# json_content: Optional[Dict] = None,
318-
# **kwargs,
319-
# ):
320-
# obj = self.http_patch(endpoint=f"resources/{pk}/", json=json_content)
321-
# return obj

src/geonoderest/users.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ def patch(
157157
# The JSON content is sent as part of the request parameters.
158158
# The response from the API is returned.
159159

160-
obj = self.http_patch(endpoint=f"{self.ENDPOINT_NAME}/{pk}/", json=json_content)
160+
obj = self.http_patch(
161+
endpoint=f"{self.ENDPOINT_NAME}/{pk}/", json_content=json_content
162+
)
161163
return obj
162164

163165
def cmd_create(

0 commit comments

Comments
 (0)