Commit edbe175f authored by Sebastian Humenda's avatar Sebastian Humenda

update fetchdictdata.py helper script

parent 7e5bc825
freedict-tools (0.5.0~beta.2-3) unstable; urgency=medium
* package helper script bug fix: correctly include or deny dictionaries on
given filter criteria
-- Sebastian Humenda <shumenda@gmx.de> Fri, 02 Nov 2018 19:11:04 +0100
freedict-tools (0.5.0~beta.2-2) unstable; urgency=medium
* backport upstream patch to avoid encoding issues with teiaddphonetics for
......
......@@ -70,7 +70,7 @@ Index: freedict-tools/fetchdictdata.py
+def get_xml_content(fetch_new=False):
+ """Either read contents of freedict-database.xml or fetch it from the web
+first and save it."""
+ if fetch_new:
+ if fetch_new or not os.path.exists('debian/freedict-database.xml'):
+ data = urllib.request.urlopen(XML_URL).read().decode('utf-8')
+ open("debian/freedict-database.xml", "w", encoding="utf-8").write(data)
+ else: # read from file
......@@ -391,11 +391,11 @@ Index: freedict-tools/fetchdictdata.py
+
+ def matches(self, dictnode):
+ if not self.__attr:
+ print(dictnode.attrib['name'],self.__attr)
+ return True # include this one, no attribute specified
+ attr = dictnode.get(self.__attr)
+ if not attr:
+ return True
+ if not attr:
+ # **only** include positive matches, yet nothing to match on found
+ return (False if self.__delim == ':' else True)
+ if self.__delim == ':':
+ return bool(self.__rgx.search(attr))
+ return not bool(self.__rgx.search(attr))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment