def __init__(self,**kwargs): super(Asset,self).__init__(**kwargs) self.upload_directory = structure.UPLOADS_DIR + str(self.path) self.download_directory = structure.DOWNLOADS_DIR + str(self.path) if self.generated: makedirs(self.upload_directory) #TODO make conditional makedirs(self.download_directory)
def ensure(self): if not isfile(self.file_path) or (self.source.exists and getmtime(self.source.file_path) > getmtime(self.file_path)): makedirs(dirname(self.file_path)) self._do_generate()