Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
G
gracedb-client
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
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
Leo Pound Singer
gracedb-client
Commits
a669a741
Verified
Commit
a669a741
authored
Jul 11, 2018
by
Tanner Prestegard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing fake response kludge for VOEvent text
Ensuring that VOEvent file text (in fake response kludge) is unicode.
parent
ba23f254
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
ligo/gracedb/rest.py
ligo/gracedb/rest.py
+11
-7
No files found.
ligo/gracedb/rest.py
View file @
a669a741
...
...
@@ -122,6 +122,14 @@ class ProxyHTTPSConnection(ProxyHTTPConnection):
else
:
self
.
sock
=
self
.
context
.
wrap_socket
(
self
.
sock
)
# Hacky fake response type for kludging response object
# Has json() and read() methods
class
FakeResponse
(
object
):
def
__init__
(
self
,
json
,
*
args
,
**
kwargs
):
self
.
_data
=
json
def
json
(
self
):
return
self
.
_data
def
read
(
self
):
return
json
.
dumps
(
self
.
_data
)
#-----------------------------------------------------------------
# Generic GSI REST
...
...
@@ -1595,16 +1603,12 @@ class GraceDb(GsiRest):
if
'voevents'
in
r_json
:
# list of voevents - iterate and get file text
for
v
in
r_json
[
'voevents'
]:
v
[
u
'text'
]
=
self
.
files
(
object_id
,
v
[
'filename'
]).
read
()
v
[
u
'text'
]
=
self
.
files
(
object_id
,
v
[
'filename'
])
\
.
read
().
decode
()
else
:
file_text
=
self
.
files
(
object_id
,
r_json
[
'filename'
]).
read
()
r_json
[
u
'text'
]
=
file_text
r_json
[
u
'text'
]
=
file_text
.
decode
()
# Set up fake response object with json() and read() methods
class
FakeResponse
(
object
):
def
__init__
(
self
,
json
,
*
args
,
**
kwargs
):
self
.
_data
=
json
def
json
(
self
):
return
self
.
_data
def
read
(
self
):
return
json
.
dumps
(
self
.
_data
)
response
=
FakeResponse
(
r_json
)
# Return 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