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
Paul Graydon
slapos.core
Commits
446c175c
Commit
446c175c
authored
Nov 14, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.slap: cast xml from unicode to string if it is unicode.
parent
2fad6ceb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
slapos/proxy/views.py
slapos/proxy/views.py
+5
-1
slapos/slap/slap.py
slapos/slap/slap.py
+14
-1
No files found.
slapos/proxy/views.py
View file @
446c175c
...
...
@@ -495,7 +495,11 @@ def forwardRequestToExternalMaster(master_url, request_form):
filter_kw
[
'source_instance_id'
]
=
partition_reference
new_request_form
[
'filter_xml'
]
=
dumps
(
filter_kw
)
partition
=
loads
(
slap
.
_connection_helper
.
POST
(
'/requestComputerPartition'
,
data
=
new_request_form
))
xml
=
slap
.
_connection_helper
.
POST
(
'/requestComputerPartition'
,
data
=
new_request_form
)
if
type
(
xml
)
is
unicode
:
xml
=
str
(
xml
)
xml
.
encode
(
'utf-8'
)
partition
=
loads
(
xml
)
# XXX move to other end
partition
.
_master_url
=
master_url
...
...
slapos/slap/slap.py
View file @
446c175c
...
...
@@ -85,6 +85,9 @@ class SlapRequester(SlapDocument):
request_dict
=
request_dict
,
connection_helper
=
self
.
_connection_helper
,
)
if
type
(
xml
)
is
unicode
:
xml
=
str
(
xml
)
xml
.
encode
(
'utf-8'
)
software_instance
=
xml_marshaller
.
loads
(
xml
)
computer_partition
=
ComputerPartition
(
software_instance
.
slap_computer_id
.
encode
(
'UTF-8'
),
...
...
@@ -656,6 +659,9 @@ class ConnectionHelper:
# We should stablise slap library soon.
xml
=
self
.
GET
(
'getComputerInformation'
,
params
=
params
)
if
type
(
xml
)
is
unicode
:
xml
=
str
(
xml
)
xml
.
encode
(
'utf-8'
)
return
xml_marshaller
.
loads
(
xml
)
def
do_request
(
self
,
method
,
path
,
params
=
None
,
data
=
None
,
headers
=
None
):
...
...
@@ -794,6 +800,9 @@ class slap:
'computer_partition_reference'
:
partition_id
,
}
)
if
type
(
xml
)
is
unicode
:
xml
=
str
(
xml
)
xml
.
encode
(
'utf-8'
)
result
=
xml_marshaller
.
loads
(
xml
)
# XXX: dirty hack to make computer partition usable. xml_marshaller is too
# low-level for our needs here.
...
...
@@ -828,7 +837,11 @@ class slap:
'software_release_url parameters are specified.'
)
params
[
'software_release_url'
]
=
software_release_url
result
=
xml_marshaller
.
loads
(
self
.
_connection_helper
.
GET
(
url
,
params
=
params
))
xml
=
self
.
_connection_helper
.
GET
(
url
,
params
=
params
)
if
type
(
xml
)
is
unicode
:
xml
=
str
(
xml
)
xml
.
encode
(
'utf-8'
)
result
=
xml_marshaller
.
loads
(
xml
)
assert
(
type
(
result
)
==
list
)
return
result
...
...
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