feeds: make it possible to append empty items
And return the newly appended items, to make it easy to edit themmaster
parent
6966e03bef
commit
8cb7002fe6
|
@ -668,9 +668,6 @@ class Feed(object):
|
||||||
self.rule_create(self.rules['items'])
|
self.rule_create(self.rules['items'])
|
||||||
item = self.items[-1]
|
item = self.items[-1]
|
||||||
|
|
||||||
if new is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
for attr in self.itemsClass.dic:
|
for attr in self.itemsClass.dic:
|
||||||
try:
|
try:
|
||||||
setattr(item, attr, getattr(new, attr))
|
setattr(item, attr, getattr(new, attr))
|
||||||
|
@ -682,6 +679,8 @@ class Feed(object):
|
||||||
except (IndexError, TypeError):
|
except (IndexError, TypeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
return item
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
return self.wrap_items(self.get_raw('items'))[key]
|
return self.wrap_items(self.get_raw('items'))[key]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue