Пример #1
0
def doit():
    a = pickle.load(open('dateeee.pydat','r'))
    
    for key in a.keys():
        
        print a[key]

        inoutdict = {
            'id':key,
            'label':a[key]['LB'],
            'TI':a[key]['get_title'],
            'AB':a[key]['get_AB'],
            
            'PY':a[key]['get_PY'],
            'VL':a[key]['get_VL'],
            'IS':a[key]['get_IS'],
            'SP':a[key]['get_SP'],
            'doc':a[key]['get_fulltext'],
            'created_on':datetime.datetime.now(),
    
        }
        if type(a[key]['T2']) == type(10L):
            inoutdict['T2'] = journal.objects.get(pk=a[key]['T2'])
      
        try:
            j1 = journalarticle(**inoutdict)
            j1.save()
        except:
            continue

        # create the authors
        if len(a[key]['get_author']) > 0:
            for au in a[key]['get_author']:
                author = authors.objects.get(pk=au[0])
                mpublication = publication.objects.get(pk=j1.id)
                sequence = au[1]
                aa = Authorship(author=author,publication=mpublication,sequence=sequence)
                aa.save()

        
        try:
            # create the keywords
            for kw in a[key]['get_KW']:
                j1.KWS.add(kw)
                j1.save()
        except:
            continue
        
    print 1
Пример #2
0
def find_or_create_authorlist(inputstring,pb):
    aulist = []
    if ',' in inputstring:
        strings = inputstring.split(',')
        
        i = 1
        for singlestr in strings:
            au = find_or_create_author(singlestr)
            au1 = Authorship(author=au,publication=pb,sequence=i)
            au1.save()
            aulist.append(au1)
            i += 1
            
            
    else:
        au = find_or_create_author(inputstring)
        au1 = Authorship(author=au,publication=pb,sequence=1)
        au1.save()
        aulist.append(au1)
        
    return aulist