def job_data(instance, filename=''):
"""
Return the path of `filename` stored in a subfolder of the root folder of his job `instance`.
Parameters
----------
instance : AJob or ADataFile
The model instance associated
filename : str
Original filename
Returns
--------
str
Path to filename which is unique for a job
"""
head = root_job(instance.job) if isinstance(instance, ADataFile) else root_job(instance)
tail = _user_path(instance.upload_to_data, filename) or os.path.join('data', filename)
return os.path.join(head, tail)
评论列表
文章目录