Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Titouan Soulard
erp5
Commits
7642f7db
Commit
7642f7db
authored
Jun 22, 2022
by
Cédric Le Ninivin
Committed by
Titouan Soulard
Nov 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_api_style: EXPERIMENTAL API works with HTTP GET method
parent
b05f38f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
9 deletions
+20
-9
bt5/erp5_api_style/DocumentTemplateItem/portal_components/document.erp5.jIOWebSection.py
...lateItem/portal_components/document.erp5.jIOWebSection.py
+10
-2
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.py
...teItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.py
+9
-6
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.xml
...eItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.xml
+1
-1
No files found.
bt5/erp5_api_style/DocumentTemplateItem/portal_components/document.erp5.jIOWebSection.py
View file @
7642f7db
...
...
@@ -94,8 +94,12 @@ class jIOWebSection(WebSection):
return
default
@
convertTojIOAPICall
def
_asjIOStyle
(
self
,
mode
,
text_content
):
return
self
.
ERP5Site_asjIOStyle
(
mode
=
mode
,
text_content
=
text_content
)
def
_asjIOStyle
(
self
,
mode
,
text_content
=
""
,
data_dict
=
None
):
return
self
.
ERP5Site_asjIOStyle
(
mode
=
mode
,
text_content
=
text_content
,
data_dict
=
data_dict
,
)
security
.
declareProtected
(
Permissions
.
View
,
'get'
)
def
get
(
self
):
#pylint:disable=arguments-differ
...
...
@@ -104,6 +108,8 @@ class jIOWebSection(WebSection):
__bobo_traverse__ from DocumentExtensibleTraversableMixin is not called
"""
# Register current web site physical path for later URL generation
if
self
.
REQUEST
.
REQUEST_METHOD
==
"GET"
:
return
self
.
_asjIOStyle
(
mode
=
"get"
,
text_content
=
self
.
REQUEST
.
form
.
keys
()[
0
])
return
self
.
_asjIOStyle
(
mode
=
"get"
,
text_content
=
self
.
REQUEST
.
get
(
'BODY'
))
security
.
declareProtected
(
Permissions
.
View
,
'post'
)
...
...
@@ -131,4 +137,6 @@ class jIOWebSection(WebSection):
__bobo_traverse__ from DocumentExtensibleTraversableMixin is not called
"""
# Register current web site physical path for later URL generation
if
self
.
REQUEST
.
REQUEST_METHOD
==
"GET"
:
return
self
.
_asjIOStyle
(
mode
=
"allDocs"
,
text_content
=
self
.
REQUEST
.
form
.
keys
()[
0
])
return
self
.
_asjIOStyle
(
mode
=
"allDocs"
,
text_content
=
self
.
REQUEST
.
get
(
'BODY'
))
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.py
View file @
7642f7db
...
...
@@ -63,12 +63,15 @@ if mode not in mode_dict:
return
"Used Mode is not defined in the mode list %s"
%
list
(
mode_dict
)
# Check JSON Form
try
:
data
=
json_loads_byteified
(
text_content
)
except
BaseException
as
e
:
return
logError
(
str
(
e
),
error_name
=
"API-JSON-INVALID-JSON"
)
if
not
isinstance
(
data
,
dict
):
return
logError
(
"Did not received a JSON Object"
,
error_name
=
"API-JSON-NOT-JSON-OBJECT"
)
if
not
data_dict
:
try
:
data
=
json_loads_byteified
(
text_content
)
except
BaseException
as
e
:
return
logError
(
str
(
e
),
error_name
=
"API-JSON-INVALID-JSON"
)
if
not
isinstance
(
data
,
dict
):
return
logError
(
"Did not received a JSON Object"
,
error_name
=
"API-JSON-NOT-JSON-OBJECT"
)
else
:
data
=
data_dict
# If get or put, valid Id is expected
if
mode
in
(
"get"
,
"put"
):
...
...
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.xml
View file @
7642f7db
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
mode="", text_content="", document_id="", *arg, **kw
</string>
</value>
<value>
<string>
mode="", text_content="", d
ata_dict=None, d
ocument_id="", *arg, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
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