Exemplo n.º 1
0
        def _helper(name, filetype):
            perviewfull = ''
            perview = ''
            urlfolder = ''
            if filetype == 'Directory':
                filetype = ''
                urlfolder = '/' + name + '/'
            else:
                nm, ext = os.path.splitext(name)
                filetype = ext.replace('.', '')
                perviewfull = settings.BASE_URL + os.path.join(self.url, name)
                perview = settings.BASE_URL + os.path.join(self.url, name)

            return {
                'urlfolder':
                urlfolder,
                'isdir':
                os.path.isdir(os.path.join(self.location, name)),
                'filetype':
                filetype,
                'filename':
                name,
                'lastmodified':
                int(os.path.getmtime(os.path.join(self.location, name))),
                'perviewfull':
                perviewfull,
                'perview':
                perview,
                'size':
                STORAGE.size(os.path.join(self.path, name)),
            }
Exemplo n.º 2
0
 def _helper(name, filetype):
     return {
         'filepath': os.path.join(self.path, name),
         'filetype': filetype,
         'filename': name,
         'filedate': STORAGE.modified_time(os.path.join(self.path, name)),
         'filesize': sizeof_fmt(STORAGE.size(os.path.join(self.path, name))),
     }
Exemplo n.º 3
0
 def _helper(name, filetype):
     return {
         'filepath': os.path.join(self.path, name),
         'filetype': filetype,
         'filename': name,
         'filedate': STORAGE.get_modified_time(os.path.join(self.path, name)),
         'filesize': sizeof_fmt(STORAGE.size(os.path.join(self.path, name))),
         'fileurl' : os.path.join(settings.MEDIA_URL, self.abspath, name),
     }
Exemplo n.º 4
0
 def file_details(self):
     filename = self.path.rsplit('/', 1)[-1]
     return {
         'directory': os.path.dirname(self.path),
         'filepath': self.path,
         'filename': filename,
         'filesize': sizeof_fmt(STORAGE.size(self.location)),
         'filedate': STORAGE.modified_time(self.location),
         'fileurl': self.url,
     }