def next(self):
     while 1:
         if self._i is None:
             item = self._c.next()
             if item is None:
                 self.close()
                 raise StopIteration()
             domain, data = item
             self._i = MappingIterator(pickle.loads(data))
         try:
             return self._i.next()
         except StopIteration:
             self._i = None
             continue
Exemplo n.º 2
0
class BSDDBIterator:
    # XXXX should this use thread lock?
    def __init__(self, cursor):
        iterator = None
        self._c = cursor
        self._i = iterator
    def __iter__(self): return self
    def close(self):
        if self._c is not None:
            self._c.close()
        self._c = self._i = self.next = self.__iter__ = None
    def next(self):
        while 1:
            if self._i is None:
                item = self._c.next()
                if item is None:
                    self.close()
                    raise StopIteration()
                domain, data = item
                self._i = MappingIterator(pickle.loads(data))
            try:
                return self._i.next()
            except StopIteration:
                self._i = None
                continue
    def __del__(self):
        # XXXX will this work?
        self.close()
class BSDDBIterator:
    # XXXX should this use thread lock?
    def __init__(self, cursor):
        iterator = None
        self._c = cursor
        self._i = iterator

    def __iter__(self):
        return self

    def close(self):
        if self._c is not None:
            self._c.close()
        self._c = self._i = self.next = self.__iter__ = None

    def next(self):
        while 1:
            if self._i is None:
                item = self._c.next()
                if item is None:
                    self.close()
                    raise StopIteration()
                domain, data = item
                self._i = MappingIterator(pickle.loads(data))
            try:
                return self._i.next()
            except StopIteration:
                self._i = None
                continue

    def __del__(self):
        # XXXX will this work?
        self.close()
Exemplo n.º 4
0
    def __iter__(self):
        # session (non-persistent) cookies
        for cookie in MappingIterator(self._cookies):
            yield cookie
        # persistent cookies
        for row in self._query("""\
SELECT * FROM moz_cookies ORDER BY name, path, host"""):
            yield self._cookie_from_row(row)
Exemplo n.º 5
0
 def next(self):
     while 1:
         if self._i is None:
             item = self._c.next()
             if item is None:
                 self.close()
                 raise StopIteration()
             domain, data = item
             self._i = MappingIterator(pickle.loads(data))
         try:
             return self._i.next()
         except StopIteration:
             self._i = None
             continue