Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a SitemapBuildableView to generate a wagtail sitemap. #38

Closed
wants to merge 1 commit into from

Conversation

NDevox
Copy link

@NDevox NDevox commented Oct 13, 2018

This will fix #37.

@loicteixeira loicteixeira self-assigned this Nov 10, 2018
@loicteixeira
Copy link
Collaborator

loicteixeira commented Nov 28, 2018

Hi @NDevox, thank you for your contribution and sorry for the late review.

Unfortunately with Wagtail before 2.2, it fails with the following error AttributeError: 'WSGIRequest' object has no attribute 'site'. Indeed, as you can see here it tries to query the request's site in the view but this behaviour was changed in wagtail/wagtail@a3fe8eb which is included in Wagtail 2.2. It might simply be a matter of duplicating the new get_wagtail_site for versions prior to 2.2. However we might not need to do so as we might drop compatibility with Wagtail prior to 2.2 soon (see #36).

In addition, I didn't run tests for it yet but I suspect it won't be compatible with the multi-site option. As you can see, other views' build path differs whether we use multi sites:

https://github.com/wagtail/wagtail-bakery/blob/0937dde07d1791a3780079a1b6959eb0b9c43d55/src/wagtailbakery/views.py#L65-L69

@Benoss
Copy link

Benoss commented Sep 15, 2019

I am using part of your pull request as my own SitemapBuildableView works perfectly for my use case. Would be good to get this work with multisite and merged at some point.
The current LTS is 2.3 Dropping support for < 2.3 would make sense. This is also the last Wagtail version to support Django 1.11.

@loicteixeira
Copy link
Collaborator

I'm focussing on preparing the Wagtail repository for Hacktoberfest over the next couple weeks, then I'll work towards merging this and fixing other issues which have been reported.

@NDevox
Copy link
Author

NDevox commented Sep 27, 2019

@loicteixeira Sorry I dropped off on this one!

If we drop support for < 2.3 obviously that makes things simpler. I'll wait for your input on that one.

I've not tested for multisite, I've also not had to use it for wagtail before! I can give that an attempt and see what happens. My thought on this one would be what behaviour would be expected? A class that builds all sitemaps in one go? Would we want to allow sites to be filtered? or demand a specific class instance for each site?

@loicteixeira
Copy link
Collaborator

I'll update the test matrix as per #36 this week so you should be able to rebase on that after.

As for the expected behaviour, yes, one class which builds all sitemaps in one go, as does the base view:

https://github.com/wagtail/wagtail-bakery/blob/0937dde07d1791a3780079a1b6959eb0b9c43d55/src/wagtailbakery/views.py#L65-L69

@loicteixeira
Copy link
Collaborator

@NDevox I rebased & continued your work on the PR linked above which supersed this one. Thank you for getting this started.

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.

Add SitemapBuildableView
3 participants