[slapos_hypermedia] Upgrade to new erp5_hal_json_style.

A few tests can be taken out of this BT to be put in erp5_hal_json_style.
parent 11eeb5d9
<?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_slap</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_slap</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>get_hateoas_software_installation_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>50.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>getHateoasSoftwareInstallationList</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}/Computer_getHateoasSoftwareInstallationList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_slap</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_slap</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>get_hateoas_instance_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>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>getHateoasInstanceList</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}/HostingSubscription_getHateoasInstanceList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_slap</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_slap</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>get_hateoas_root_instance</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>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>getHateoasRootInstance</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}/HostingSubscription_getHateoasRootSoftwareInstance</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_slap</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_slap</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>get_hateoas_computer_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>15.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>getHateoasComputerList</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}/Person_getHateoasComputerList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_slap</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_slap</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>get_hateoas_hosting_subscription_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>15.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>getHateoasHostingSubscriptionList</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}/Person_getHateoasHostingSubscriptionList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_slap</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_slap</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>get_hateoas_information</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>15.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>getHateoasInformation</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}/Person_getHateoasInformation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_slap_post</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_slap_post</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>request_hateoas_hosting_subscription</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>15.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>requestHateoasHostingSubscription</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}/Person_requestHateoasHostingSubscription</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_slap</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_slap</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>get_hateoas_information</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>getHateoasInformation</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}/SoftwareInstallation_getHateoasInformation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_slap</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_slap</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>get_hateoas_information</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>getHateoasInformation</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}/Instance_getHateoasInformation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_slap</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_slap</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>get_hateoas_news</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>getHateoasNews</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}/Instance_getHateoasNews</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_slap</string>
<string>action_type/object_slap</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>object_slap</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>object_slap</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_slap</string>
<string>action_type/object_slap</string>
<string>action_type/object_slap_post</string>
<string>action_type/object_slap_post</string>
<string>action_type/object_slap_post</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>object_slap_post</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>object_slap_post</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -56,23 +56,21 @@ if REQUEST is None:\n ...@@ -56,23 +56,21 @@ if REQUEST is None:\n
raise Unauthorized\n raise Unauthorized\n
\n \n
response = REQUEST.RESPONSE\n response = REQUEST.RESPONSE\n
type = \'application/vnd.slapos.org.hal+json; class=slapos.org.master\'\n mime_type = \'application/hal+json\'\n
\n \n
if REQUEST.other[\'method\'] != "GET":\n if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n response.setStatus(405)\n
return ""\n return ""\n
elif type != context.Base_handleAcceptHeader([type]):\n elif mime_type != context.Base_handleAcceptHeader([mime_type]):\n
response.setStatus(406)\n response.setStatus(406)\n
return ""\n return ""\n
else:\n \n
import json\n import json\n
result_dict = {\n result_dict = {\n
\'_class\': \'slapos.org.master\',\n
# \'title\': \'Vifib SlapOS Master\',\n # \'title\': \'Vifib SlapOS Master\',\n
# \'description\': \'Reference implementation of the SlapOS Master specifications.\',\n # \'description\': \'Reference implementation of the SlapOS Master specifications.\',\n
\'_links\': {\n \'_links\': {\n
"self": { "href": context.Base_getRequestUrl(),\n "self": { "href": context.Base_getRequestUrl() },\n
"type": type },\n
# "http://slapos.org/reg/edit": {\n # "http://slapos.org/reg/edit": {\n
# "href": "/edit",\n # "href": "/edit",\n
# "method": "PUT",\n # "method": "PUT",\n
...@@ -84,20 +82,20 @@ else:\n ...@@ -84,20 +82,20 @@ else:\n
# "type": "application/json; class=slapos.org.person",\n # "type": "application/json; class=slapos.org.person",\n
# },\n # },\n
},\n },\n
}\n }\n
\n \n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n \n
# XXX Handle also other kind of users: instance, computer, master\n # XXX Handle also other kind of users: instance, computer, master\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
if person is not None:\n if person is not None:\n
result_dict[\'_links\'][\'http://slapos.org/reg/me\'] = {\n result_dict[\'_links\'][\'action_object_jump\'] = {\n
\'href\': \'%s/Person_getHateoas\' % person.absolute_url(),\n \'href\': \'%s/ERP5Document_getHateoas\' % person.absolute_url(),\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.person"\n \'title\': \'Person\'\n
}\n }\n
\n \n
response.setHeader(\'Content-Type\', type)\n response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict)\n return json.dumps(result_dict, indent=2)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
<?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>_body</string> </key>
<value> <string>from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
# XXX requested to simulate in unit test for now\n
return context.REQUEST.get(\'BODY\')\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getRequestBody</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
# XXX requested to simulate in unit test for now\n
return context.REQUEST.getHeader(name, default)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>name, default=None, REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getRequestHeader</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
# XXX requested to simulate in unit test for now\n
return context.REQUEST.getURL()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getRequestUrl</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_body</string> </key>
<value> <string>from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
result = None\n
accept = context.Base_getRequestHeader(\'Accept\', default=\'\')\n
for accepted_type in accepted_type_list:\n
if accepted_type in accept:\n
# XXX Really simple and stupid matching.\n
# Better test to ensure best matching type\n
result = accepted_type\n
break\n
\n
if (result is None) and (\'*/*\' in accept):\n
result = accepted_type_list[0]\n
\n
return result\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>accepted_type_list, REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_handleAcceptHeader</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -56,41 +56,43 @@ if REQUEST is None:\n ...@@ -56,41 +56,43 @@ if REQUEST is None:\n
raise Unauthorized\n raise Unauthorized\n
\n \n
response = REQUEST.RESPONSE\n response = REQUEST.RESPONSE\n
type = \'application/vnd.slapos.org.hal+json; class=slapos.org.collection\'\n mime_type = \'application/hal+json\'\n
\n \n
if REQUEST.other[\'method\'] != "GET":\n if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n response.setStatus(405)\n
return ""\n return ""\n
elif type != context.Base_handleAcceptHeader([type]):\n elif mime_type != context.Base_handleAcceptHeader([mime_type]):\n
response.setStatus(406)\n response.setStatus(406)\n
return ""\n return ""\n
elif context.getPortalType() != "Computer":\n elif context.getPortalType() != "Computer":\n
response.setStatus(403)\n response.setStatus(403)\n
return ""\n return ""\n
else:\n \n
import json\n import json\n
result_dict = {\n result_dict = {\n
\'_class\': \'slapos.org.collection\',\n
\'_links\': {\n \'_links\': {\n
"self": { "href": context.Base_getRequestUrl(),\n "self": { "href": context.Base_getRequestUrl() },\n
"type": type },\n "index": {\n
"item": [],\n "href": "urn:jio:get:%s/ERP5Document_getHateoas" % context.getRelativeUrl(),\n
"title": "Computer"\n
},\n
"content": [],\n
},\n },\n
}\n }\n
\n \n
for sql_obj in context.getPortalObject().portal_catalog(\n for sql_obj in context.getPortalObject().portal_catalog(\n
portal_type=\'Software Installation\',\n portal_type=\'Software Installation\',\n
default_aggregate_uid=context.getUid(),\n default_aggregate_uid=context.getUid(),\n
validation_state=\'validated\',\n validation_state=\'validated\',\n
):\n ):\n
obj = sql_obj.getObject()\n obj = sql_obj.getObject()\n
result_dict[\'_links\'][\'item\'].append({\n result_dict[\'_links\'][\'content\'].append({\n
\'href\': \'%s/SoftwareInstallation_getHateoas\' % obj.absolute_url(),\n \'href\': \'%s/ERP5Document_getHateoas\' % obj.absolute_url(),\n
\'type\': \'application/vnd.slapos.org.hal+json; class=slapos.org.software_installation\',\n \'title\': obj.getUrlString()\n
})\n })\n
\n \n
response.setHeader(\'Content-Type\', type)\n response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict)\n return json.dumps(result_dict, indent=2)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -56,40 +56,42 @@ if REQUEST is None:\n ...@@ -56,40 +56,42 @@ if REQUEST is None:\n
raise Unauthorized\n raise Unauthorized\n
\n \n
response = REQUEST.RESPONSE\n response = REQUEST.RESPONSE\n
type = \'application/vnd.slapos.org.hal+json; class=slapos.org.collection\'\n mime_type = \'application/hal+json\'\n
\n \n
if REQUEST.other[\'method\'] != "GET":\n if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n response.setStatus(405)\n
return ""\n return ""\n
elif type != context.Base_handleAcceptHeader([type]):\n elif mime_type != context.Base_handleAcceptHeader([mime_type]):\n
response.setStatus(406)\n response.setStatus(406)\n
return ""\n return ""\n
elif context.getPortalType() != "Hosting Subscription":\n elif context.getPortalType() != "Hosting Subscription":\n
response.setStatus(403)\n response.setStatus(403)\n
return ""\n return ""\n
else:\n \n
import json\n import json\n
result_dict = {\n result_dict = {\n
\'_class\': \'slapos.org.collection\',\n
\'_links\': {\n \'_links\': {\n
"self": { "href": context.Base_getRequestUrl(),\n "self": { "href": context.Base_getRequestUrl() },\n
"type": type },\n "content": [],\n
"item": [],\n "index": {\n
"href": "urn:jio:get:%s/ERP5Document_getHateoas" % context.getRelativeUrl(),\n
"title": "Hosting Subscription"\n
},\n
},\n },\n
}\n }\n
\n \n
for sql_obj in context.getPortalObject().portal_catalog(\n for sql_obj in context.getPortalObject().portal_catalog(\n
portal_type=[\'Software Instance\', \'Slave Instance\'],\n portal_type=[\'Software Instance\', \'Slave Instance\'],\n
default_specialise_uid=context.getUid(),\n default_specialise_uid=context.getUid(),\n
):\n ):\n
obj = sql_obj.getObject()\n obj = sql_obj.getObject()\n
result_dict[\'_links\'][\'item\'].append({\n result_dict[\'_links\'][\'content\'].append({\n
\'href\': \'%s/Instance_getHateoas\' % obj.absolute_url(),\n \'href\': \'%s/ERP5Document_getHateoas\' % obj.absolute_url(),\n
\'type\': \'application/vnd.slapos.org.hal+json; class=slapos.org.instance\',\n \'title\': obj.getTitle()\n
})\n })\n
\n \n
response.setHeader(\'Content-Type\', type)\n response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict)\n return json.dumps(result_dict, indent=2)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -56,39 +56,42 @@ if REQUEST is None:\n ...@@ -56,39 +56,42 @@ if REQUEST is None:\n
raise Unauthorized\n raise Unauthorized\n
\n \n
response = REQUEST.RESPONSE\n response = REQUEST.RESPONSE\n
type = \'application/vnd.slapos.org.hal+json; class=slapos.org.hosting_subscription\'\n mime_type = \'application/hal+json\'\n
\n \n
if REQUEST.other[\'method\'] != "GET":\n if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n response.setStatus(405)\n
return ""\n return ""\n
elif type != context.Base_handleAcceptHeader([type]):\n elif mime_type != context.Base_handleAcceptHeader([mime_type]):\n
response.setStatus(406)\n response.setStatus(406)\n
return ""\n return ""\n
elif context.getPortalType() != "Hosting Subscription":\n elif context.getPortalType() != "Hosting Subscription":\n
response.setStatus(403)\n response.setStatus(403)\n
return ""\n return ""\n
else:\n
\n \n
# XXX Set more properties on the document\n instance_list = context.getPredecessorValueList()\n
for instance in instance_list:\n
if instance.getTitle() == context.getTitle():\n
root_instance = instance\n
break\n
else:\n
raise Exception(\'Root instance not found.\')\n
\n \n
import json\n import json\n
result_dict = {\n result_dict = {\n
\'_class\': \'slapos.org.hosting_subscription\',\n
\'title\': context.getTitle(),\n
\'_links\': {\n \'_links\': {\n
"self": { "href": context.Base_getRequestUrl(),\n "self": { "href": context.Base_getRequestUrl() },\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.hosting_subscription" },\n "content": [\n
\n {\'href\': \'%s/ERP5Document_getHateoas\' % root_instance.getAbsoluteUrl()},\n
"http://slapos.org/reg/instance": {\n ],\n
"href": "%s/HostingSubscription_getHateoasInstanceList" % context.absolute_url(),\n "index": {\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.collection",\n "href": "urn:jio:get:%s/ERP5Document_getHateoas" % context.getRelativeUrl(),\n
"title": "Hosting Subscription"\n
},\n },\n
\n
},\n },\n
}\n }\n
\n \n
response.setHeader(\'Content-Type\', type)\n response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict)\n return json.dumps(result_dict, indent=2)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -97,7 +100,7 @@ else:\n ...@@ -97,7 +100,7 @@ else:\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_getHateoas</string> </value> <value> <string>HostingSubscription_getHateoasRootSoftwareInstance</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?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>_body</string> </key>
<value> <string>from zExceptions import Unauthorized\n
from AccessControl import getSecurityManager\n
if REQUEST is None:\n
raise Unauthorized\n
\n
response = REQUEST.RESPONSE\n
type = \'application/vnd.slapos.org.hal+json; class=slapos.org.instance\'\n
\n
if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n
return ""\n
elif type != context.Base_handleAcceptHeader([type]):\n
response.setStatus(406)\n
return ""\n
elif context.getPortalType() not in ["Software Instance", "Slave Instance"]:\n
response.setStatus(403)\n
return ""\n
else:\n
\n
if context.getSlapState() == "stop_requested":\n
state = \'stopped\'\n
elif context.getSlapState() == "start_requested":\n
state = \'started\'\n
else:\n
state = \'destroyed\'\n
\n
import json\n
result_dict = {\n
\'_class\': \'slapos.org.instance\',\n
\'title\': context.getTitle(),\n
\'slave\': context.getPortalType() == \'Slave Instance\',\n
\'software_type\': context.getSourceReference(),\n
\'parameter\': context.getInstanceXmlAsDict(),\n
\'sla\': context.getSlaXmlAsDict(),\n
\'connection\': context.getConnectionXmlAsDict(),\n
\'status\': state,\n
\'_links\': {\n
"self": { "href": context.Base_getRequestUrl(),\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.instance" },\n
"http://slapos.org/reg/news": { "href": "%s/Instance_getHateoasNews" % context.absolute_url(),\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.news" },\n
"http://slapos.org/reg/release": { "href": context.getUrlString()},\n
},\n
}\n
\n
response.setHeader(\'Content-Type\', type)\n
return json.dumps(result_dict)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Instance_getHateoas</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -56,39 +56,49 @@ if REQUEST is None:\n ...@@ -56,39 +56,49 @@ if REQUEST is None:\n
raise Unauthorized\n raise Unauthorized\n
\n \n
response = REQUEST.RESPONSE\n response = REQUEST.RESPONSE\n
type = \'application/vnd.slapos.org.hal+json; class=slapos.org.computer\'\n mime_type = \'application/hal+json\'\n
\n \n
if REQUEST.other[\'method\'] != "GET":\n if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n response.setStatus(405)\n
return ""\n return ""\n
elif type != context.Base_handleAcceptHeader([type]):\n elif mime_type != context.Base_handleAcceptHeader([mime_type]):\n
response.setStatus(406)\n response.setStatus(406)\n
return ""\n return ""\n
elif context.getPortalType() != "Computer":\n elif context.getPortalType() not in ["Software Instance", "Slave Instance"]:\n
response.setStatus(403)\n response.setStatus(403)\n
return ""\n return ""\n
else:\n
\n \n
# XXX Set more properties on the document\n if context.getSlapState() == "stop_requested":\n
state = \'stopped\'\n
elif context.getSlapState() == "start_requested":\n
state = \'started\'\n
else:\n
state = \'destroyed\'\n
\n \n
import json\n import json\n
result_dict = {\n result_dict = {\n
\'_class\': \'slapos.org.computer\',\n
\'title\': context.getTitle(),\n \'title\': context.getTitle(),\n
\'slave\': context.getPortalType() == \'Slave Instance\',\n
\'software_type\': context.getSourceReference(),\n
\'parameter_dict\': context.getInstanceXmlAsDict(),\n
\'sla_dict\': context.getSlaXmlAsDict(),\n
\'connection_dict\': context.getConnectionXmlAsDict(),\n
\'requested_state\': state,\n
\'instance_guid\': context.getId(),\n
\'_links\': {\n \'_links\': {\n
"self": { "href": context.Base_getRequestUrl(),\n "self": { "href": context.Base_getRequestUrl() },\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.computer" },\n "index": {\n
\n "href": "urn:jio:get:%s/ERP5Document_getHateoas" % context.getRelativeUrl(),\n
"http://slapos.org/reg/software": {\n "title": "Software Instance",\n
"href": "%s/Computer_getHateoasSoftwareInstallationList" % context.absolute_url(),\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.collection",\n
},\n
\n
},\n },\n
\'software_release\': {\n
"href": context.getUrlString(),\n
}\n }\n
},\n
}\n
\n \n
response.setHeader(\'Content-Type\', type)\n response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict)\n return json.dumps(result_dict, indent=2)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -97,7 +107,7 @@ else:\n ...@@ -97,7 +107,7 @@ else:\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Computer_getHateoas</string> </value> <value> <string>Instance_getHateoasInformation</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -56,47 +56,47 @@ if REQUEST is None:\n ...@@ -56,47 +56,47 @@ if REQUEST is None:\n
raise Unauthorized\n raise Unauthorized\n
\n \n
response = REQUEST.RESPONSE\n response = REQUEST.RESPONSE\n
type = \'application/vnd.slapos.org.hal+json; class=slapos.org.news\'\n mime_type = \'application/hal+json\'\n
\n \n
if REQUEST.other[\'method\'] != "GET":\n if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n response.setStatus(405)\n
return ""\n return ""\n
elif type != context.Base_handleAcceptHeader([type]):\n elif mime_type != context.Base_handleAcceptHeader([mime_type]):\n
response.setStatus(406)\n response.setStatus(406)\n
return ""\n return ""\n
elif context.getPortalType() not in ["Software Instance", "Slave Instance"]:\n elif context.getPortalType() not in ["Software Instance", "Slave Instance"]:\n
response.setStatus(403)\n response.setStatus(403)\n
return ""\n return ""\n
else:\n
\n \n
import json\n import json\n
\n \n
memcached_dict = context.getPortalObject().portal_memcached.getMemcachedDict(\n memcached_dict = context.getPortalObject().portal_memcached.getMemcachedDict(\n
key_prefix=\'slap_tool\',\n key_prefix=\'slap_tool\',\n
plugin_path=\'portal_memcached/default_memcached_plugin\')\n plugin_path=\'portal_memcached/default_memcached_plugin\')\n
try:\n try:\n
d = memcached_dict[context.getReference()]\n d = memcached_dict[context.getReference()]\n
except KeyError:\n except KeyError:\n
d = {\n d = {\n
"user": "SlapOS Master",\n "user": "SlapOS Master",\n
"text": "#error no data found for %s" % context.getReference()\n "text": "#error no data found for %s" % context.getReference()\n
}\n }\n
else:\n else:\n
d = json.loads(d)\n d = json.loads(d)\n
\n \n
result_dict = {\n result_dict = {\n
\'_class\': \'slapos.org.news\',\n
\'news\': [d],\n \'news\': [d],\n
\'_links\': {\n \'_links\': {\n
"self": { "href": context.Base_getRequestUrl(),\n "self": { "href": context.Base_getRequestUrl() },\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.news" },\n # XXX current type\n
"http://slapos.org/reg/instance": { "href": "%s/Instance_getHateoas" % context.absolute_url(),\n "index": {\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.instance" },\n "href": "urn:jio:get:%s/ERP5Document_getHateoas" % context.getRelativeUrl(),\n
"title": "Software Instance"\n
},\n },\n
}\n },\n
}\n
\n \n
response.setHeader(\'Content-Type\', type)\n response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict)\n return json.dumps(result_dict, indent=2)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
<?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>_body</string> </key>
<value> <string>from zExceptions import Unauthorized\n
from AccessControl import getSecurityManager\n
if REQUEST is None:\n
raise Unauthorized\n
\n
response = REQUEST.RESPONSE\n
type = \'application/vnd.slapos.org.hal+json; class=slapos.org.person\'\n
\n
if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n
return ""\n
elif type != context.Base_handleAcceptHeader([type]):\n
response.setStatus(406)\n
return ""\n
elif context.getPortalType() != "Person":\n
response.setStatus(403)\n
return ""\n
else:\n
import json\n
result_dict = {\n
\'_class\': \'slapos.org.person\',\n
\'title\': context.getTitle(),\n
\'_links\': {\n
"self": { "href": context.Base_getRequestUrl(),\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.person" },\n
\n
"http://slapos.org/reg/request": {\n
"href": "%s/Person_requestHateoasHostingSubscription" % context.absolute_url(),\n
"method": "POST",\n
"type": "application/json; class=slapos.org.hosting_subscription",\n
},\n
\n
"http://slapos.org/reg/computer": {\n
"href": "%s/Person_getHateoasComputerList" % context.absolute_url(),\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.collection",\n
},\n
\n
"http://slapos.org/reg/hosting_subscription": {\n
"href": "%s/Person_getHateoasHostingSubscriptionList" % context.absolute_url(),\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.collection",\n
},\n
\n
},\n
}\n
\n
response.setHeader(\'Content-Type\', type)\n
return json.dumps(result_dict)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_getHateoas</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -56,40 +56,43 @@ if REQUEST is None:\n ...@@ -56,40 +56,43 @@ if REQUEST is None:\n
raise Unauthorized\n raise Unauthorized\n
\n \n
response = REQUEST.RESPONSE\n response = REQUEST.RESPONSE\n
type = \'application/vnd.slapos.org.hal+json; class=slapos.org.collection\'\n mime_type = \'application/hal+json\'\n
\n \n
if REQUEST.other[\'method\'] != "GET":\n if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n response.setStatus(405)\n
return ""\n return ""\n
elif type != context.Base_handleAcceptHeader([type]):\n elif mime_type != context.Base_handleAcceptHeader([mime_type]):\n
response.setStatus(406)\n response.setStatus(406)\n
return ""\n return ""\n
elif context.getPortalType() != "Person":\n elif context.getPortalType() != "Person":\n
response.setStatus(403)\n response.setStatus(403)\n
return ""\n return ""\n
else:\n \n
import json\n import json\n
result_dict = {\n result_dict = {\n
\'_class\': \'slapos.org.collection\',\n
\'_links\': {\n \'_links\': {\n
"self": { "href": context.Base_getRequestUrl(),\n "self": { "href": context.Base_getRequestUrl() },\n
"type": type },\n # XXX current type\n
"item": [],\n "index": {\n
"href": "urn:jio:get:%s/ERP5Document_getHateoas" % context.getRelativeUrl(),\n
"title": "Person"\n
},\n
"content": [],\n
},\n },\n
}\n }\n
\n \n
for sql_obj in context.getPortalObject().portal_catalog(\n for sql_obj in context.getPortalObject().portal_catalog(\n
portal_type="Computer",\n portal_type="Computer",\n
default_source_administration_uid=context.getUid(),\n default_source_administration_uid=context.getUid(),\n
):\n ):\n
obj = sql_obj.getObject()\n obj = sql_obj.getObject()\n
result_dict[\'_links\'][\'item\'].append({\n result_dict[\'_links\'][\'content\'].append({\n
\'href\': \'%s/Computer_getHateoas\' % obj.absolute_url(),\n \'href\': \'%s/ERP5Document_getHateoas\' % obj.absolute_url(),\n
\'type\': \'application/vnd.slapos.org.hal+json; class=slapos.org.computer\',\n \'title\': obj.getTitle(),\n
})\n })\n
\n \n
response.setHeader(\'Content-Type\', type)\n response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict)\n return json.dumps(result_dict, indent=2)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -56,40 +56,43 @@ if REQUEST is None:\n ...@@ -56,40 +56,43 @@ if REQUEST is None:\n
raise Unauthorized\n raise Unauthorized\n
\n \n
response = REQUEST.RESPONSE\n response = REQUEST.RESPONSE\n
type = \'application/vnd.slapos.org.hal+json; class=slapos.org.collection\'\n mime_type = \'application/hal+json\'\n
\n \n
if REQUEST.other[\'method\'] != "GET":\n if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n response.setStatus(405)\n
return ""\n return ""\n
elif type != context.Base_handleAcceptHeader([type]):\n elif mime_type != context.Base_handleAcceptHeader([mime_type]):\n
response.setStatus(406)\n response.setStatus(406)\n
return ""\n return ""\n
elif context.getPortalType() != "Person":\n elif context.getPortalType() != "Person":\n
response.setStatus(403)\n response.setStatus(403)\n
return ""\n return ""\n
else:\n \n
import json\n import json\n
result_dict = {\n result_dict = {\n
\'_class\': \'slapos.org.collection\',\n
\'_links\': {\n \'_links\': {\n
"self": { "href": context.Base_getRequestUrl(),\n "self": { "href": context.Base_getRequestUrl() },\n
"type": type },\n # XXX current type\n
"item": [],\n "index": {\n
"href": "urn:jio:get:%s/ERP5Document_getHateoas" % context.getRelativeUrl(),\n
"title": "Person"\n
},\n
"content": [],\n
},\n },\n
}\n }\n
\n \n
for sql_obj in context.getPortalObject().portal_catalog(\n for sql_obj in context.getPortalObject().portal_catalog(\n
portal_type="Hosting Subscription",\n portal_type="Hosting Subscription",\n
default_destination_section_uid=context.getUid(),\n default_destination_section_uid=context.getUid(),\n
):\n ):\n
obj = sql_obj.getObject()\n obj = sql_obj.getObject()\n
result_dict[\'_links\'][\'item\'].append({\n result_dict[\'_links\'][\'content\'].append({\n
\'href\': \'%s/HostingSubscription_getHateoas\' % obj.absolute_url(),\n \'href\': \'%s/ERP5Document_getHateoas\' % obj.absolute_url(),\n
\'type\': \'application/vnd.slapos.org.hal+json; class=slapos.org.hosting_subscription\',\n \'title\': obj.getTitle()\n
})\n })\n
\n \n
response.setHeader(\'Content-Type\', type)\n response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict)\n return json.dumps(result_dict, indent=2)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -58,12 +58,12 @@ if REQUEST is None:\n ...@@ -58,12 +58,12 @@ if REQUEST is None:\n
raise Unauthorized\n raise Unauthorized\n
\n \n
response = REQUEST.RESPONSE\n response = REQUEST.RESPONSE\n
type = \'application/json; class=slapos.org.hosting_subscription\'\n mime_type = \'application/json\'\n
\n \n
if REQUEST.other[\'method\'] != "POST":\n if REQUEST.other[\'method\'] != "POST":\n
response.setStatus(405)\n response.setStatus(405)\n
return ""\n return ""\n
elif type != context.Base_getRequestHeader(\'Content-Type\'):\n elif mime_type != context.Base_getRequestHeader(\'Content-Type\'):\n
response.setStatus(406)\n response.setStatus(406)\n
return ""\n return ""\n
elif context.getPortalType() != "Person":\n elif context.getPortalType() != "Person":\n
......
...@@ -56,12 +56,12 @@ if REQUEST is None:\n ...@@ -56,12 +56,12 @@ if REQUEST is None:\n
raise Unauthorized\n raise Unauthorized\n
\n \n
response = REQUEST.RESPONSE\n response = REQUEST.RESPONSE\n
type = \'application/vnd.slapos.org.hal+json; class=slapos.org.software_installation\'\n mime_type = \'application/hal+json\'\n
\n \n
if REQUEST.other[\'method\'] != "GET":\n if REQUEST.other[\'method\'] != "GET":\n
response.setStatus(405)\n response.setStatus(405)\n
return ""\n return ""\n
elif type != context.Base_handleAcceptHeader([type]):\n elif mime_type != context.Base_handleAcceptHeader([mime_type]):\n
response.setStatus(406)\n response.setStatus(406)\n
return ""\n return ""\n
elif context.getPortalType() not in ["Software Installation"]:\n elif context.getPortalType() not in ["Software Installation"]:\n
...@@ -78,19 +78,21 @@ else:\n ...@@ -78,19 +78,21 @@ else:\n
\n \n
import json\n import json\n
result_dict = {\n result_dict = {\n
\'_class\': \'slapos.org.software_installation\',\n
\'title\': context.getTitle(),\n \'title\': context.getTitle(),\n
\'status\': state,\n \'status\': state,\n
\'_links\': {\n \'_links\': {\n
"self": { "href": context.Base_getRequestUrl(),\n "self": { "href": context.Base_getRequestUrl() },\n
"type": "application/vnd.slapos.org.hal+json; class=slapos.org.software_installation" },\n "index": {\n
"href": "urn:jio:get:%s/ERP5Document_getHateoas" % context.getRelativeUrl(),\n
"title": "Software Installation"\n
},\n
},\n },\n
}\n }\n
url_string = context.getUrlString(None)\n url_string = context.getUrlString(None)\n
if url_string is not None:\n if url_string is not None:\n
result_dict["_links"]["software_release"] = { "href": url_string }\n result_dict["_links"]["software_release"] = { "href": url_string }\n
\n \n
response.setHeader(\'Content-Type\', type)\n response.setHeader(\'Content-Type\', mime_type)\n
return json.dumps(result_dict)\n return json.dumps(result_dict)\n
</string> </value> </string> </value>
</item> </item>
...@@ -100,7 +102,7 @@ else:\n ...@@ -100,7 +102,7 @@ else:\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SoftwareInstallation_getHateoas</string> </value> <value> <string>SoftwareInstallation_getHateoasInformation</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
erp5_hal_json_style
slapos_cloud slapos_cloud
slapos_slap_tool slapos_slap_tool
4 5
\ No newline at end of file \ No newline at end of file
Computer | get_hateoas_software_installation_list
Hosting Subscription | get_hateoas_instance_list
Hosting Subscription | get_hateoas_root_instance
Person | get_hateoas_computer_list
Person | get_hateoas_hosting_subscription_list
Person | get_hateoas_information
Person | request_hateoas_hosting_subscription
Software Installation | get_hateoas_information
Software Instance | get_hateoas_information
Software Instance | get_hateoas_news
\ No newline at end of file
action_type/object_slap
action_type/object_slap_post
\ No newline at end of file
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