def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def visitdir(self, dir):
        dir = normalizerootdir(dir, "visitdir")
        if dir == "":
            dir = self._path
        else:
            dir = self._path + "/" + dir
        return self._matcher.visitdir(dir)