From 8cb7002fe64744b2c7ecfdd8a117d335198993c3 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 3 Oct 2020 16:56:07 +0200 Subject: [PATCH] feeds: make it possible to append empty items And return the newly appended items, to make it easy to edit them --- morss/feeds.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/morss/feeds.py b/morss/feeds.py index 2a283f1..1db885e 100644 --- a/morss/feeds.py +++ b/morss/feeds.py @@ -668,9 +668,6 @@ class Feed(object): self.rule_create(self.rules['items']) item = self.items[-1] - if new is None: - return - for attr in self.itemsClass.dic: try: setattr(item, attr, getattr(new, attr)) @@ -682,6 +679,8 @@ class Feed(object): except (IndexError, TypeError): pass + return item + def __getitem__(self, key): return self.wrap_items(self.get_raw('items'))[key]