From 317221d21c5b194fc9f1223166e8d7248a2a24a0 Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Fri, 10 Apr 2009 08:01:25 +0000 Subject: [PATCH] removed old .attribute() API from doc - it will be restored in the future when adaptors code get stable --HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%401040 --- scrapy/trunk/docs/ref/spiders.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scrapy/trunk/docs/ref/spiders.rst b/scrapy/trunk/docs/ref/spiders.rst index 503a8aa0e..ee5033e8f 100644 --- a/scrapy/trunk/docs/ref/spiders.rst +++ b/scrapy/trunk/docs/ref/spiders.rst @@ -173,9 +173,9 @@ Let's now take a look at an example CrawlSpider with rules:: hxs = HtmlXPathSelector(response) item = ScrapedItem() - item.attribute('id', hxs.x('//td[@id="item_id"]/text()').re(r'ID: (\d+)')) - item.attribute('name', hxs.x('//td[@id="item_name"]/text()')) - item.attributE('description', hxs.x('//td[@id="item_description"]/text()')) + item.id = hxs.x('//td[@id="item_id"]/text()').re(r'ID: (\d+)') + item.name = hxs.x('//td[@id="item_name"]/text()').extract() + item.description = hxs.x('//td[@id="item_description"]/text()').extract() return [item] SPIDER = MySpider() @@ -269,9 +269,9 @@ These spiders are pretty easy to use, let's have at one example:: log.msg('Hi, this is a <%s> node!: %s' % (self.itertag, ''.join(node.extract()))) item = ScrapedItem() - item.attribute('id', node.x('@id')) - item.attribute('name', node.x('name')) - item.attribute('description', node.x('description')) + item.id = node.x('@id').extract() + item.name = node.x('name').extract() + item.description = node.x('description').extract() return item SPIDER = MySpider() @@ -329,9 +329,9 @@ Let's see an example similar to the previous one, but using CSVFeedSpider:: log.msg('Hi, this is a row!: %r' % row) item = ScrapedItem() - item.attribute('id', row['id']) - item.attribute('name', row['name']) - item.attribute('description', row['description']) + item.id = row['id'] + item.name = row['name'] + item.description = row['description'] return item SPIDER = MySpider()