From cc78b0df90ac047559b0e42d58fb13e587664081 Mon Sep 17 00:00:00 2001 From: rpsh Date: Thu, 10 Aug 2023 15:46:17 +0800 Subject: [PATCH 01/11] Fix issue where "CDATA" was incorrectly used as content type in atom format entries --- feedgen/entry.py | 2 +- tests/test_entry.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/feedgen/entry.py b/feedgen/entry.py index 66400ba..7b9fd3b 100644 --- a/feedgen/entry.py +++ b/feedgen/entry.py @@ -54,7 +54,7 @@ def _add_text_elm(entry, data, name): ) # Add type description of the content if type_: - elm.attrib['type'] = type_ + elm.attrib['type'] = 'html' if type_ == 'CDATA' else type_ class FeedEntry(object): diff --git a/tests/test_entry.py b/tests/test_entry.py index 5eaeffa..113f53a 100644 --- a/tests/test_entry.py +++ b/tests/test_entry.py @@ -163,7 +163,7 @@ def test_content_cdata_type(self): fe.title('some title') fe.content('content', type='CDATA') result = fg.atom_str() - assert b'' in result + assert b'' in result def test_summary_html_type(self): fg = FeedGenerator() From 35b6905e99dc1c1a0de6364c2c6b543740edd4b4 Mon Sep 17 00:00:00 2001 From: Seth Golub Date: Thu, 7 Mar 2024 09:58:04 -0800 Subject: [PATCH 02/11] Support setting entry title type and using it for Atom feeds. --- feedgen/entry.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/feedgen/entry.py b/feedgen/entry.py index 5dd21c2..5d9d7ac 100644 --- a/feedgen/entry.py +++ b/feedgen/entry.py @@ -67,6 +67,7 @@ def __init__(self): # required self.__atom_id = None self.__atom_title = None + self.__atom_title_type = None self.__atom_updated = datetime.now(dateutil.tz.tzutc()) # recommended @@ -106,7 +107,10 @@ def atom_entry(self, extensions=True): raise ValueError('Required fields not set') id = xml_elem('id', entry) id.text = self.__atom_id - title = xml_elem('title', entry) + if self.__atom_title_type is not None: + title = xml_elem('title', entry, type=self.__atom_title_type) + else: + title = xml_elem('title', entry) title.text = self.__atom_title updated = xml_elem('updated', entry) updated.text = self.__atom_updated.isoformat() @@ -260,7 +264,7 @@ def rss_entry(self, extensions=True): return entry - def title(self, title=None): + def title(self, title=None, ttype=None): '''Get or set the title value of the entry. It should contain a human readable title for the entry. Title is mandatory for both ATOM and RSS and should not be blank. @@ -271,6 +275,9 @@ def title(self, title=None): if title is not None: self.__atom_title = title self.__rss_title = title + if ttype not in ('text', 'html', 'xhtml', None): + raise ValueError('title type must be text, html, or xhtml') + self.__atom_title_type = ttype return self.__atom_title def id(self, id=None): From 659cabaf64ff6b274415fd487138cd907f9ae568 Mon Sep 17 00:00:00 2001 From: loginus <207249+loginus@users.noreply.github.com> Date: Thu, 4 Jul 2024 12:12:42 +0200 Subject: [PATCH 03/11] ISSUE-135: BUGFIX: Fix link attributes rendering --- feedgen/entry.py | 12 ++++++------ tests/test_feed.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/feedgen/entry.py b/feedgen/entry.py index 5dd21c2..0b662ac 100644 --- a/feedgen/entry.py +++ b/feedgen/entry.py @@ -137,17 +137,17 @@ def atom_entry(self, extensions=True): _add_text_elm(entry, self.__atom_content, 'content') for link in self.__atom_link or []: - link = xml_elem('link', entry, href=link['href']) + _link = xml_elem('link', entry, href=link['href']) if link.get('rel'): - link.attrib['rel'] = link['rel'] + _link.attrib['rel'] = link['rel'] if link.get('type'): - link.attrib['type'] = link['type'] + _link.attrib['type'] = link['type'] if link.get('hreflang'): - link.attrib['hreflang'] = link['hreflang'] + _link.attrib['hreflang'] = link['hreflang'] if link.get('title'): - link.attrib['title'] = link['title'] + _link.attrib['title'] = link['title'] if link.get('length'): - link.attrib['length'] = link['length'] + _link.attrib['length'] = link['length'] _add_text_elm(entry, self.__atom_summary, 'summary') diff --git a/tests/test_feed.py b/tests/test_feed.py index d09014d..97ce363 100644 --- a/tests/test_feed.py +++ b/tests/test_feed.py @@ -75,6 +75,11 @@ def setUp(self): self.webMaster = 'webmaster@example.com' + self.entry1id = 'http://example.com/1' + self.link2Entry1length = 123456 + self.link2entry1type = 'audio/opus' + self.link2entry1url = 'http://example.com/enclosure.opus' + fg.id(self.feedId) fg.title(self.title) fg.author(self.author) @@ -112,6 +117,13 @@ def setUp(self): height='123', description='Example Inage') + fe = fg.add_entry() + fe.id(self.entry1id) + fe.title('Some Testfeed') + fe.updated('2024-02-05 13:26:58+01:00') + fe.link(href=self.entry1id, rel=self.linkRel) + fe.enclosure(url=self.link2entry1url, length=('%d' % self.link2Entry1length), type=self.link2entry1type) + self.fg = fg def test_baseFeed(self): @@ -284,6 +296,30 @@ def checkAtomString(self, atomString): ), ( feed.find(f"{nsAtom}rights").text, self.copyright + ), ( + feed.findall(f"{nsAtom}entry")[0].find(f"{nsAtom}id").text, + self.entry1id + ), ( + len(feed.findall(f"{nsAtom}entry")[0].findall(f"{nsAtom}link")), + 2 + ), ( + feed.findall(f"{nsAtom}entry")[0].findall(f"{nsAtom}link")[0].get("href"), + self.entry1id + ), ( + feed.findall(f"{nsAtom}entry")[0].findall(f"{nsAtom}link")[0].get("rel"), + self.linkRel + ), ( + feed.findall(f"{nsAtom}entry")[0].findall(f"{nsAtom}link")[1].get("href"), + self.link2entry1url + ), ( + feed.findall(f"{nsAtom}entry")[0].findall(f"{nsAtom}link")[1].get("rel"), + 'enclosure' + ), ( + feed.findall(f"{nsAtom}entry")[0].findall(f"{nsAtom}link")[1].get("type"), + self.link2entry1type + ), ( + int(feed.findall(f"{nsAtom}entry")[0].findall(f"{nsAtom}link")[1].get("length")), + self.link2Entry1length )] for actual, expected in testcases: self.assertEqual(actual, expected) From 25413d56517b5fcc2e454c363d9fd596762db0c9 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 17 Feb 2026 22:27:47 +0100 Subject: [PATCH 04/11] chore(gitignore): Ignore build and dist directories --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index af64cfd..8870ab6 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ tmp_Rssfeed.xml # testing artifacts .coverage *.egg-info/ +build/ +dist/ From 949b37f2c74faf8d681ff814c7ced823b0935d36 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 17 Feb 2026 22:36:46 +0100 Subject: [PATCH 05/11] build(general): Updated project metadata - PyPI package renamed: `feedgen` -> `feedgen2` - Replaced links to the original project with links to the fork --- feedgen/version.py | 27 +++++++++--------- python-feedgen.spec | 12 +++++--- setup.py | 68 +++++++++++++++++++++++---------------------- 3 files changed, 57 insertions(+), 50 deletions(-) diff --git a/feedgen/version.py b/feedgen/version.py index c8f76bf..72092c2 100644 --- a/feedgen/version.py +++ b/feedgen/version.py @@ -1,25 +1,26 @@ # -*- coding: utf-8 -*- -''' - feedgen.version - ~~~~~~~~~~~~~~~ +""" +feedgen.version +~~~~~~~~~~~~~~~ - :copyright: 2013-2018, Lars Kiesow +:copyright: 2013-2018, Lars Kiesow +:copyright: 2026, Fabio Manganiello - :license: FreeBSD and LGPL, see license.* for more details. +:license: FreeBSD and LGPL, see license.* for more details. -''' +""" -'Version of python-feedgen represented as tuple' -version = (1, 0, 0) +"Version of feedgen2 represented as tuple" +version = (2, 0, 0) -'Version of python-feedgen represented as string' -version_str = '.'.join([str(x) for x in version]) +"Version of feedgen2 represented as string" +version_str = ".".join([str(x) for x in version]) version_major = version[:1] version_minor = version[:2] version_full = version -version_major_str = '.'.join([str(x) for x in version_major]) -version_minor_str = '.'.join([str(x) for x in version_minor]) -version_full_str = '.'.join([str(x) for x in version_full]) +version_major_str = ".".join([str(x) for x in version_major]) +version_minor_str = ".".join([str(x) for x in version_minor]) +version_full_str = ".".join([str(x) for x in version_full]) diff --git a/python-feedgen.spec b/python-feedgen.spec index a137396..54450ed 100644 --- a/python-feedgen.spec +++ b/python-feedgen.spec @@ -1,5 +1,5 @@ -%global pypi_name feedgen -%global pypi_version 1.0.0 +%global pypi_name feedgen2 +%global pypi_version 2.0.0 Name: python-%{pypi_name} Version: %{pypi_version} @@ -7,8 +7,7 @@ Release: 1%{?dist} Summary: Feed Generator (ATOM, RSS, Podcasts) License: BSD or LGPLv3 -URL: http://lkiesow.github.io/python-feedgen -#Source0: https://github.com/lkiesow/%{name}/archive/v%{version}.tar.gz +URL: https://github.com/blacklight/python-feedgen Source0: %{pypi_source} BuildArch: noarch @@ -56,6 +55,11 @@ rm -rf %{pypi_name}.egg-info %{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %changelog +* Tue Feb 17 2026 Fabio Manganiello - 2.0.0-1 +- Update to 2.0.0 +- Fork from https://github.com/lkiesow/python-feedgen +- Applied https://github.com/lkiesow/python-feedgen/pull/139 + * Mon Dec 25 2023 Lars Kiesow - 1.0.0-1 - Update to 1.0.0 - Removing support for Python 2 diff --git a/setup.py b/setup.py index a5e2021..01089d3 100755 --- a/setup.py +++ b/setup.py @@ -5,39 +5,40 @@ import feedgen.version -packages = ['feedgen', 'feedgen/ext'] +packages = ["feedgen", "feedgen/ext"] -setup(name='feedgen', - packages=packages, - version=feedgen.version.version_full_str, - description='Feed Generator (ATOM, RSS, Podcasts)', - author='Lars Kiesow', - author_email='lkiesow@uos.de', - url='https://lkiesow.github.io/python-feedgen', - keywords=['feed', 'ATOM', 'RSS', 'podcast'], - license='FreeBSD and LGPLv3+', - install_requires=['lxml', 'python-dateutil'], - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Intended Audience :: Information Technology', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: BSD License', - 'License :: OSI Approved :: GNU Lesser General Public License v3 ' + - 'or later (LGPLv3+)', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 3', - 'Topic :: Communications', - 'Topic :: Internet', - 'Topic :: Text Processing', - 'Topic :: Text Processing :: Markup', - 'Topic :: Text Processing :: Markup :: XML' - ], - test_suite="tests", - long_description='''\ +setup( + name="feedgen2", + packages=packages, + version=feedgen.version.version_full_str, + description="Feed Generator (ATOM, RSS, Podcasts)", + author="Fabio Manganiello", + author_email="fabio@manganiello.tech", + url="https://github.com/blacklight/python-feedgen", + keywords=["feed", "ATOM", "RSS", "podcast"], + license="FreeBSD and LGPLv3+", + install_requires=["lxml", "python-dateutil"], + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "License :: OSI Approved :: GNU Lesser General Public License v3 " + + "or later (LGPLv3+)", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 3", + "Topic :: Communications", + "Topic :: Internet", + "Topic :: Text Processing", + "Topic :: Text Processing :: Markup", + "Topic :: Text Processing :: Markup :: XML", + ], + test_suite="tests", + long_description="""\ Feedgenerator ============= @@ -48,4 +49,5 @@ It is licensed under the terms of both, the FreeBSD license and the LGPLv3+. Choose the one which is more convenient for you. For more details have a look at license.bsd and license.lgpl. -''') +""", +) From 0c124ac0e7825ce2a623dfb150c45f5f35f6f6c6 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 17 Feb 2026 22:47:02 +0100 Subject: [PATCH 06/11] chore(changelog): Updated CHANGELOG --- python-feedgen.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/python-feedgen.spec b/python-feedgen.spec index 54450ed..b0410f8 100644 --- a/python-feedgen.spec +++ b/python-feedgen.spec @@ -59,6 +59,7 @@ rm -rf %{pypi_name}.egg-info - Update to 2.0.0 - Fork from https://github.com/lkiesow/python-feedgen - Applied https://github.com/lkiesow/python-feedgen/pull/139 +- Applied https://github.com/lkiesow/python-feedgen/pull/123 * Mon Dec 25 2023 Lars Kiesow - 1.0.0-1 - Update to 1.0.0 From 6c668798bbf07ca6947884765a229856cc58a20f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 17 Feb 2026 22:48:05 +0100 Subject: [PATCH 07/11] chore(changelog): Updated CHANGELOG --- python-feedgen.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/python-feedgen.spec b/python-feedgen.spec index b0410f8..5b29d9c 100644 --- a/python-feedgen.spec +++ b/python-feedgen.spec @@ -60,6 +60,7 @@ rm -rf %{pypi_name}.egg-info - Fork from https://github.com/lkiesow/python-feedgen - Applied https://github.com/lkiesow/python-feedgen/pull/139 - Applied https://github.com/lkiesow/python-feedgen/pull/123 +- Applied https://github.com/lkiesow/python-feedgen/pull/137 * Mon Dec 25 2023 Lars Kiesow - 1.0.0-1 - Update to 1.0.0 From fe1a95e1493f2603a132d4d0040bb7fa88476d54 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 17 Feb 2026 22:52:14 +0100 Subject: [PATCH 08/11] fix(build): Fixed `intersphinx_mapping` to match the new format --- doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 4df01a6..4f93ee5 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -249,7 +249,7 @@ # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'http://docs.python.org/': None} +intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} # Include the GitHub readme file in index.rst From a922fa5a9d4a5344acf32acf81b7ab54b4581f0f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 17 Feb 2026 22:53:01 +0100 Subject: [PATCH 09/11] chore(gitignore): Ignore doc build files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 8870ab6..8fd7f17 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ tmp_Rssfeed.xml *.egg-info/ build/ dist/ +_build/ +/docs/ From 38c2c27864a8f5eac2038052efbf07272661bba5 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 17 Feb 2026 22:56:42 +0100 Subject: [PATCH 10/11] docs(readme): Added note about the fork and updated pip installation --- readme.rst | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/readme.rst b/readme.rst index 3edeaff..5d2c200 100644 --- a/readme.rst +++ b/readme.rst @@ -2,6 +2,18 @@ Feedgenerator ============= +------------ + +**NOTE**: This is a fork of `python-feedgen +`_, as the original version is no +longer maintained. + +It is not going to implement many major features, but it implements fixes and +improvements over the original version, it's compatible with newer versions of +its dependencies and it is fully compatible with the original version. + +------------ + This module can be used to generate web feeds in both ATOM and RSS format. It has support for extensions. Included is for example an extension to produce Podcasts. @@ -21,19 +33,11 @@ More details about the project: Installation ------------ -**Prebuild packages** - -If your distribution includes this project as package, like Fedora Linux does, -you can simply use your package manager to install the package. For example:: - - $ dnf install python3-feedgen - - **Using pip** You can also use pip to install the feedgen module. Simply run:: - $ pip install feedgen + $ pip install feedgen2 ------------- From bb20cd2779cc168b6cdaf86b5ef8693d4ca03104 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 17 Feb 2026 22:58:17 +0100 Subject: [PATCH 11/11] chore(version): Bumped version to 2.0.1 --- feedgen/version.py | 2 +- python-feedgen.spec | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/feedgen/version.py b/feedgen/version.py index 72092c2..e48d661 100644 --- a/feedgen/version.py +++ b/feedgen/version.py @@ -11,7 +11,7 @@ """ "Version of feedgen2 represented as tuple" -version = (2, 0, 0) +version = (2, 0, 1) "Version of feedgen2 represented as string" diff --git a/python-feedgen.spec b/python-feedgen.spec index 5b29d9c..0a7da15 100644 --- a/python-feedgen.spec +++ b/python-feedgen.spec @@ -1,5 +1,5 @@ %global pypi_name feedgen2 -%global pypi_version 2.0.0 +%global pypi_version 2.0.1 Name: python-%{pypi_name} Version: %{pypi_version} @@ -55,6 +55,10 @@ rm -rf %{pypi_name}.egg-info %{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %changelog +* Tue Feb 17 2026 Fabio Manganiello - 2.0.1-1 +- Update to 2.0.1 +- Updated README + * Tue Feb 17 2026 Fabio Manganiello - 2.0.0-1 - Update to 2.0.0 - Fork from https://github.com/lkiesow/python-feedgen