source:
products/quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/namespaces/__init__.py
@
1454
Last change on this file since 1454 was 1414, checked in by piv, 15 years ago | |
---|---|
File size: 713 bytes |
Line | |
---|---|
1 | # import Products.Marshall namespaces to ensure it's registered |
2 | # before we override it |
3 | from Products.Marshall import namespaces |
4 | from Products.Marshall.handlers.atxml import ATXMLMarshaller, XmlNamespace |
5 | |
6 | from atns import Archetypes |
7 | from dcns import DublinCore |
8 | from cmfns import CMF |
9 | |
10 | |
11 | def replaceNamespace(ns): |
12 | """Replace namespaces by prefix""" |
13 | if not isinstance(ns, XmlNamespace): |
14 | ns = ns() |
15 | |
16 | nses = ATXMLMarshaller.namespaces |
17 | prefixes = [nses.index(n) for n in nses if n.prefix == ns.prefix] |
18 | if len(prefixes) == 0: |
19 | return False |
20 | |
21 | idx = prefixes[0] |
22 | nses.pop(idx) |
23 | nses.insert(idx, ns) |
24 | |
25 | replaceNamespace(DublinCore) |
26 | replaceNamespace(Archetypes) |
27 | replaceNamespace(CMF) |
Note: See TracBrowser
for help on using the repository browser.