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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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
assert same_type(dict_data, {})\n
result = "<?xml version=\'1.0\' encoding=\'utf-8\'?>
<instance>
\\n"\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
return result\n
\n
try:\n
parameter_kw = {\n
\'software_release\': data_dict[\'software_release\'],\n
\'software_title\': data_dict[\'title\'],\n
\'software_type\': data_dict[\'software_type\'],\n
\'software_release\': data_dict[\'software_release\']
.encode("UTF-8")
,\n
\'software_title\': data_dict[\'title\']
.encode("UTF-8")
,\n
\'software_type\': data_dict[\'software_type\']
.encode("UTF-8")
,\n
\'instance_xml\': dictToXml(data_dict[\'parameter\']),\n
\'sla_xml\': dictToXml(data_dict[\'sla\']),\n
\'shared\': data_dict[\'slave\'],\n
\'state\': data_dict[\'status\'],\n
\'state\': data_dict[\'status\']
.encode("UTF-8")
,\n
}\n
except KeyError:\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.
import
transaction
from
Products.SlapOS.tests.testSlapOSMixin
import
\
...
...
@@ -95,11 +96,11 @@ class TestSlapOSHypermediaPersonScenario(testSlapOSMixin):
'Content-Type'
:
request_link_dict
[
'type'
],
},
body
=
json
.
dumps
({
'software_release'
:
'http://example.org'
,
'title'
:
'a great title'
,
'software_type'
:
'foo'
,
'parameter'
:
{
'param1
'
:
'value1'
,
'param2'
:
'value2
'
},
'sla'
:
{
'param3
'
:
'value3'
,
'param4'
:
'value4
'
},
'software_release'
:
'http://example.org
é
'
,
'title'
:
'a great title
é
'
,
'software_type'
:
'foo
é
'
,
'parameter'
:
{
'param1
é'
:
'value1é'
,
'param2é'
:
'value2é
'
},
'sla'
:
{
'param3
é'
:
'value3é'
,
'param4é'
:
'value4é
'
},
'slave'
:
False
,
'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.
import
transaction
from
Products.SlapOS.tests.testSlapOSMixin
import
\
...
...
@@ -423,11 +424,11 @@ class TestSlapOSPerson_requestHateoasHostingSubscription(testSlapOSMixin):
@
simulate
(
'Base_getRequestBody'
,
'*args, **kwargs'
,
'return """%s"""'
%
json
.
dumps
({
'software_release'
:
'http://example.org'
,
'title'
:
'a great title'
,
'software_type'
:
'foo'
,
'parameter'
:
{
'param1
'
:
'value1'
,
'param2'
:
'value2
'
},
'sla'
:
{
'param3'
:
'value3
'
,
'param4'
:
'value4
'
},
'software_release'
:
'http://example.org
é
'
,
'title'
:
'a great title
é
'
,
'software_type'
:
'foo
é
'
,
'parameter'
:
{
'param1
é'
:
'value1é'
,
'param2é'
:
'value2é
'
},
'sla'
:
{
'param3'
:
'value3
é'
,
'param4é'
:
'value4é
'
},
'slave'
:
False
,
'status'
:
'started'
,
}))
...
...
master/bt5/slapos_hypermedia/bt/revision
View file @
6c9d9b5f
1
\ No newline at end of file
2
\ 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