def test_Dirs(self): n = self.base p = DvPath(n) self.assert_(str(p) == n) p.Append("another_dir" + os.sep + "and.file") self.assert_(str(p) == n + "another_dir" + os.sep + "and.file", str(p)) p = DvPath(n) p.AppendDirectory("the_last") self.assert_(str(p) == n + "the_last" + os.sep, str(p)) p.RemoveLastDirectory() self.assert_(str(p) == n) p = DvPath(n[:-1]) p.AppendSeperator() self.assert_(str(p) == self.base)
def _Path(self, absolute = True): """ Get the physical path of the file. Checks the database. """ if self.tempfile or not self.path: return u"" root = str(self.fileentry().pool.root) if absolute and self.path[:len(root)] != root: path = DvPath(root) path.AppendSeperator() path.Append(self.path) else: path = DvPath(self.path) return path.GetStr()