def load(self, fp):

        """Given a file produced by "store()", read in and populate SELF
        with elements."""

        lines = fp.readlines()
        for line in lines:
            classname, id, name = self.parse_storage_line(line)

            clss = find_class(classname)

            if clss and issubclass(clss, Document):
                if self.repository.valid_doc_id(id):
                    self[name] = self.repository.get_document(id)
                else:
                    note("invalid doc ID %s found in collection file %s", id, self)
            elif clss and issubclass(clss, Collection):
                c = self.repository.get_collection(id, true)
                if not c:
                    c = clss(self.repository, id)
                    self.repository.add_collection(id, c)
                self[name] = c
                self.add_storage_extras(c, line)
            else:
                note("invalid class <%s> found in collection file %s", classname, self)
 def recache(self):
     if self.REPOSITORY:
         clss = find_class(self.collclass or "uplib.collection.Collection")
         if clss and issubclass(clss, Collection):
             d = clss(self.REPOSITORY, self.id)
             self.REPOSITORY.add_collection(self.name, d, false)
             self.pointer = weakref.ref(d)
     return d