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
Пример #2
0
def import_all(all) :
    for file in all :
        match = get_matching_id(file)

        if match :
            print "found %s " % file['title'].encode('utf-8')
        else :
            try:
                print "trouble with %s" % file['title']
            except :
                print "trouble with %s (unicode)" % file['title'].encode('utf-8')
            #ipdb.set_trace()
            try :
                print
                import_one(file)
                if reverse.has_key(file['parentuid']) :
                    par = file['parentuid']
                    print ("parent: (%s,%s)" % (e_type(par),title(par))).encode('utf-8')
            except Exception, e:
                print e
                ipdb.set_trace()
                log.append('%s, %s, %s'%(file['uid'],file['title'],e))
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
Пример #4
0
def import_all(all):
    for file in all:
        match = get_matching_id(file)

        if match:
            print "found %s " % file['title'].encode('utf-8')
        else:
            try:
                print "trouble with %s" % file['title']
            except:
                print "trouble with %s (unicode)" % file['title'].encode(
                    'utf-8')
            #ipdb.set_trace()
            try:
                print
                import_one(file)
                if reverse.has_key(file['parentuid']):
                    par = file['parentuid']
                    print("parent: (%s,%s)" %
                          (e_type(par), title(par))).encode('utf-8')
            except Exception, e:
                print e
                ipdb.set_trace()
                log.append('%s, %s, %s' % (file['uid'], file['title'], e))