コード例 #1
0
ファイル: views.py プロジェクト: DanCoughlin/caps
def get_identifier(request):
    id = identity.mint()

    if (identity.validate(id) ):
        return render_to_response('identifier.html', {'identifier' : id })
    else:
        return render_to_response('identifier.html', {'identifier' : "0" })        
コード例 #2
0
ファイル: testservices.py プロジェクト: DanCoughlin/caps
    def handle(self, *args, **options):
        print "starting"
        source_location = mkdtemp()
        myfile = args[0]
        shutil.copy(myfile, source_location)
        new_id = identity.mint()
        print "new_id:%s" % new_id
        print "exists:%s" % identity.exists(new_id)
        print "is it valid:%s" % identity.validate(new_id)

        identity.bind(new_id, myfile, 'tstem31')

        print "exists:%s" % identity.exists(new_id)
        print "store"
        storage.ingest_directory(new_id, source_location)
        print "stored"

        fix = fixity.generate(myfile, 'md5')
        print "fixity for %s is: %s" % (myfile, fix)
        fixity.bind(new_id, fix)

        print "adding an annotation"
        assertions = []
        assertions.append((new_id, ("dc", "http://purl.org/dc/elements/1.1/", "title"), "this is a test title"))
        assertions.append((new_id, ("dc", "http://purl.org/dc/elements/1.1/", "author"), "Shakespeare, Billy"))
        annotate.add(new_id, assertions)
        print "annotation added"
        print "ending"
        return