added __slots__ to XPathSelector and Libxml2Document classes

This commit is contained in:
Pablo Hoffman 2009-08-18 19:57:05 -03:00
parent 64ffe6b2d3
commit 00527fc93c
2 changed files with 3 additions and 0 deletions

View File

@ -10,6 +10,7 @@ from scrapy.xpath.factories import xmlDoc_from_html
class Libxml2Document(object):
cache = weakref.WeakKeyDictionary()
__slots__ = ['xmlDoc', 'xpathContext']
def __new__(cls, response, factory=xmlDoc_from_html):
cache = cls.cache.setdefault(response, {})

View File

@ -16,6 +16,8 @@ from scrapy.utils.decorator import deprecated
class XPathSelector(object_ref):
__slots__ = ['doc', 'xmlNode', 'response', 'expr']
def __init__(self, response=None, text=None, node=None, parent=None, expr=None):
if parent:
self.doc = parent.doc