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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
777a1620
Commit
777a1620
authored
Jun 22, 2022
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
Mar 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_api_style: EXPERIMENTAL API works with HTTP GET method
parent
ac46c7ff
Changes
3
Show 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 @
777a1620
...
@@ -94,8 +94,12 @@ class jIOWebSection(WebSection):
...
@@ -94,8 +94,12 @@ class jIOWebSection(WebSection):
return
default
return
default
@
convertTojIOAPICall
@
convertTojIOAPICall
def
_asjIOStyle
(
self
,
mode
,
text_content
):
def
_asjIOStyle
(
self
,
mode
,
text_content
=
""
,
data_dict
=
None
):
return
self
.
ERP5Site_asjIOStyle
(
mode
=
mode
,
text_content
=
text_content
)
return
self
.
ERP5Site_asjIOStyle
(
mode
=
mode
,
text_content
=
text_content
,
data_dict
=
data_dict
,
)
security
.
declareProtected
(
Permissions
.
View
,
'get'
)
security
.
declareProtected
(
Permissions
.
View
,
'get'
)
def
get
(
self
):
#pylint:disable=arguments-differ
def
get
(
self
):
#pylint:disable=arguments-differ
...
@@ -104,6 +108,8 @@ class jIOWebSection(WebSection):
...
@@ -104,6 +108,8 @@ class jIOWebSection(WebSection):
__bobo_traverse__ from DocumentExtensibleTraversableMixin is not called
__bobo_traverse__ from DocumentExtensibleTraversableMixin is not called
"""
"""
# Register current web site physical path for later URL generation
# 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'
))
return
self
.
_asjIOStyle
(
mode
=
"get"
,
text_content
=
self
.
REQUEST
.
get
(
'BODY'
))
security
.
declareProtected
(
Permissions
.
View
,
'post'
)
security
.
declareProtected
(
Permissions
.
View
,
'post'
)
...
@@ -131,4 +137,6 @@ class jIOWebSection(WebSection):
...
@@ -131,4 +137,6 @@ class jIOWebSection(WebSection):
__bobo_traverse__ from DocumentExtensibleTraversableMixin is not called
__bobo_traverse__ from DocumentExtensibleTraversableMixin is not called
"""
"""
# Register current web site physical path for later URL generation
# 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'
))
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 @
777a1620
...
@@ -63,12 +63,15 @@ if mode not in mode_dict:
...
@@ -63,12 +63,15 @@ if mode not in mode_dict:
return
"Used Mode is not defined in the mode list %s"
%
mode_dict
.
keys
()
return
"Used Mode is not defined in the mode list %s"
%
mode_dict
.
keys
()
# Check JSON Form
# Check JSON Form
try
:
if
not
data_dict
:
try
:
data
=
json_loads_byteified
(
text_content
)
data
=
json_loads_byteified
(
text_content
)
except
BaseException
as
e
:
except
BaseException
as
e
:
return
logError
(
str
(
e
),
error_name
=
"API-JSON-INVALID-JSON"
)
return
logError
(
str
(
e
),
error_name
=
"API-JSON-INVALID-JSON"
)
if
not
isinstance
(
data
,
dict
):
if
not
isinstance
(
data
,
dict
):
return
logError
(
"Did not received a JSON Object"
,
error_name
=
"API-JSON-NOT-JSON-OBJECT"
)
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 get or put, valid Id is expected
if
mode
in
(
"get"
,
"put"
):
if
mode
in
(
"get"
,
"put"
):
...
...
bt5/erp5_api_style/SkinTemplateItem/portal_skins/erp5_api_style/ERP5Site_asjIOStyle.xml
View file @
777a1620
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<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>
<item>
<item>
<key>
<string>
id
</string>
</key>
<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