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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
88f37ddd
Commit
88f37ddd
authored
Oct 01, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: do not return unicode strings
parent
2649e9d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCacheMixin.py
...lateItem/portal_components/mixin.erp5.SlapOSCacheMixin.py
+15
-1
No files found.
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCacheMixin.py
View file @
88f37ddd
...
...
@@ -34,11 +34,25 @@ from App.Common import rfc1123_date
from
Products.ERP5Type.Cache
import
DEFAULT_CACHE_SCOPE
import
json
import
six
ACCESS
=
"#access"
ERROR
=
"#error"
BUILDING
=
"#building"
# http://stackoverflow.com/a/13105359
def
byteify
(
string
):
if
isinstance
(
string
,
dict
):
return
{
byteify
(
key
):
byteify
(
value
)
for
key
,
value
in
six
.
iteritems
(
string
)}
elif
isinstance
(
string
,
list
):
return
[
byteify
(
element
)
for
element
in
string
]
elif
isinstance
(
string
,
tuple
):
return
tuple
(
byteify
(
element
)
for
element
in
string
)
elif
six
.
PY2
and
isinstance
(
string
,
six
.
text_type
):
return
string
.
encode
(
'utf-8'
)
else
:
return
string
class
SlapOSCacheMixin
:
# Declarative security
...
...
@@ -87,7 +101,7 @@ class SlapOSCacheMixin:
#data_dict["user"] = data_dict["user"].decode("UTF-8")
return
data_dict
data_dict
=
json
.
loads
(
data_json
)
data_dict
=
byteify
(
json
.
loads
(
data_json
)
)
last_contact
=
DateTime
(
data_dict
.
get
(
'created_at'
))
data_dict
[
"no_data_since_15_minutes"
]
=
0
data_dict
[
"no_data_since_5_minutes"
]
=
0
...
...
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