def check_files(lst):
    missing = []
    misplaced = []
    accounted = 0
    well_placed = 0

    for file in lst:
        match = get_matching_id(file)

        uid = file['uid']
        container = get_top_container(uid, [], [])
        print file['state']

        if not match:

            missing.append({
                'uid': uid,
                'title': file['title'],
                'mainparentuid': file['mainparentuid']
            })
            print container, e_title(file['mainparentuid'])
            print file['title'].encode('utf-8')

        else:

            accounted = accounted + 1
            real_container = match.in_agent.obj
            if real_container != container:
                print real_container, container
                misplaced.append({
                    'upload': match,
                    'owner': match.created_by,
                    'in': real_container,
                    'ought': container
                })
            else:
                well_placed = well_placed + 1

    for m in missing:
        print m
    print "There are %s uploads missing" % len(missing)
    print "%s are ok" % accounted
    for m in misplaced:
        print m
    print "There are %s uploads misplaced" % len(misplaced)
    print "%s are well placed" % well_placed
def check_files(lst) :
    missing = []
    misplaced = []
    accounted = 0
    well_placed=0

    for file in lst :
        match = get_matching_id(file)

        uid = file['uid']
        container = get_top_container(uid,[],[])
        print file['state']
        

        if not match :

            missing.append({'uid':uid,'title':file['title'],'mainparentuid':file['mainparentuid']})
            print container, e_title(file['mainparentuid'])
            print file['title'].encode('utf-8')

        else :

            accounted=accounted+1
            real_container = match.in_agent.obj
            if real_container != container :
                print real_container, container
                misplaced.append({'upload':match,'owner':match.created_by, 'in':real_container,'ought':container})
            else :
                well_placed = well_placed + 1

    for m in missing :
        print m
    print "There are %s uploads missing" % len(missing)
    print "%s are ok" % accounted
    for m in misplaced :
        print m
    print "There are %s uploads misplaced" % len(misplaced)
    print "%s are well placed" % well_placed
Пример #3
0
userlog = []
if __name__ == '__main__' :
    load_all()
    for upload in maps['File'] :
        print 
        uid = upload['uid']
        title = upload['title']
        related = upload['related']        
            
        container = get_top_container(uid,[],[])
        
        print container, title.encode('utf-8'), related
        
        mainparentuid =  upload['mainparentuid']
        if reverse.has_key(mainparentuid) :
            print "mainparent %s, %s" % (e_type(mainparentuid),e_title(mainparentuid))
            mainparent = reverse[mainparentuid]
            try :
                if mainparent[1]['groupname'] != 'RESOURCES' :
                    print "Main parent title %s" % mainparent[1]['groupname']
            except Exception, e :
                print e
                if e_type(mainparentuid) == 'User' :
                    userlog.append({'uid':uid,'mainparentuid':mainparentuid,'owner':e_title(mainparentuid)})
                else :
                    print e
                    ipdb.set_trace()
                
        else :
            print "no reverse for %s" % uid
            ipdb.set_trace()