Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ophélie Gagnard
slapos.core
Commits
cfb59437
Commit
cfb59437
authored
Dec 01, 2022
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_slap_tool: add post method to ingest data
parent
bdc55a3c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
...onentTemplateItem/portal_components/tool.erp5.SlapTool.py
+17
-0
No files found.
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
View file @
cfb59437
...
@@ -40,6 +40,7 @@ from Products.ERP5Type import Permissions
...
@@ -40,6 +40,7 @@ from Products.ERP5Type import Permissions
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.Cache
import
CachingMethod
from
erp5.component.module.SlapOSCloud
import
_assertACI
from
erp5.component.module.SlapOSCloud
import
_assertACI
from
Products.ERP5Type.Cache
import
DEFAULT_CACHE_SCOPE
from
Products.ERP5Type.Cache
import
DEFAULT_CACHE_SCOPE
import
urlparse
from
lxml
import
etree
from
lxml
import
etree
try
:
try
:
...
@@ -446,6 +447,22 @@ class SlapTool(BaseTool):
...
@@ -446,6 +447,22 @@ class SlapTool(BaseTool):
# Public POST methods
# 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
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'setComputerPartitionConnectionXml'
)
'setComputerPartitionConnectionXml'
)
def
setComputerPartitionConnectionXml
(
self
,
computer_id
,
def
setComputerPartitionConnectionXml
(
self
,
computer_id
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment