Commit a745cfa2 authored by Ivan Tyagov's avatar Ivan Tyagov

Proxify and set properly.

parent 3bc08b4a
...@@ -10,15 +10,13 @@ ...@@ -10,15 +10,13 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>elementary_type/object</string> <string>elementary_type/multiple selection</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <value> <string>Contains a dictionary of OPC Ua nodes and their values.</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -4,10 +4,6 @@ Simple script for OPCUA POC ...@@ -4,10 +4,6 @@ Simple script for OPCUA POC
import json import json
from erp5.component.module.Log import log from erp5.component.module.Log import log
def getPropertyId(node_id):
# XXX: based on node_id guess property type, too! -i -> integer , s- string, etc,,
return node_id #.replace(";", "")
# XXX: get rid of Proxy roles on this script when proper authentication is used!!! # XXX: get rid of Proxy roles on this script when proper authentication is used!!!
# XXX: what should be the OPCUA container? # XXX: what should be the OPCUA container?
...@@ -23,8 +19,11 @@ else: ...@@ -23,8 +19,11 @@ else:
# log only set requests for now # log only set requests for now
node_id = data['node'] node_id = data['node']
node_value = data['val'] node_value = data['val']
log("Set '%s' = '%s' to %s as %s" %(node_id, node_value, default_opcua_document, getPropertyId(node_id))) log("Set '%s' = '%s' to %s as %s" %(node_id, node_value, default_opcua_document, node_id))
log(data) #log(data)
# set to "ERP5 OPCUA Document"
node_dict = default_opcua_document.getNodeDict() node_dict = default_opcua_document.getNodeDict()
log(node_dict) log("Original = %s" %node_dict)
# XXX: set to "ERP5 OPCUA Document" property node_dict[node_id] = node_value
default_opcua_document.setNodeDict(node_dict)
log("Changed = %s" %default_opcua_document.getNodeDict())
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
<value> <value>
<list> <list>
<string>my_title</string> <string>my_title</string>
<string>my_node_dict</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_node_dict</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_text_area_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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