def subdir(self): subdir = self.store.subdir if subdir != None: subdir = fileutils.str2path(subdir) subdir = fileutils.ensureRelDirPath(subdir) return fileutils.cleanupPath(subdir) subdir = fileutils.str2filename(self.store.name) return fileutils.ensureDirPath(subdir)
def _guessOverridenDir(self, dir, custData, profData): for middle, new in [('incoming', 'incoming'), ('outgoing', 'outgoing'), ('errors', 'failed'), ('links', 'links'), ('thumbnails', 'thumbnails')]: try: i = dir.index(middle) p1 = dir[:i].strip('/') p2 = dir[i + len(middle):].strip('/') # Check to reorder profiles directories custSubdir = custData.subdir or fileutils.str2filename(custData.name) profSubdir = profData.subdir or fileutils.str2filename(profData.name) if p1 == (custSubdir + '/' + profSubdir): result = custSubdir + "/files/" + new + "/" + profSubdir + '/' + p2 else: result = p1 + "/files/" + new + "/" + p2 result = fileutils.ensureDirPath(result) result = fileutils.cleanupPath(result) return result except ValueError: pass return dir