added setadaptors method to ScrapedItem, removed incorrect constructor

--HG--
extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40306
This commit is contained in:
Pablo Hoffman 2008-10-06 03:22:05 +00:00
parent 9c19316d21
commit d6cbaab65b
1 changed files with 5 additions and 5 deletions

View File

@ -6,12 +6,12 @@ class ScrapedItem(object):
'guid' attribute is required, and is an attribute
that identifies uniquely the given scraped item.
"""
adaptors_pipe = AdaptorPipe()
def __init__(self, adaptors_pipe=None):
"""If an adaptors_pipe is given, overrides class adaptors_pipe"""
if adaptors_pipe:
self.adaptors_pipe = adaptors_pipe
def setadaptors(self, adaptors_dict):
"""Set adaptors to use for this item. Receives a dict of adaptors and
returns the item itself"""
self.adaptors_dict = AdaptorPipe(adaptors_dict)
return self
def attribute(self, attrname, value):
value = self.adaptors_pipe.execute(attrname, value)