URL: https://github.com/freeipa/freeipa/pull/994
Author: frasertweedale
 Title: #994: py3: fix schema response for py2 server with py3 client
Action: opened

PR body:
"""
The schema RPC response can include a bytes value for the
'topic_topic' field (when the server is running in Python 2).
In this case, a Python 3 client fails to initialise the API
when a schema fetch is required, because it cannot serialise
the bytes values in the schema object to JSON.

Ensure the 'topic_topic' value is unicode.

Part of: https://pagure.io/freeipa/issue/4985
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/994/head:pr994
git checkout pr994
From 04d834eb09f1f4a0fddcf6acbd4e3beaa747174c Mon Sep 17 00:00:00 2001
From: Fraser Tweedale <ftwee...@redhat.com>
Date: Wed, 23 Aug 2017 18:01:02 +1000
Subject: [PATCH] py3: fix schema response for py2 server with py3 client

The schema RPC response can include a bytes value for the
'topic_topic' field (when the server is running in Python 2).
In this case, a Python 3 client fails to initialise the API
when a schema fetch is required, because it cannot serialise
the bytes values in the schema object to JSON.

Ensure the 'topic_topic' value is unicode.

Part of: https://pagure.io/freeipa/issue/4985
---
 ipaserver/plugins/schema.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipaserver/plugins/schema.py b/ipaserver/plugins/schema.py
index 8fd7c6ba1c..1dbbec5f03 100644
--- a/ipaserver/plugins/schema.py
+++ b/ipaserver/plugins/schema.py
@@ -399,8 +399,8 @@ def __make_topics(self):
                         continue
                     if topic_value is not None:
                         topic_name = unicode(topic_value)
-                        topic['topic_topic'] = '{}/{}'.format(topic_name,
-                                                              topic_version)
+                        topic['topic_topic'] = u'{}/{}'.format(topic_name,
+                                                               topic_version)
                     else:
                         topic.pop('topic_topic', None)
 
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to