Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
ros2-scripts
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
ros2-scripts
Commits
db9055aa
Commit
db9055aa
authored
Jan 04, 2019
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
html.escape and request format
parent
a508f5b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
ros2_master.py
src/init/ros2_master.py
+5
-3
ros2_slave.py
src/init/ros2_slave.py
+2
-1
No files found.
src/init/ros2_master.py
View file @
db9055aa
...
...
@@ -20,15 +20,17 @@ def parse_command(string):
e
=
ET
.
fromstring
(
string
)
tmp
=
e
.
find
(
'cmd'
)
if
tmp
!=
None
:
if
tmp
!=
None
and
tmp
.
text
!=
None
:
# have to escape: &
msg
[
'cmd'
]
=
html
.
escape
(
tmp
.
text
)
else
:
msg
[
'cmd'
]
=
'state'
tmp
=
e
.
find
all
(
'target
'
)
tmp
=
e
.
find
(
'targets
'
)
if
not
tmp
:
if
tmp
!=
None
and
tmp
.
text
!=
None
:
msg
[
'targets'
]
=
tmp
.
text
.
split
(
","
)
else
:
msg
[
'targets'
]
=
clients
return
msg
...
...
src/init/ros2_slave.py
View file @
db9055aa
...
...
@@ -2,6 +2,7 @@
import
subprocess
import
xml.etree.ElementTree
as
ET
import
html
import
rclpy
from
elphel_interfaces.srv
import
StrReqStrRes
...
...
@@ -40,7 +41,7 @@ def cmd_callback(req,res):
except
subprocess
.
CalledProcessError
:
output
=
"<error>CalledProcessError</error>"
.
encode
()
res
.
response
=
'<state>'
+
output
.
decode
(
)
+
'</state>'
res
.
response
=
'<state>'
+
html
.
escape
(
output
.
decode
()
)
+
'</state>'
print
(
'Slave sending: '
+
res
.
response
)
...
...
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