diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2003-11-06 16:39:04 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-11-06 16:39:04 +0800 |
commit | 665035daca3b08898e1d838d38c65fbe5f36ff95 (patch) | |
tree | f4f14a60607e560f8a5d38552d3f092248494560 /data/check-mime.py | |
parent | dfd17005ee1f28b31a3e07a31e0f2fc5afc70596 (diff) | |
download | gsoc2013-epiphany-665035daca3b08898e1d838d38c65fbe5f36ff95.tar.gz gsoc2013-epiphany-665035daca3b08898e1d838d38c65fbe5f36ff95.tar.zst gsoc2013-epiphany-665035daca3b08898e1d838d38c65fbe5f36ff95.zip |
Add a list of permissions for mime and a script to update it (py hackers
2003-11-06 Marco Pesenti Gritti <marco@gnome.org>
* data/Makefile.am:
* data/check-mime.py:
* data/mime-types-permissions.xml:
Add a list of permissions for mime and a script
to update it (py hackers please forgive me).
I put only very obvious items in the safe list
for now.
Diffstat (limited to 'data/check-mime.py')
-rwxr-xr-x | data/check-mime.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/data/check-mime.py b/data/check-mime.py new file mode 100755 index 000000000..59d1d3383 --- /dev/null +++ b/data/check-mime.py @@ -0,0 +1,33 @@ +from xml.dom.minidom import parse, Node, Document, parseString +import xml.parsers.expat + +import os +import sys + +base = sys.argv[0] +dbfile = os.path.join(os.path.dirname(base), "freedesktop.org.xml") +permissionfile = os.path.join(os.path.dirname(base), "mime-types-permissions.xml") + +def PrintIfAbsent(elements, elem): + for elem2 in elements: + if (elem.attributes["type"].value == elem2.attributes["type"].value): + return; + print ("<mime-type type=\"" + elem.attributes["type"].value + "\"/>"); + +def ExtractTypes(): + dbdom = parse(dbfile) + permissiondom = parse(permissionfile); + dbelements = dbdom.getElementsByTagName("mime-type"); + permissionelements = permissiondom.getElementsByTagName("mime-type"); + print ("New types:"); + print ("----------\n"); + for elem in dbelements: + PrintIfAbsent(permissionelements, elem) + print ("\nTypes removed:"); + print ("--------------\n"); + for elem in permissionelements: + PrintIfAbsent(dbelements, elem) + dbdom.unlink(); + permissiondom.unlink(); + +ExtractTypes(); |