Commit a08a8750 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Major refactor on "News" API, update gadgets to use getNewsDict

Speed up the rendering and only do xhr to update if the user stays long enough on the page.

This change will significally drop the number of xhr on the site.
parent 68ba9666
...@@ -17,19 +17,23 @@ ...@@ -17,19 +17,23 @@
var gadget = this; var gadget = this;
return gadget.jio_allDocs(param_list[0]) return gadget.jio_allDocs(param_list[0])
.push(function (result) { .push(function (result) {
var i, value, len = result.data.total_rows; var i, value, news, len = result.data.total_rows;
for (i = 0; i < len; i += 1) { for (i = 0; i < len; i += 1) {
if (1 || (result.data.rows[i].hasOwnProperty("id"))) { if ((result.data.rows[i].value.hasOwnProperty("Computer_getNewsDict"))) {
value = result.data.rows[i].id; value = result.data.rows[i].id;
result.data.rows[i].value.monitoring_status = { news = result.data.rows[i].value.Computer_getNewsDict;
result.data.rows[i].value.Computer_getNewsDict = {
field_gadget_param : {
css_class: "", css_class: "",
description: "The Status", description: "The Status",
hidden: 0, hidden: 0,
"default": {jio_key: value}, "default": {jio_key: value,
result: news},
key: "status", key: "status",
url: "gadget_slapos_computer_status.html", url: "gadget_slapos_computer_status.html",
title: "Status", title: "Status",
type: "GadgetField" type: "GadgetField"
}
}; };
result.data.rows[i].value["listbox_uid:list"] = { result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list", key: "listbox_uid:list",
...@@ -74,7 +78,7 @@ ...@@ -74,7 +78,7 @@
['title', 'Title'], ['title', 'Title'],
['reference', 'Reference'], ['reference', 'Reference'],
['allocation_scope_title', 'Allocation Scope'], ['allocation_scope_title', 'Allocation Scope'],
['monitoring_status', 'Status'] ['Computer_getNewsDict', 'Status']
]; ];
return form_list.render({ return form_list.render({
erp5_document: { erp5_document: {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.40849.41394.30003</string> </value> <value> <string>972.38797.10404.27528</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1522772679.86</float> <float>1545935797.99</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -27,14 +27,14 @@ ...@@ -27,14 +27,14 @@
.push(function (result) { .push(function (result) {
var i, value, len = result.data.total_rows; var i, value, len = result.data.total_rows;
for (i = 0; i < len; i += 1) { for (i = 0; i < len; i += 1) {
if (1 || (result.data.rows[i].value.monitoring_status)) { if (1 || (result.data.rows[i].value.SoftwareInstallation_getNewsDict)) {
value = result.data.rows[i].id; value = result.data.rows[i].value.SoftwareInstallation_getNewsDict;
result.data.rows[i].value.monitoring_status = { result.data.rows[i].value.SoftwareInstallation_getNewsDict = {
field_gadget_param : { field_gadget_param : {
css_class: "", css_class: "",
description: "The Status", description: "The Status",
hidden: 0, hidden: 0,
"default": {jio_key: value}, "default": {jio_key: value, result: value},
key: "status", key: "status",
url: "gadget_slapos_installation_status.html", url: "gadget_slapos_installation_status.html",
title: "Status", title: "Status",
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
column_list = [ column_list = [
['SoftwareInstallation_getSoftwareReleaseInformation', 'Software Release'], ['SoftwareInstallation_getSoftwareReleaseInformation', 'Software Release'],
['url_string', 'Url'], ['url_string', 'Url'],
['monitoring_status', 'Status'] ['SoftwareInstallation_getNewsDict', 'Status']
], ],
ticket_column_list = [ ticket_column_list = [
['title', 'Title'], ['title', 'Title'],
...@@ -235,7 +235,8 @@ ...@@ -235,7 +235,8 @@
"my_monitoring_status": { "my_monitoring_status": {
"description": "", "description": "",
"title": "Monitoring Status", "title": "Monitoring Status",
"default": {jio_key: gadget.state.jio_key}, "default": {jio_key: gadget.state.jio_key,
result: gadget.state.doc.news},
"css_class": "", "css_class": "",
"required": 1, "required": 1,
"editable": 0, "editable": 0,
......
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>972.38674.1768.18517</string> </value> <value> <string>972.38762.9625.45482</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1545925663.89</float> <float>1545932477.94</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -16,19 +16,23 @@ ...@@ -16,19 +16,23 @@
var gadget = this; var gadget = this;
return gadget.jio_allDocs(param_list[0]) return gadget.jio_allDocs(param_list[0])
.push(function (result) { .push(function (result) {
var i, value, len = result.data.total_rows; var i, value, news, len = result.data.total_rows;
for (i = 0; i < len; i += 1) { for (i = 0; i < len; i += 1) {
if (1 || (result.data.rows[i].hasOwnProperty("id"))) { if (result.data.rows[i].value.hasOwnProperty("ComputerNetwork_getNewsDict")) {
value = result.data.rows[i].id; value = result.data.rows[i].id;
result.data.rows[i].value.monitoring_status = { news = result.data.rows[i].value.ComputerNetwork_getNewsDict;
result.data.rows[i].value.ComputerNetwork_getNewsDict = {
field_gadget_param : {
css_class: "", css_class: "",
description: "The Status", description: "The Status",
hidden: 0, hidden: 0,
"default": {jio_key: value}, "default": {jio_key: value,
result: news},
key: "status", key: "status",
url: "gadget_slapos_network_status.html", url: "gadget_slapos_network_status.html",
title: "Status", title: "Status",
type: "GadgetField" type: "GadgetField"
}
}; };
result.data.rows[i].value["listbox_uid:list"] = { result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list", key: "listbox_uid:list",
...@@ -66,7 +70,7 @@ ...@@ -66,7 +70,7 @@
var column_list = [ var column_list = [
['title', 'Title'], ['title', 'Title'],
['reference', 'Reference'], ['reference', 'Reference'],
['monitoring_status', 'Status'] ['ComputerNetwork_getNewsDict', 'Status']
]; ];
return form_list.render({ return form_list.render({
erp5_document: { erp5_document: {
......
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.41526.6603.40089</string> </value> <value> <string>972.38848.17221.24388</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -259,7 +259,7 @@ ...@@ -259,7 +259,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1523031808.56</float> <float>1545936199.72</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -16,15 +16,17 @@ ...@@ -16,15 +16,17 @@
var gadget = this; var gadget = this;
return gadget.jio_allDocs(param_list[0]) return gadget.jio_allDocs(param_list[0])
.push(function (result) { .push(function (result) {
var i, value, len = result.data.total_rows; var i, value, news, len = result.data.total_rows;
for (i = 0; i < len; i += 1) { for (i = 0; i < len; i += 1) {
if (1 || (result.data.rows[i].hasOwnProperty("id"))) { if (1 || (result.data.rows[i].value.hasOwnProperty("Project_getNewsDict"))) {
value = result.data.rows[i].id; value = result.data.rows[i].id;
result.data.rows[i].value.monitoring_status = { news = result.data.rows[i].Project_getNewsDict;
result.data.rows[i].value.Project_getNewsDict = {
css_class: "", css_class: "",
description: "The Status", description: "The Status",
hidden: 0, hidden: 0,
"default": {jio_key: value}, "default": {jio_key: value,
result: news},
key: "status", key: "status",
url: "gadget_slapos_project_status.html", url: "gadget_slapos_project_status.html",
title: "Status", title: "Status",
...@@ -73,7 +75,7 @@ ...@@ -73,7 +75,7 @@
column_list = [ column_list = [
['title', 'Title'], ['title', 'Title'],
['reference', 'Reference'], ['reference', 'Reference'],
['monitoring_status', 'Status'] ['Project_getNewsDict', 'Status']
]; ];
destination_project_list = "%22NULL%22%2C"; destination_project_list = "%22NULL%22%2C";
for (i in result[1].assignment_destination_project_list) { for (i in result[1].assignment_destination_project_list) {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.32073.32542.58777</string> </value> <value> <string>972.32024.53732.34406</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1522772741.41</float> <float>1545936132.29</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -65,12 +65,7 @@ ...@@ -65,12 +65,7 @@
return partition_class; return partition_class;
} }
function getStatus(gadget) { function getStatus(gadget, result) {
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(gadget.options.value.jio_key);
})
.push(function (result) {
var monitor_url, var monitor_url,
status_class = 'ui-btn-no-data', status_class = 'ui-btn-no-data',
status_title = 'Computer', status_title = 'Computer',
...@@ -79,8 +74,8 @@ ...@@ -79,8 +74,8 @@
status_style = '', status_style = '',
right_style = ''; right_style = '';
status_class = checkComputerStatus(result); status_class = checkComputerStatus({news: result.news.computer});
right_class = checkComputerPartitionStatus(result); right_class = checkComputerPartitionStatus({computer_partition_news: result.news.partition});
monitor_url = 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type%3A%22Software%20Instance%22%20AND%20aggregate_reference%3A%22' + result.reference + '%22'; monitor_url = 'https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type%3A%22Software%20Instance%22%20AND%20aggregate_reference%3A%22' + result.reference + '%22';
if (status_class === 'ui-btn-no-data') { if (status_class === 'ui-btn-no-data') {
...@@ -97,6 +92,15 @@ ...@@ -97,6 +92,15 @@
right_style: right_style right_style: right_style
}); });
return gadget; return gadget;
}
function getStatusLoop(gadget) {
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(gadget.options.value.jio_key);
})
.push(function (result) {
return getStatus(gadget, result);
}); });
} }
...@@ -116,19 +120,19 @@ ...@@ -116,19 +120,19 @@
return {}; return {};
}) })
.declareJob("getStatus", function () { .declareJob("getStatus", function (result) {
var gadget = this; var gadget = this;
return getStatus(gadget); return getStatus(gadget, {news: result});
}) })
.onLoop(function () { .onLoop(function () {
var gadget = this; var gadget = this;
return getStatus(gadget); return getStatusLoop(gadget);
}, 300000) }, 300000)
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this; var gadget = this;
gadget.options = options; gadget.options = options;
gadget.flag = options.value.jio_key; gadget.flag = options.value.jio_key;
return gadget.getStatus(); return gadget.getStatus(options.value.result);
}); });
}(window, rJS, RSVP, Handlebars)); }(window, rJS, RSVP, Handlebars));
\ No newline at end of file
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>968.33041.14393.16810</string> </value> <value> <string>972.38770.30010.49920</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1530119165.7</float> <float>1545932459.6</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -63,9 +63,23 @@ ...@@ -63,9 +63,23 @@
.declareMethod("getContent", function () { .declareMethod("getContent", function () {
return {}; return {};
}) })
.declareJob("getStatus", function () { .declareJob("getStatus", function (result) {
var gadget = this; var gadget = this,
return getStatus(gadget); status_class = 'ui-btn-no-data',
status_title = 'Installation',
status_style = "";
status_class = checkInstallationStatus({news: result});
if (status_class === 'ui-btn-no-data') {
status_style = "color: transparent !important;";
}
gadget.element.innerHTML = inline_status_template({
status_class: status_class,
status_title: status_title,
status_style: status_style
});
return gadget;
}) })
.onLoop(function () { .onLoop(function () {
var gadget = this; var gadget = this;
...@@ -76,7 +90,7 @@ ...@@ -76,7 +90,7 @@
var gadget = this; var gadget = this;
gadget.options = options; gadget.options = options;
gadget.flag = options.value.jio_key; gadget.flag = options.value.jio_key;
return gadget.getStatus(); return gadget.getStatus(options.value.result);
}); });
}(window, rJS, RSVP, Handlebars)); }(window, rJS, RSVP, Handlebars));
\ No newline at end of file
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>968.33049.60346.61764</string> </value> <value> <string>972.38717.20279.51251</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1530119205.48</float> <float>1545928626.78</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Base_getHateoasNews</string> </value> <value> <string>Base_getNewsDict</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
computer_dict = {}
computer_partition_dict = {}
for computer in computer_list:
news_dict = computer.Computer_getNewsDict()
computer_dict[computer.getReference()] = news_dict["computer"]
computer_partition_dict[computer.getReference()] = news_dict["partition"]
return {"computer": computer_dict,
"partition": computer_partition_dict}
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>computer_list, REQUEST=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getNewsDictFromComputerList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
if REQUEST is not None:
raise Unauthorized
computer_network_partition_dict = {}
for computer in context.getSubordinationRelatedValueList(portal_type="Computer"):
computer_network_partition_dict[computer.getReference()] = computer.Computer_getHateoasComputerPartitionNews()
return computer_network_partition_dict
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
return context.Base_getNewsDictFromComputerList(
context.getSubordinationRelatedValueList(portal_type="Computer"))
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Project_getHateoasComputerPartitionNews</string> </value> <value> <string>ComputerNetwork_getNewsDict</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
if REQUEST is not None:
raise Unauthorized
computer_partition_dict = { }
for computer_partition in context.objectValues(portal_type="Computer Partition"):
software_instance = computer_partition.getAggregateRelatedValue(portal_type="Software Instance")
if software_instance is not None:
computer_partition_dict[computer_partition.getTitle()] = context.Base_getHateoasNews(software_instance)
return computer_partition_dict
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
def get_computer_partition_dict(reference):
computer_dict = context.Base_getNewsDict(context)
computer_partition_dict = { }
for computer_partition in context.objectValues(portal_type="Computer Partition"):
software_instance = computer_partition.getAggregateRelatedValue(portal_type="Software Instance")
if software_instance is not None:
computer_partition_dict[computer_partition.getTitle()] = context.Base_getNewsDict(software_instance)
return {"computer": computer_dict,
"partition": computer_partition_dict}
# Use Cache here, at least transactional one.
return get_computer_partition_dict(context.getReference())
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Computer_getHateoasComputerPartitionNews</string> </value> <value> <string>Computer_getNewsDict</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -100,7 +100,6 @@ ...@@ -100,7 +100,6 @@
<string>my_allocation_scope</string> <string>my_allocation_scope</string>
<string>my_subordination</string> <string>my_subordination</string>
<string>my_news</string> <string>my_news</string>
<string>my_computer_partition_news</string>
<string>my_source_title</string> <string>my_source_title</string>
<string>my_source_project_title</string> <string>my_source_project_title</string>
<string>my_monitor_scope</string> <string>my_monitor_scope</string>
......
<?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>default</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_computer_partition_news</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>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Message Computer Partitions</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.Computer_getHateoasComputerPartitionNews()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.Base_getHateoasNews(here)</string> </value> <value> <string>here/Computer_getNewsDict</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
# This should be refactored
from zExceptions import Unauthorized from zExceptions import Unauthorized
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
if REQUEST is None: if REQUEST is None:
......
if REQUEST is not None:
raise Unauthorized
computer_network_partition_dict = {}
for computer in context.Organisation_getComputerTrackingList():
computer_network_partition_dict[computer.getReference()] = computer.Computer_getHateoasComputerPartitionNews()
return computer_network_partition_dict
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
return context.Base_getNewsDictFromComputerList(
context.Organisation_getComputerTrackingList())
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Organisation_getHateoasComputerPartitionNews</string> </value> <value> <string>Organisation_getNewsDict</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
if REQUEST is not None:
raise Unauthorized
computer_network_partition_dict = {}
for computer in context.Project_getComputerTrackingList():
computer_network_partition_dict[computer.getReference()] = computer.Computer_getHateoasComputerPartitionNews()
return computer_network_partition_dict
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
return context.Base_getNewsDictFromComputerList(
context.Project_getComputerTrackingList())
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ComputerNetwork_getHateoasComputerPartitionNews</string> </value> <value> <string>Project_getNewsDict</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
return context.Base_getNewsDict(context)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareInstallation_getNewsDict</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.Base_getHateoasNews(here)</string> </value> <value> <string>here/SoftwareInstallation_getNewsDict</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
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