Closed iranzo closed 5 years ago
Tried with pelican 4
Issue seems removed when removing in CATEGORY_FEED_ATOM|format(XXXX)
removing the |format part on the relevant category, etc makes issue go away
Can someone with more experience review implications to see if we should remove them?
Feeds seem to work fine for me: http://matija.suklje.name/
I’m currently at tag 1.3 / commit 7ec41570b6ba4d6832146e98b05a42066abd2511 (sad, I know; I really need to update). So if this stopped working, it’s a regression. OK, I updated to latest master / 8a0bde0de7d1e40a38f61527576262d83cacde5b and it still works.
These are my feed settings:
# Feeds
FEED_ALL_ATOM = 'feeds/all.atom.xml'
CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
TAG_FEED_ATOM = 'feeds/%s.atom.xml'
TRANSLATION_FEED_ATOM = None
With latest pelican (4.01) I do get %s as obsolete and use relevant slug
In my case it was latest pelican + latest elegant and got something similar with blueidea theme too
I’m on Pelican 3.7.1 (Debian stable). Perhaps that’s the issue?
The correct way to fix this is to change these two: (found in /templates/_includes/feeds_categories.html
)
{{ CATEGORY_FEED_ATOM|format(cat_name) }}
{{ CATEGORY_FEED_RSS|format(cat_name) }}
to these:
{{ CATEGORY_FEED_ATOM|format(slug=cat_name) }}
{{ CATEGORY_FEED_RSS|format(slug=cat_name) }}
This is mentioned in the 4.0 release docs: here
Some user-submitted themes use positional argument formatting on object-related feed URLs, which will cause sites to fail to build with: "TypeError: not all arguments converted during string formatting". In that case, the theme needs to be updated. For example, substitute TAG_FEED_ATOM|format(tag.slug) with TAG_FEED_ATOM|format(slug=tag.slug).
@AWegnerGitHub So, this is new in Pelican 4.0?
@AWegnerGitHub how does this change effect Pelican version 3.? Because if it breaks 3. then we should put this fix in "release 2.1" (which is about Pelican 4.0 support) and not 2.0.
This is Pelican 4.0 behavior (along with the switch from %s
to {slug}
). I am not in a position to test for several more hours on how the 3.7 vs 4.0 behavior is different. I suspect this may be something that is specific to pelican 4.0 though because of the change to using .format()
parameters
slug=cat_name
Seems that pelican 4.0.1 works fine with above change, how should this be addressed (based that our documentation is pulling from latest pelican and latest master for the build)?
Updated https://github.com/Pelican-Elegant/elegant/pull/197 to use the 4.0 approach
@AWegnerGitHub @silverhook can you review the changes?
If so, can you test it on pelican 3.7 or others to see if it works for you and can be added to master?
This approach does not work with 3.7.1 if we've converted the configuration line to use CATEGORY_FEED_ATOM = 'feeds/{slug}.atom.xml'
. It still fails with:
Traceback (most recent call last):
File "/home/andy/.virtualenvs/pelican_test/bin/pelican", line 11, in <module>
sys.exit(main())
File "/home/andy/.virtualenvs/pelican_test/lib/python3.6/site-packages/pelican/__init__.py", line 487, in main
pelican.run()
File "/home/andy/.virtualenvs/pelican_test/lib/python3.6/site-packages/pelican/__init__.py", line 179, in run
p.generate_output(writer)
File "/home/andy/.virtualenvs/pelican_test/lib/python3.6/site-packages/pelican/generators.py", line 599, in generate_output
self.generate_feeds(writer)
File "/home/andy/.virtualenvs/pelican_test/lib/python3.6/site-packages/pelican/generators.py", line 312, in generate_feeds
% cat.slug, feed_title=cat.name)
TypeError: not all arguments converted during string formatting
The problem is how the two version are doing string formatting.
This does work with 4.0.1 and the CATEGORY_FEED_ATOM = 'feeds/{slug}.atom.xml'
configuration entry.
I think we should hold off on merging this change until we support 4.0.x and make it explicit in our documentation that 4.0 support is coming. In that case, our documentation repository needs to be pinned to Pelican 3.7.1.
Elegant 2.0 should be ready "soon". If 2.1 is going to be getting us Pelican 4.0 compatibility, it isn't that far behind.
Not sure if templates can contain code for 'both' releases using one or the other, but that could be a mid-way, having both 'ifs' and use one approach or the other depending on pelican version
https://stackoverflow.com/questions/53363848/how-to-get-the-pelican-version-number-from-a-template and make that a requirement in pelicanconf for elegant and 'default' to '3.x' mode ?
Thanks a lot @AWegnerGitHub for taking the time to test with old version.
@iranzo That's smart. But lets not do that. I am sure most users will upgrade to Pelican 4. And if some user holds back, the can use our 2.0 release. (We will use tags for releases, users will not any problem in downloading an older release of Elegant.)
The only reason we are having this discussion is because we need to release 2.0 ASAP, a goal which is not far away, thanks to generous contributions of you guys.
Close via b2397e8f9d2095952f98bcd83685ef33ec6e43fd
@AWegnerGitHub you have been contributing regularly, since the project management has changed. Is it ok if we add you as member of the organization?
What it entails is that we would be able to assign issues to you, request you to review PR. You can continue working at your own pace, there is no rush or deadlines. But we would know @AWegnerGitHub is responsible for so and so issue/review and he will eventually get back to us on it. This would be a great help for all of us.
@silverhook @iranzo and @calfzhou feel free to chime in.
+1 from me
@talha131 That sounds good. I can provide reviews as needed and continue to contribute as I have been.
Appreciated! I have invited you. Let me know if you didn't receive the invitation.
You can also visit the following link to accept the invitation.
A belated +1 from me too.
Hi If I do set RSS feeds generation for anything other than ALL:
I do get a pelican traceback: