Ejemplo n.º 1
0
def mergeUsers(middlewareName1, middlewareName2):
    middlewareData1 = load_middleware(middlewareName1)
    middlewareData2 = load_middleware(middlewareName2)
    data1 = GSet.loadFromDict(middlewareData1['Users'])
    data2 = GSet.loadFromDict(middlewareData2['Users'])
    data1.merge(data2)
    mergedList = data1.toDict()
    middlewareData1['Users'] = mergedList
    save_middleware(middlewareData1, middlewareName1)
    save_middleware(middlewareData1, middlewareName2)
Ejemplo n.º 2
0
def addUsers(user, dbName, middlewareName):  
    middlewareData = load_middleware(middlewareName)
    data = GSet.loadFromDict(middlewareData['Users'])  # type(middlewareData['Users']) : GSet
    data.add(user)
    middlewareData['Users'] = data.toDict()
    save_middleware(middlewareData, middlewareName)