Hello All, sorry for the bother I am having an issue with Version
1.99.1 (2011-09-22 16:59:24) stable release. It seems to be that there
are some problems when parsing the .xml view file, not sure. I have a
function (device_cfg) in controllers/default.py, which performs some
processing and pass to the view the following
dictionary:
return dict(operation=operation, op_response=op_response)
with:
operation = "get_leafs"
op_response = "True"
The following code is the view (device_cfg.xml):
<?xml version="1.0" encoding="UTF-8"?>
{{if operation == 'get_containers':}}
{{parent_id = op_response['parent_id']}}
{{childs_list = op_response['childs_list']}}
<root>
{{for node in childs_list:}}
<item id="{{=node[0]}}" parent_id="{{=parent_id}}"
state="closed">
<content>
<name><![CDATA[{{=node[1]}}]]></name>
</content>
</item>
{{pass}}
</root>
{{pass}}
{{if operation == 'get_leafs':}}
{{limit = op_response['limit']}}
{{parent_id = op_response['parent_id']}}
{{childs_list = op_response['childs_list']}}
{{page = op_response['page']}}
{{start = op_response['start']}}
{{iter = op_response['iter']}}
{{total_pages = op_response['total_pages']}}
<rows>
<page>{{ =page }}</page>
<total>{{ =total_pages }}</total>
<records>{{ =len(childs_list) }}</records>
{{for i in iter:}}
{{node = childs_list[i]}}
<row id = '{{=node[0]}}'>
<cell>{{=node[0]}}</cell>
<cell>{{=node[1]}}</cell>
<cell>{{=node[2]}}</cell>
</row>
{{pass}}
</rows>
{{pass}}
{{if operation == 'leaf_remove':}}
<result>{{=op_response}}</result>
{{pass}}
{{if operation == 'leaf_create':}}
<result>{{=op_response}}</result>
{{pass}}
{{if operation == 'leaf_modify':}}
<result>{{=op_response}}</result>
{{pass}}
{{if operation == 'container_remove':}}
<result>{{=op_response}}</result>
{{pass}}
{{if operation == 'container_create':}}
<result>{{=op_response}}</result>
{{pass}}
{{if operation == 'container_edit':}}
<result>{{=op_response}}</result>
{{pass}}
{{if operation == 'validate_commit':}}
<response>
<result>{{=op_response[0]}}</result>
<feedback>{{=op_response[1]}}</feedback>
</response>
{{pass}}
{{if operation == 'validate_commit_cancel':}}
<result>{{=op_response}}</result>
{{pass}}
{{if operation == 'get_ns_map':}}
<rows>
<page>{{=1}}</page>
<total>{{=1}}</total>
<records>{{=len(op_response)}} </records>
{{i=0}}
{{for ns in op_response:}}
<row id="{{=i}}">
<cell>{{=ns}}</cell>
<cell><![CDATA["{{=op_response[ns]}}"]]></cell>
</row>
{{i += 1}}
{{pass}}
</rows>
{{pass}}
{{if operation == 'push_config':}}
<response>
<result>{{=op_response[0]}}</result>
<feedback>{{=op_response[1]}}</feedback>
</response>
{{pass}}
The expected replied xml is:
<?xml version="1.0" encoding="UTF-8"?>
<result>True</result>
But it returns:
<?xml version="1.0" encoding="UTF-8"?>
<result>True</result>
<total>1.0</total>
<records>2</records>
<row id = '2'>
<cell>2</cell>
<cell>ns1:max-lease-time</cell>
<cell>asds</cell>
</row>
<row id = '3'>
<cell>3</cell>
<cell>ns1:default-lease-time</cell>
<cell>600</cell>
</row>
</rows>
Firefox is complaining with the following error code: "XML Parsing
Error: junk after document element Location: moz-nullprincipal:
{c9878540-af47-407f-b97b-4709a9fcecdf} Line Number 26, Column 3:
<total>1.0</total>".
I have checked the view several times and I am not able to figure out
what is going on. Could someone please help me?...
Any help will be appreciated!
Regards,
Tincho