From 8eab5802cdc33e1e7b26c4f891dcb6b6baa98df5 Mon Sep 17 00:00:00 2001 From: elpolilla Date: Wed, 26 Nov 2008 16:09:39 +0000 Subject: [PATCH] Fixed bug in item.attribute --HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40432 --- scrapy/trunk/scrapy/item/models.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scrapy/trunk/scrapy/item/models.py b/scrapy/trunk/scrapy/item/models.py index ad34aafe2..c30286d15 100644 --- a/scrapy/trunk/scrapy/item/models.py +++ b/scrapy/trunk/scrapy/item/models.py @@ -44,16 +44,15 @@ class ScrapedItem(object): if val or val is False: curr_val = getattr(self, attrname, None) if not curr_val: - newval = val + setattr(self, attrname, val) else: if override: - newval = val + setattr(self, attrname, val) elif add: if all(isinstance(var, basestring) for var in (curr_val, val)): - newval = '%s %s' % (curr_val, val) + setattr(self, attrname, '%s\t%s' % (curr_val, val)) elif all(hasattr(var, '__iter__') for var in (curr_val, val)): - newval = curr_val + val - setattr(self, attrname, newval) + setattr(self, attrname, curr_val + val) elif value: setattr(self, attrname, value)