Make LineConfigParser iterable.
This commit is contained in:
parent
267552fe77
commit
f3fd247282
@ -34,7 +34,7 @@ class CookieJar(QNetworkCookieJar):
|
||||
datadir = get_standard_dir(QStandardPaths.DataLocation)
|
||||
self._linecp = LineConfigParser(datadir, 'cookies')
|
||||
cookies = []
|
||||
for line in self._linecp.data:
|
||||
for line in self._linecp:
|
||||
cookies += QNetworkCookie.parseCookies(line.encode('utf-8'))
|
||||
self.setAllCookies(cookies)
|
||||
|
||||
|
@ -51,6 +51,10 @@ class LineConfigParser:
|
||||
logging.debug("Reading config from {}".format(self._configfile))
|
||||
self.read(self._configfile)
|
||||
|
||||
def __iter__(self):
|
||||
"""Iterate over the set data."""
|
||||
return self.data.__iter__()
|
||||
|
||||
def read(self, filename):
|
||||
"""Read the data from a file."""
|
||||
with open(filename, 'r', encoding='utf-8') as f:
|
||||
|
Loading…
Reference in New Issue
Block a user