Commit 515598d1 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Drop export OPML as JSON

   This import Raw/Custom OPML feature is not support anymore on Monitoring app. The sync occur directly from jIO API, so no reason to keep it.

   The code is also broken and untested in general.
parent 8a1f02c1
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_exchange</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_exchange</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>support_request_monitor_opml_description_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>10.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Support Request Monitor OPML List</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SupportRequestModule_viewExportMonitorOPMLListDialog</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# Use a diferent script for the same purpose only to be used for download
response = context.REQUEST.RESPONSE
mime_type = 'application/hal+json'
response.setHeader('Content-Type', mime_type)
return context.SupportRequestModule_getMonitoringOPMLDescriptionList(**kw)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequestModule_exportMonitoringOPMLDescriptionList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from json import dumps
import base64
def getCredentialFromUrl(parameter_string):
username = ''
password = ''
if 'username' in parameter_string and \
'password' in parameter_string:
param_list = parameter_string.split('&')
for param in param_list:
key, value = param.split('=')
if key == 'username':
username = value
elif key == 'password':
password = value
return (username, password,)
def getMonitorUrlFromUrlString(parameter_string):
if 'url=' in parameter_string:
param_list = parameter_string.split('&')
for param in param_list:
key, value = param.split('=')
if key == 'url':
return value
monitor_instance_list = []
monitor_url_temp_object_list = context.SupportRequestModule_getMonitoringUrlList()
for temp_object in monitor_url_temp_object_list:
monitor_url = getMonitorUrlFromUrlString(temp_object.monitor_url)
username, password = getCredentialFromUrl(temp_object.monitor_url)
if monitor_url is not None:
monitor_instance_list.append(dict(
basic_login=base64.b64encode('%s:%s' % (username, password)),
url=monitor_url,
title=temp_object.title,
active=True
))
monitor_parameter_dict = {"opml_description_list": monitor_instance_list}
return dumps(monitor_parameter_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>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequestModule_getMonitoringOPMLDescriptionList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>SupportRequestModule_getMonitoringOPMLDescriptionList</string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list>
<string>your_monitor_opml_description_list</string>
</list>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequestModule_viewExportMonitorOPMLListDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SupportRequestModule_viewExportMonitorOPMLListDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Export</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string>SupportRequestModule_viewExportMonitorOPMLListDialog</string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string>Update</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -6,5 +6,4 @@ Regularisation Request | create_new_file
Regularisation Request | document_list
Regularisation Request | new_event
Regularisation Request | view
Support Request Module | support_request_monitor_link
Support Request Module | support_request_monitor_opml_description_list
\ No newline at end of file
Support Request Module | support_request_monitor_link
\ No newline at end of file
......@@ -113,8 +113,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
'slapos_cloud/SoftwareInstance_checkDuplicationOnInstanceTreeConsistency',
'slapos_cloud/ComputerNetwork_getRelatedSoftwareReleaseList',
'slapos_crm_monitoring/SupportRequest_afterNewEvent',
'slapos_crm_monitoring/SupportRequestModule_exportMonitoringOPMLDescriptionList',
'slapos_crm_monitoring/SupportRequestModule_getMonitoringOPMLDescriptionList',
'slapos_crm_monitoring/SupportRequest_getMonitorUrl',
'slapos_crm/RegularisationRequest_afterClone',
'slapos_crm/RegularisationRequest_getResourceItemList',
......
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