示例#1
0
        author = dbi.get_author()
        author.retreive_one("name", authorname)
        author.set("name", authorname)
        author.set("link", weblink)

        if not author.exists():
            print ("Author %s doesn't exist, adding now" % authorname)
            author.create()
        else:
            print ("Author %s exists already, updating" % authorname)
            author.update()

        dlfile = CreateTar(patchname, patchDir, patchComsFile, opts.dlfolder)

        patch = dbi.get_patch()
        patch.retreive_one("name", patchname)
        patch.set("name", patchname)
        patch.set("aid", author.get("aid"))
        patch.set("dlfile", dlfile)

        if not patch.exists():
            print ("Patch %s doesn't exist, adding now" % patchname)
            patch.create()
        else:
            print ("Patch %s exists already, Updating" % patchname)
            patch.update()

        del (author)
        del (patch)