Skip to content

Conversation

@uxairibrar
Copy link
Collaborator

@uxairibrar uxairibrar commented Feb 13, 2025

Closes #49

  • Implemented GeoRSS feed for publications.
  • Handled Point, Polygon, and GeometryCollection types.
  • Fixed missing georss:point and georss:polygon in RSS output.
  • Overrode add_item_elements() to ensure GeoRSS tags appear in XML.
  • Added GeoRSS namespace (xmlns:georss) for standard compliance.
  • Filtered publications with valid geometry and URLs to prevent errors.
  • Tested and debugged feed output to confirm correct GeoRSS structure

Copy link
Member

@nuest nuest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

To really judge if this is generating output as expected, please add a test case!

tests/test_publications_api.py should be a good starting point. The test should insert some test data (with different geometries) and then check if the created feed content is as expected. You can also store the generated XML in a file as a reference compare the two files, that is also pretty illustrating.

@nuest nuest changed the title Feed for all publications #49 Feed for all publications Feb 21, 2025
@uxairibrar
Copy link
Collaborator Author

I have updated the code and added the test case, I just wanted to ask, should I delete the generated XML after comparing the results?

Copy link
Member

@nuest nuest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're getting there 😄 See my review comments below, and also the PR comment at #88 (comment)


self.maxDiff = None

self.assertEqual(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle this is good enough to catch if something changed, and I agree it will likely work in most cirumstances.

However, I see a case where this might fail and we can also provide more helpful output to see what is different between the files. This might fail on a different operating system or with a different underlying XML library, e.g., the whitespace might be different.

Please give https://xmldiff.readthedocs.io/en/stable/api.html and https://github.com/Exirel/python-xmlunittest/tree/master a try and decide to use one (or both) to create more meaningful failure outputs (which elements in the XML changed how).

The former even allows to validate against a schema, so we can double-check that the XML files are valid. We can assume that Django generates valid stuff, but it doesn't hurt to make sure.

Let me know if you need help digging up the schema locations. The validation could work against a URL, but it is certainly more performant when we save the schema files in our test directory. They are probably big, but we only need to add them once...

@nuest
Copy link
Member

nuest commented Mar 7, 2025

Please commit the reference file to the repo, and yes, delete the generated one.

Or event better: create it in a temp directory and the forget about it, see https://docs.pytest.org/en/6.2.x/tmpdir.html (see the end of that page for the deletion policy of pytest). The fixtures seem to be pretty straightforward to use.

@uxairibrar uxairibrar marked this pull request as draft March 19, 2025 00:46
@nuest
Copy link
Member

nuest commented Mar 19, 2025

@uxairibrar unit tests are running again.

@uxairibrar uxairibrar marked this pull request as ready for review April 4, 2025 13:46
@nuest nuest merged commit 882f5fb into main Apr 4, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feed for all publications

3 participants