def folder(self): "Parent folder(s)" warnings.warn( "directory will be removed with 3.6, use dirname instead.", DeprecationWarning) return os.path.dirname( path_strip(os.path.join(self.head, ''), self.site.directory))
def _walk(self, path, filelisting): """ Recursively walks the path and collects all files and directories. Danger: Symbolic links can create cycles and this function ends up in a regression. """ dirs, files = self.site.storage.listdir(path) if dirs: for d in dirs: self._walk(os.path.join(path, d), filelisting) filelisting.extend([path_strip(os.path.join(path, d), self.site.directory)]) if files: for f in files: filelisting.extend([path_strip(os.path.join(path, f), self.site.directory)])
def get_version_path(self, value, version_prefix): """ Construct the PATH to an Image version. value has to be a path relative to the location of the site's storage. version_filename = filename + version_prefix + ext Returns a relative path to the location of the site's storage. """ if self.storage.isfile(value): path, filename = os.path.split(value) relative_path = path_strip(os.path.join(path,''), self.directory) filename, ext = os.path.splitext(filename) version_filename = filename + "_" + version_prefix + ext if fb_settings.VERSIONS_BASEDIR: return os.path.join(fb_settings.VERSIONS_BASEDIR, relative_path, version_filename) else: return os.path.join(self.directory, relative_path, version_filename) else: return None
def get_version_path(self, value, version_prefix): """ Construct the PATH to an Image version. value has to be a path relative to the location of the site's storage. version_filename = filename + version_prefix + ext Returns a relative path to the location of the site's storage. """ if self.storage.isfile(value): path, filename = os.path.split(value) relative_path = path_strip(os.path.join(path, ''), self.directory) filename, ext = os.path.splitext(filename) version_filename = filename + "_" + version_prefix + ext if fb_settings.VERSIONS_BASEDIR: return os.path.join(fb_settings.VERSIONS_BASEDIR, relative_path, version_filename) else: return os.path.join(self.directory, relative_path, version_filename) else: return None
def directory(self): "Folder(s) relative from site.directory" warnings.warn( "directory will be removed with 3.6, use path_relative_directory instead.", DeprecationWarning) return path_strip(self.path, self.site.directory)
def path_relative_directory(self): "Path relative to site.directory" return path_strip(self.path, self.site.directory)
def folder(self): "Parent folder(s)" # FIXME: needed/rename? return os.path.dirname(path_strip(os.path.join(self.head, ''), self.site.directory))
def directory(self): "Folder(s) relative from site.directory" # FIXME: needed/rename? return path_strip(self.path, self.site.directory)
def folder(self): "Parent folder(s)" warnings.warn("directory will be removed with 3.6, use dirname instead.", DeprecationWarning) return os.path.dirname(path_strip(os.path.join(self.head, ""), self.site.directory))
def directory(self): "Folder(s) relative from site.directory" warnings.warn("directory will be removed with 3.6, use path_relative_directory instead.", DeprecationWarning) return path_strip(self.path, self.site.directory)