コード例 #1
0
        p = Unpickler(f)
        return p.load()

    def saveInCache(self, meta, kb):
        """Save these things associated with the uri

        """

        try:
            os.makedirs(os.path.dirname(self.filename()))
        except OSError, error:
            if error.strerror != "File exists": raise error

        f = file(self.filename() + ",meta", "w")
        p = Pickler(f, -1)
        p.dump(meta)

        f = file(self.filename() + ",kb", "w")
        p = Pickler(f, 0)
        #f=kb[0]
        #print >>stderr, f
        #t=f.function
        #print >>stderr, t
        #p.dump(t)
        p.dump((kb.exivars, kb.univars, kb[:]))


if __name__ == "__main__":
    import doctest, sys
    doctest.testmod(sys.modules[__name__])
コード例 #2
0
ファイル: loader.py プロジェクト: Mchockalingam/swap
        p=Unpickler(f)
        return p.load()
        
    def saveInCache(self, meta, kb):
        """Save these things associated with the uri

        """

        try:
            os.makedirs(os.path.dirname(self.filename()))
        except OSError, error:
            if error.strerror != "File exists": raise error

        f=file(self.filename()+",meta", "w")
        p=Pickler(f, -1)
        p.dump(meta)

        f=file(self.filename()+",kb", "w")
        p=Pickler(f, 0)
        #f=kb[0]
        #print >>stderr, f
        #t=f.function
        #print >>stderr, t
        #p.dump(t)
        p.dump((kb.exivars, kb.univars, kb[:]))

if __name__ == "__main__":
    import doctest, sys
    doctest.testmod(sys.modules[__name__])

def __test1():