udata 11.0.0__py2.py3-none-any.whl → 11.0.1.dev37781__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of udata might be problematic. Click here for more details.

udata/__init__.py CHANGED
@@ -4,5 +4,5 @@
4
4
  udata
5
5
  """
6
6
 
7
- __version__ = "11.0.0"
7
+ __version__ = "11.0.1.dev"
8
8
  __description__ = "Open data portal"
udata/core/topic/forms.py CHANGED
@@ -58,24 +58,27 @@ class TopicForm(ModelForm):
58
58
  """Custom save to handle TopicElement creation properly"""
59
59
  # Store elements data before parent save
60
60
  elements_data = self.elements.data
61
+ # Check if elements field was explicitly provided
62
+ elements_provided = self.elements.has_data
61
63
 
62
64
  # Use parent save method (elements field is excluded via populate_obj)
63
65
  topic = super().save(commit=commit, **kwargs)
64
66
 
65
- # Clear existing elements before adding new ones
66
- if commit:
67
- TopicElement.objects(topic=topic).delete()
68
-
69
- # Create elements and associate them with the topic
70
- for element_data in elements_data or []:
71
- # Create element form with only its own data, not inheriting from parent
72
- element_form = TopicElementForm(meta={"csrf": False})
73
- element_form.process(data=element_data)
74
- if element_form.validate():
75
- element = element_form.save(commit=False)
76
- element.topic = topic
77
- if commit:
78
- element.save()
67
+ # Only clear and recreate elements if they were explicitly provided in the payload
68
+ if elements_provided:
69
+ if commit:
70
+ TopicElement.objects(topic=topic).delete()
71
+
72
+ # Create elements and associate them with the topic
73
+ for element_data in elements_data or []:
74
+ # Create element form with only its own data, not inheriting from parent
75
+ element_form = TopicElementForm(meta={"csrf": False})
76
+ element_form.process(data=element_data)
77
+ if element_form.validate():
78
+ element = element_form.save(commit=False)
79
+ element.topic = topic
80
+ if commit:
81
+ element.save()
79
82
 
80
83
  return topic
81
84
 
@@ -295,6 +295,32 @@ class TopicAPITest(APITestCase):
295
295
  topic.reload()
296
296
  self.assertEqual(len(topic.elements), initial_length + 1)
297
297
 
298
+ def test_topic_api_update_without_elements(self):
299
+ """It should update a topic without affecting existing elements when elements field is not provided"""
300
+ user = self.login()
301
+ topic = TopicWithElementsFactory(owner=user)
302
+ initial_element_ids = [str(elt.id) for elt in topic.elements]
303
+
304
+ # Update topic without including elements field
305
+ data = {
306
+ "name": "Updated topic name",
307
+ "description": "Updated description",
308
+ "tags": ["updated-tag"],
309
+ }
310
+ response = self.put(url_for("apiv2.topic", topic=topic), data)
311
+ self.assert200(response)
312
+
313
+ # Reload and verify elements are preserved
314
+ topic.reload()
315
+ self.assertEqual(len(topic.elements), len(initial_element_ids))
316
+ current_element_ids = [str(elt.id) for elt in topic.elements]
317
+ self.assertEqual(set(current_element_ids), set(initial_element_ids))
318
+
319
+ # Verify other fields were updated
320
+ self.assertEqual(topic.name, "Updated topic name")
321
+ self.assertEqual(topic.description, "Updated description")
322
+ self.assertEqual(topic.tags, ["updated-tag"])
323
+
298
324
  def test_topic_api_delete(self):
299
325
  """It should delete a topic from the API"""
300
326
  owner = self.login()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: udata
3
- Version: 11.0.0
3
+ Version: 11.0.1.dev37781
4
4
  Summary: Open data portal
5
5
  Home-page: https://github.com/opendatateam/udata
6
6
  Author: Opendata Team
@@ -142,6 +142,10 @@ It is collectively taken care of by members of the
142
142
 
143
143
  # Changelog
144
144
 
145
+ ## Current (in progress)
146
+
147
+ - fix: PUT topic without elements [#3424](https://github.com/opendatateam/udata/pull/3424)
148
+
145
149
  ## 11.0.0 (2025-09-12)
146
150
 
147
151
  - Change CSW harvesters XML processor from lxml to saxonche [#3380](https://github.com/opendatateam/udata/pull/3380)
@@ -1,6 +1,6 @@
1
1
  tasks/__init__.py,sha256=nfgZ5nkcoluXMIk52P4-8Rj6xL0Qlm_xSUfWW2aHZfI,8161
2
2
  tasks/helpers.py,sha256=70fS9tI_m0DTWmKx9Zl5-LG-nxdz_ZaPyvvsFkN2r48,1091
3
- udata/__init__.py,sha256=LAkbRT-GIi4wRq3UwGSKuqqSKlZ-fc5b1J3Pv6mlh2A,98
3
+ udata/__init__.py,sha256=UgwmZy0LzZPKZROkTHejn2B9IxW9rGd-86aLx8Oc2kI,102
4
4
  udata/api_fields.py,sha256=mRU3qRID_wlWA8cgjMvYtxv1hD0qDp9sdGBlz5SP5yc,34784
5
5
  udata/app.py,sha256=gRQSi4Scqu6rj0czVsmBRkNM4wNRkBhY7y7NWbqY8UM,7249
6
6
  udata/assets.py,sha256=H5Hrc2vnKM0IFLyWfLXmJ2Kj35w1i8W1D8Cgy8_cUj4,657
@@ -243,7 +243,7 @@ udata/core/topic/activities.py,sha256=Pcqhs-OxmSV2NlN18GyV12z9AW8tfS8glgwwmchcbp
243
243
  udata/core/topic/api_fields.py,sha256=4H904dYR62uhW7XXgCgOrlBwKjFE7h878hQgLbMpRXk,3327
244
244
  udata/core/topic/apiv2.py,sha256=RyJIA9UEMURyyuh4gt_yHkAxIM2OwUroGctp-1PVk94,6393
245
245
  udata/core/topic/factories.py,sha256=6UYvt4Rf0dxP1pec1ySQySiq82A58VN0uo-7mnbFnuw,2767
246
- udata/core/topic/forms.py,sha256=UV5t9qU51EcqOa-mygEvqZ5wi4oWKO69KxffccFWRbw,3244
246
+ udata/core/topic/forms.py,sha256=OkWFo0FkSnjZ2LURoq2i2cpingFz1TrOEI3TJ7qQ8pk,3465
247
247
  udata/core/topic/models.py,sha256=FdNJViwPNoPNfSdcvcCxI_dbQ71zdaj4wF9lRuGhd3I,3755
248
248
  udata/core/topic/parsers.py,sha256=leQtzLtEIV-0lCu_ibsygJoE2e6qAWzpDPer4BhPPjM,3878
249
249
  udata/core/topic/permissions.py,sha256=RtFPPlxuU_Bv7ip6LDO4AoPrKFnIOEs9cCMXaSSmEdk,118
@@ -675,7 +675,7 @@ udata/tests/apiv2/test_datasets.py,sha256=5HYB3UWWKRsIoLx007ZJ1Bx0IU7YzK-_z8VtoM
675
675
  udata/tests/apiv2/test_me_api.py,sha256=WgUjujSnIlISUkM5t-lfg-D0mmz-eX1hSsSwjuxqbJg,1417
676
676
  udata/tests/apiv2/test_organizations.py,sha256=os_43s-coSRqjgY-5fAjSiRlB3g2685u7d-Es0aOhks,6390
677
677
  udata/tests/apiv2/test_swagger.py,sha256=RKedaq-2UeyEuxlmUaAN7pmEe-lQYYmpDUVc8HF3CH4,785
678
- udata/tests/apiv2/test_topics.py,sha256=9-Szqw6B8647wOQgAUKN4BWzrdEc1g_iHufpgq_ZKd8,26710
678
+ udata/tests/apiv2/test_topics.py,sha256=TFipUDUIWRY8oT20GAwk3wH-u6z5eG9MJ3h0ZZEViE0,27862
679
679
  udata/tests/cli/test_cli_base.py,sha256=0a3U_5ROp1lCTG8d6TpCjF4nbKVNerAeLO0VxU-NTUk,321
680
680
  udata/tests/cli/test_db_cli.py,sha256=xFVHQAk2bmQQzFr31TK2JThOP6p0wvxzexMhM_IcdME,2219
681
681
  udata/tests/contact_point/test_contact_point_models.py,sha256=b8vraZPPrs9LeQMWLnOCrpI02sXMEM_BcMJXKTeAuAw,923
@@ -766,9 +766,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=U0abG-nBwCIoYxRZNsc4KOLeIRSqTV
766
766
  udata/translations/pt/LC_MESSAGES/udata.po,sha256=eCG35rMzYLHXyLbsnLSexS1g0N_K-WpNHqrt_8y6I4E,48590
767
767
  udata/translations/sr/LC_MESSAGES/udata.mo,sha256=IBcCAdmcvkeK7ZeRBNRI-wJ0jzWNM0eXM5VXAc1frWI,28692
768
768
  udata/translations/sr/LC_MESSAGES/udata.po,sha256=yFxHEEB4behNwQ7JnyoYheiCKLNnMS_NV4guzgyzWcE,55332
769
- udata-11.0.0.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
770
- udata-11.0.0.dist-info/METADATA,sha256=fXk8f7CKiMJHgUqLvUhTNOAoe1r_cO-EftdXXswSEy0,155224
771
- udata-11.0.0.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
772
- udata-11.0.0.dist-info/entry_points.txt,sha256=v2u12qO11i2lyLNIp136WmLJ-NHT-Kew3Duu8J-AXPM,614
773
- udata-11.0.0.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
774
- udata-11.0.0.dist-info/RECORD,,
769
+ udata-11.0.1.dev37781.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
770
+ udata-11.0.1.dev37781.dist-info/METADATA,sha256=y_Q3fPaqKsst_77ALWIC6htfAaQ59xnOR46evnFeAlE,155351
771
+ udata-11.0.1.dev37781.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
772
+ udata-11.0.1.dev37781.dist-info/entry_points.txt,sha256=v2u12qO11i2lyLNIp136WmLJ-NHT-Kew3Duu8J-AXPM,614
773
+ udata-11.0.1.dev37781.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
774
+ udata-11.0.1.dev37781.dist-info/RECORD,,