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
Léo-Paul Géneau
slapos.core
Commits
6c9d9b5f
Commit
6c9d9b5f
authored
May 15, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix encoding handling in hypermedia api.
parent
9d52538a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
16 deletions
+18
-16
master/bt5/slapos_hypermedia/SkinTemplateItem/portal_skins/slapos_hypermedia/Person_requestHateoasHostingSubscription.xml
...s_hypermedia/Person_requestHateoasHostingSubscription.xml
+5
-5
master/bt5/slapos_hypermedia/TestTemplateItem/testSlapOSHypermediaScenario.py
...permedia/TestTemplateItem/testSlapOSHypermediaScenario.py
+6
-5
master/bt5/slapos_hypermedia/TestTemplateItem/testSlapOSHypermediaSkins.py
..._hypermedia/TestTemplateItem/testSlapOSHypermediaSkins.py
+6
-5
master/bt5/slapos_hypermedia/bt/revision
master/bt5/slapos_hypermedia/bt/revision
+1
-1
No files found.
master/bt5/slapos_hypermedia/SkinTemplateItem/portal_skins/slapos_hypermedia/Person_requestHateoasHostingSubscription.xml
View file @
6c9d9b5f
...
@@ -82,19 +82,19 @@ else:\n
...
@@ -82,19 +82,19 @@ else:\n
assert same_type(dict_data, {})\n
assert same_type(dict_data, {})\n
result = "<?xml version=\'1.0\' encoding=\'utf-8\'?>
<instance>
\\n"\n
result = "<?xml version=\'1.0\' encoding=\'utf-8\'?>
<instance>
\\n"\n
for key, value in dict_data.items():\n
for key, value in dict_data.items():\n
result += """
<parameter
id=
"%s"
>
%s
</parameter>
\\n""" % (key
, value
)\n
result += """
<parameter
id=
"%s"
>
%s
</parameter>
\\n""" % (key
.encode("UTF-8"), value.encode("UTF-8")
)\n
result += "
</instance>
"\n
result += "
</instance>
"\n
return result\n
return result\n
\n
\n
try:\n
try:\n
parameter_kw = {\n
parameter_kw = {\n
\'software_release\': data_dict[\'software_release\'],\n
\'software_release\': data_dict[\'software_release\']
.encode("UTF-8")
,\n
\'software_title\': data_dict[\'title\'],\n
\'software_title\': data_dict[\'title\']
.encode("UTF-8")
,\n
\'software_type\': data_dict[\'software_type\'],\n
\'software_type\': data_dict[\'software_type\']
.encode("UTF-8")
,\n
\'instance_xml\': dictToXml(data_dict[\'parameter\']),\n
\'instance_xml\': dictToXml(data_dict[\'parameter\']),\n
\'sla_xml\': dictToXml(data_dict[\'sla\']),\n
\'sla_xml\': dictToXml(data_dict[\'sla\']),\n
\'shared\': data_dict[\'slave\'],\n
\'shared\': data_dict[\'slave\'],\n
\'state\': data_dict[\'status\'],\n
\'state\': data_dict[\'status\']
.encode("UTF-8")
,\n
}\n
}\n
except KeyError:\n
except KeyError:\n
response.setStatus(400)\n
response.setStatus(400)\n
...
...
master/bt5/slapos_hypermedia/TestTemplateItem/testSlapOSHypermediaScenario.py
View file @
6c9d9b5f
# -*- coding: utf-8 -*-
# Copyright (c) 2002-2013 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2002-2013 Nexedi SA and Contributors. All Rights Reserved.
import
transaction
import
transaction
from
Products.SlapOS.tests.testSlapOSMixin
import
\
from
Products.SlapOS.tests.testSlapOSMixin
import
\
...
@@ -95,11 +96,11 @@ class TestSlapOSHypermediaPersonScenario(testSlapOSMixin):
...
@@ -95,11 +96,11 @@ class TestSlapOSHypermediaPersonScenario(testSlapOSMixin):
'Content-Type'
:
request_link_dict
[
'type'
],
'Content-Type'
:
request_link_dict
[
'type'
],
},
},
body
=
json
.
dumps
({
body
=
json
.
dumps
({
'software_release'
:
'http://example.org'
,
'software_release'
:
'http://example.org
é
'
,
'title'
:
'a great title'
,
'title'
:
'a great title
é
'
,
'software_type'
:
'foo'
,
'software_type'
:
'foo
é
'
,
'parameter'
:
{
'param1
'
:
'value1'
,
'param2'
:
'value2
'
},
'parameter'
:
{
'param1
é'
:
'value1é'
,
'param2é'
:
'value2é
'
},
'sla'
:
{
'param3
'
:
'value3'
,
'param4'
:
'value4
'
},
'sla'
:
{
'param3
é'
:
'value3é'
,
'param4é'
:
'value4é
'
},
'slave'
:
False
,
'slave'
:
False
,
'status'
:
'started'
,
'status'
:
'started'
,
}),
}),
...
...
master/bt5/slapos_hypermedia/TestTemplateItem/testSlapOSHypermediaSkins.py
View file @
6c9d9b5f
# -*- coding: utf-8 -*-
# Copyright (c) 2002-2013 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2002-2013 Nexedi SA and Contributors. All Rights Reserved.
import
transaction
import
transaction
from
Products.SlapOS.tests.testSlapOSMixin
import
\
from
Products.SlapOS.tests.testSlapOSMixin
import
\
...
@@ -423,11 +424,11 @@ class TestSlapOSPerson_requestHateoasHostingSubscription(testSlapOSMixin):
...
@@ -423,11 +424,11 @@ class TestSlapOSPerson_requestHateoasHostingSubscription(testSlapOSMixin):
@
simulate
(
'Base_getRequestBody'
,
'*args, **kwargs'
,
@
simulate
(
'Base_getRequestBody'
,
'*args, **kwargs'
,
'return """%s"""'
%
json
.
dumps
({
'return """%s"""'
%
json
.
dumps
({
'software_release'
:
'http://example.org'
,
'software_release'
:
'http://example.org
é
'
,
'title'
:
'a great title'
,
'title'
:
'a great title
é
'
,
'software_type'
:
'foo'
,
'software_type'
:
'foo
é
'
,
'parameter'
:
{
'param1
'
:
'value1'
,
'param2'
:
'value2
'
},
'parameter'
:
{
'param1
é'
:
'value1é'
,
'param2é'
:
'value2é
'
},
'sla'
:
{
'param3'
:
'value3
'
,
'param4'
:
'value4
'
},
'sla'
:
{
'param3'
:
'value3
é'
,
'param4é'
:
'value4é
'
},
'slave'
:
False
,
'slave'
:
False
,
'status'
:
'started'
,
'status'
:
'started'
,
}))
}))
...
...
master/bt5/slapos_hypermedia/bt/revision
View file @
6c9d9b5f
1
2
\ No newline at end of file
\ No newline at end of file
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