From 665035daca3b08898e1d838d38c65fbe5f36ff95 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 6 Nov 2003 08:39:04 +0000 Subject: Add a list of permissions for mime and a script to update it (py hackers 2003-11-06 Marco Pesenti Gritti * 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. --- data/Makefile.am | 6 +- data/check-mime.py | 33 ++++ data/mime-types-permissions.xml | 354 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 392 insertions(+), 1 deletion(-) create mode 100755 data/check-mime.py create mode 100755 data/mime-types-permissions.xml (limited to 'data') diff --git a/data/Makefile.am b/data/Makefile.am index 8fb44d6f0..7f5fcfb2f 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -34,6 +34,9 @@ schema_DATA = epiphany.schemas aboutdir = $(pkgdatadir) about_DATA = epiphany.xhtml conspiracy.xhtml +mimepermissiondir = $(pkgdatadir) +mimepermission_DATA = mime-types-permissions.xml + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = epiphany-1.0.pc @@ -50,7 +53,8 @@ EXTRA_DIST = $(NAUTILUS_VIEW_SERVER) \ $(DESKTOP_IN_FILES) \ $(about_DATA) \ $(applications_DATA) \ - $(pkgconfig_DATA) + $(pkgconfig_DATA) \ + check_mime.py DISTCLEANFILES = \ $(nautilus_server_DATA) \ 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 (""); + +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(); diff --git a/data/mime-types-permissions.xml b/data/mime-types-permissions.xml new file mode 100755 index 000000000..27922d1a7 --- /dev/null +++ b/data/mime-types-permissions.xml @@ -0,0 +1,354 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3