Last change
on this file since 1413 was
1413,
checked in by piv, 14 years ago
|
fix local roles import
|
File size:
713 bytes
|
Rev | Line | |
---|
[1393] | 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 |
---|
[1413] | 8 | from cmfns import CMF |
---|
[1393] | 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) |
---|
[1413] | 27 | replaceNamespace(CMF) |
---|
Note: See
TracBrowser
for help on using the repository browser.