@@ -51,7 +51,7 @@ class UserProfileDB(DB):
51
51
"VOId" : "INTEGER" ,
52
52
"Profile" : "VARCHAR(255) NOT NULL" ,
53
53
"VarName" : "VARCHAR(255) NOT NULL" ,
54
- "Data" : "BLOB " ,
54
+ "Data" : "TEXT " ,
55
55
"ReadAccess" : 'VARCHAR(10) DEFAULT "USER"' ,
56
56
"PublishAccess" : 'VARCHAR(10) DEFAULT "USER"' ,
57
57
},
@@ -260,7 +260,8 @@ def retrieveVarById(self, userIds, ownerIds, profileName, varName):
260
260
return result
261
261
data = result ["Value" ]
262
262
if len (data ) > 0 :
263
- return S_OK (data [0 ][0 ].decode ())
263
+ # TODO: The decode is only needed in DIRAC v8.0.x while moving from BLOB -> TEXT
264
+ return S_OK (data [0 ][0 ].decode () if isinstance (data [0 ][0 ], bytes ) else data [0 ][0 ])
264
265
return S_ERROR ("No data for userIds %s profileName %s varName %s" % (userIds , profileName , varName ))
265
266
266
267
def retrieveAllUserVarsById (self , userIds , profileName ):
@@ -278,7 +279,12 @@ def retrieveAllUserVarsById(self, userIds, profileName):
278
279
if not result ["OK" ]:
279
280
return result
280
281
data = result ["Value" ]
281
- return S_OK ({k : v .decode () for k , v in data })
282
+ try :
283
+ # TODO: This is only needed in DIRAC v8.0.x while moving from BLOB -> TEXT
284
+ allUserDataDict = {k : v .decode () for k , v in data }
285
+ except AttributeError :
286
+ allUserDataDict = {k : v for k , v in data }
287
+ return S_OK (allUserDataDict )
282
288
283
289
def retrieveUserProfilesById (self , userIds ):
284
290
"""
@@ -289,12 +295,15 @@ def retrieveUserProfilesById(self, userIds):
289
295
result = self ._query (selectSQL )
290
296
if not result ["OK" ]:
291
297
return result
292
- data = result ["Value" ]
293
298
dataDict = {}
294
- for profile , varName , data in data :
299
+ for profile , varName , data in result [ "Value" ] :
295
300
if profile not in dataDict :
296
301
dataDict [profile ] = {}
297
- dataDict [profile ][varName ] = data .decode ()
302
+ try :
303
+ # TODO: This is only needed in DIRAC v8.0.x while moving from BLOB -> TEXT
304
+ dataDict [profile ][varName ] = data .decode ()
305
+ except AttributeError :
306
+ dataDict [profile ][varName ] = data
298
307
return S_OK (dataDict )
299
308
300
309
def retrieveVarPermsById (self , userIds , ownerIds , profileName , varName ):
0 commit comments