Skip to content

Commit 35645d7

Browse files
committed
refactor (CS): use JEncode bytes for CS
1 parent 2856559 commit 35645d7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/DIRAC/ConfigurationSystem/Client/ConfigurationClient.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
__RCSID__ = "$Id$"
66

7-
7+
import six
88
from base64 import b64encode, b64decode
99

1010
from DIRAC.Core.Tornado.Client.TornadoClient import TornadoClient
@@ -51,7 +51,7 @@ def commitNewData(self, sData):
5151
5252
:param sData: Data to commit, you may call this method with CSAPI and Modificator
5353
"""
54-
return self.executeRPC("commitNewData", b64encode(sData))
54+
return self.executeRPC("commitNewData", b64encode(sData) if six.PY2 else sData)
5555

5656

5757
class ConfigurationClient(Client):

src/DIRAC/ConfigurationSystem/Service/TornadoConfigurationHandler.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ def export_getCompressedData(self):
4949
"""
5050
Returns the configuration
5151
"""
52-
sData = self.ServiceInterface.getCompressedConfigurationData()
53-
return S_OK(b64encode(sData))
52+
# TODO: in 8.0 replace it to:
53+
# return S_OK(self.ServiceInterface.getCompressedConfigurationData())
54+
return S_OK(b64encode(self.ServiceInterface.getCompressedConfigurationData()).decode())
5455

5556
def export_getCompressedDataIfNewer(self, sClientVersion):
5657
"""
@@ -61,7 +62,9 @@ def export_getCompressedDataIfNewer(self, sClientVersion):
6162
sVersion = self.ServiceInterface.getVersion()
6263
retDict = {"newestVersion": sVersion}
6364
if sClientVersion < sVersion:
64-
retDict["data"] = b64encode(self.ServiceInterface.getCompressedConfigurationData())
65+
# TODO: in 8.0 replace it to:
66+
# retDict["data"] = self.ServiceInterface.getCompressedConfigurationData()
67+
retDict["data"] = b64encode(self.ServiceInterface.getCompressedConfigurationData()).decode()
6568
return S_OK(retDict)
6669

6770
def export_publishSlaveServer(self, sURL):

0 commit comments

Comments
 (0)