Skip to content

Instantly share code, notes, and snippets.

@mattpat
Created May 5, 2011 05:42
Show Gist options
  • Save mattpat/956593 to your computer and use it in GitHub Desktop.
Save mattpat/956593 to your computer and use it in GitHub Desktop.
Closure black magic
for x in entrySelectors:
datetext = x.select('.//pubDate/text()').extract()
datetext = u'0000-00-00 00:00:00+00:00' if len(datetext)<1 else dateutil.parser.parse(datetext[0])
templist = x.select('.//link["nytimes.com/"]/text()').extract()
if len(templist)>0 :
def cb(tx):
return lambda r: self.check_call(r, tx)
links.append(templist[0])
#tx = str(copy.deepcopy(datetext))
newitem = Request(templist[0], callback=cb(datetext))
itemlist.append( newitem)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment