def create_file(self, append=None): """ Creates a zero length file stub on disk Parameters: append Extra string to append to file name. """ name = '%s-%s' % (self.encounter.uuid, self.node) if append: name += '-%s' % append ext = guess_fext(self.concept.mimetype) fname = '%s%s' % (name, ext) self.value_complex = self.value_complex.field.generate_filename(self, fname) path, _ = os.path.split(self.value_complex.path) # make sure we have the directory structure if not os.path.exists(path): os.makedirs(path) # create the stub and commit if no exceptions open(self.value_complex.path, "w").close() self.save()
def _generate_filename(self): name = '%s-%s' % (self.encounter.uuid, self.node) ext = guess_fext(self.concept.mimetype) fname = '%s.%s' % (name, ext)