Commit cfb59437 authored by Xiaowu Zhang's avatar Xiaowu Zhang

slapos_slap_tool: add post method to ingest data

parent bdc55a3c
......@@ -40,6 +40,7 @@ from Products.ERP5Type import Permissions
from Products.ERP5Type.Cache import CachingMethod
from erp5.component.module.SlapOSCloud import _assertACI
from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE
import urlparse
from lxml import etree
try:
......@@ -446,6 +447,22 @@ class SlapTool(BaseTool):
# Public POST methods
####################################################
security.declareProtected(Permissions.AccessContentsInformation,
'ingestData')
def ingestData(self, **kw):
"""
ingest data to erp5
"""
portal = self.getPortalObject()
# in http post, parameter is ignored in url but is inside request body
query = urlparse.parse_qs(self.REQUEST.get('QUERY_STRING'))
ingestion_policy = getattr(portal.portal_ingestion_policies, query['ingestion_policy'][0], None)
if ingestion_policy is None:
raise NotFound
return ingestion_policy.ingest(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
'setComputerPartitionConnectionXml')
def setComputerPartitionConnectionXml(self, computer_id,
......
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