Commit 39f40076 authored by Łukasz Nowak's avatar Łukasz Nowak

Store data as SlapTool - etree XML.

parent 17fe41e0
...@@ -35,13 +35,21 @@ from Products.ERP5Type.Globals import InitializeClass ...@@ -35,13 +35,21 @@ from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from ComputedAttribute import ComputedAttribute from ComputedAttribute import ComputedAttribute
from zLOG import LOG, ERROR from zLOG import LOG, ERROR
import xml_marshaller from lxml import etree
import json import json
import transaction import transaction
class WrongRequest(Exception): class WrongRequest(Exception):
pass pass
def etreeXml(d):
r = etree.Element('instance')
for k, v in d.iteritems():
v = str(v)
etree.SubElement(r, "parameter", attrib={'id': k}).text = v
return etree.tostring(r, pretty_print=True, xml_declaration=True,
encoding='utf-8')
def requireHeader(header_dict): def requireHeader(header_dict):
def outer(fn): def outer(fn):
def wrapperRequireHeader(self, *args, **kwargs): def wrapperRequireHeader(self, *args, **kwargs):
...@@ -210,8 +218,7 @@ class InstancePublisher(GenericPublisher): ...@@ -210,8 +218,7 @@ class InstancePublisher(GenericPublisher):
('status', 'state') ('status', 'state')
): ):
if k_j in ('sla', 'parameter'): if k_j in ('sla', 'parameter'):
request_dict[k_i] = xml_marshaller.xml_marshaller.dumps( request_dict[k_i] = etreeXml(self.jbody[k_j])
self.jbody[k_j])
else: else:
request_dict[k_i] = self.jbody[k_j] request_dict[k_i] = self.jbody[k_j]
......
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