Пример #1
0
 def __init__(self, path):
     self.path = path_strip(path, DIRECTORY)
     self.url_rel = self.path.replace("\\","/")
     self.head = os.path.split(path)[0]
     self.filename = os.path.split(path)[1]
     self.filename_lower = self.filename.lower() # important for sorting
     self.filetype = get_file_type(self.filename)
Пример #2
0
    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)])
Пример #3
0
    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)])
Пример #4
0
 def _path_relative_directory(self):
     "path relative to DIRECTORY"
     return path_strip(self.path, self.site.directory)
Пример #5
0
 def _folder(self):
     return os.path.dirname(
         path_strip(os.path.join(self.head, ''), self.site.directory))
Пример #6
0
 def _directory(self):
     return path_strip(self.path, self.site.directory)
Пример #7
0
 def _path_relative_directory(self):
     "path relative to DIRECTORY"
     return path_strip(self.path, self.site.directory)
Пример #8
0
 def _folder(self):
     return path_strip(self.head, os.path.join(MEDIA_ROOT, DIRECTORY))
Пример #9
0
 def _directory(self):
     return path_strip(self.path, os.path.join(MEDIA_ROOT, self.media_directory))
Пример #10
0
 def _path_relative_directory(self):
     "path relative to MEDIA_ROOT + DIRECTORY"
     return path_strip(self.path, os.path.join(MEDIA_ROOT,self.media_directory))
Пример #11
0
 def _path_relative(self):
     "path relative to MEDIA_ROOT"
     return path_strip(self.path, MEDIA_ROOT)
Пример #12
0
 def _folder(self):
     return path_strip(self.head, self.media_root)
Пример #13
0
 def _directory(self):
     return path_strip(self.path, self.media_root)
Пример #14
0
 def _path_relative(self):
     "path relative to MEDIA_ROOT"
     return path_strip(self.path, self.media_root)
Пример #15
0
 def _directory(self):
     return path_strip(self.path, self.site.directory)
Пример #16
0
 def _folder(self):
     return path_strip(self.head, os.path.join(MEDIA_ROOT, self.media_directory))
Пример #17
0
 def _folder(self):
     return os.path.dirname(path_strip(os.path.join(self.head,''), self.site.directory))
Пример #18
0
 def _directory(self):
     return path_strip(self.path, os.path.join(MEDIA_ROOT, DIRECTORY))