コード例 #1
0
def verifySignature(task):
	task_tag = "VERIFYING SIGNATURE"
	print "\n\n************** %s [START] ******************\n" % task_tag
	print "image preprocessing at %s" % task.doc_id
	task.setStatus(302)
		
	from lib.Worker.Models.ic_media import InformaCamMedia
	
	from conf import DEBUG
	from vars import ASSET_TAGS
	
	media = InformaCamMedia(_id=task.doc_id)
	if media is None:
		print "DOC IS NONE"
		print "\n\n************** %s [ERROR] ******************\n" % task_tag
		task.fail()
		return
	
	if not media.set_j3m_comp():
		print "COULD NOT SET MEDIA COMP"
		print "\n\n************** %s [ERROR] ******************\n" % task_tag
		task.fail()
		return

	if not media.verify_signature():
		print "COULD NOT VERIFY SIG"
		print "\n\n************** %s [ERROR] ******************\n" % task_tag
		task.fail()
		return
	
	media.addCompletedTask(task.task_path)
	
	task.routeNext()
	task.finish()
	print "\n\n************** %s [END] ******************\n" % task_tag
コード例 #2
0
ファイル: notarize.py プロジェクト: unveillance/InformaAnnex
def notarize_media(uv_task):
    task_tag = "NOTARIZING MEDIA"
    print "\n\n************** %s [START] ******************\n" % task_tag
    print "notarizing media for doc at %s" % uv_task.doc_id
    uv_task.setStatus(302)

    from lib.Worker.Models.ic_media import InformaCamMedia

    media = InformaCamMedia(_id=uv_task.doc_id)
    if media is None:
        print "DOC IS NONE"
        print "\n\n************** %s [ERROR] ******************\n" % task_tag
        uv_task.fail()
        return

    if not media.notarize():
        print "COULD NOT NOTARIZE MEDIA"
        print "\n\n************** %s [WARN] ******************\n" % task_tag
    else:
        media.addCompletedTask(uv_task.task_path)

    uv_task.routeNext()
    uv_task.finish()
    print "\n\n************** %s [END] ******************\n" % task_tag