Example #1
0
 def __new__(cls, response, factory=xmlDoc_from_html):
     cache = cls.cache.setdefault(response, {})
     if factory not in cache:
         obj = object_ref.__new__(cls)
         obj.xmlDoc = factory(response)
         obj.xpathContext = obj.xmlDoc.xpathNewContext()
         cache[factory] = obj
     return cache[factory]
Example #2
0
 def __new__(cls, response, factory=xmlDoc_from_html):
     cache = cls.cache.setdefault(response, {})
     if factory not in cache:
         obj = object_ref.__new__(cls)
         obj.xmlDoc = factory(response)
         obj.xpathContext = obj.xmlDoc.xpathNewContext()
         cache[factory] = obj
     return cache[factory]
Example #3
0
 def __new__(cls, response, parser=etree.HTMLParser):
     cache = cls.cache.setdefault(response, {})
     if parser not in cache:
         obj = object_ref.__new__(cls)
         cache[parser] = _factory(response, parser)
     return cache[parser]
 def __new__(cls, response, parser=etree.HTMLParser):
     cache = cls.cache.setdefault(response, {})
     if parser not in cache:
         obj = object_ref.__new__(cls)
         cache[parser] = _factory(response, parser)
     return cache[parser]