def _build_storage_path(self): self.assign_id() path_segments = ['event', strict_unicode(self._contribution.event.id), 'papers', '{}_{}'.format(self.id, strict_unicode(self._contribution.id))] filename = secure_filename(self.filename, 'paper') path = posixpath.join(*(path_segments + [filename])) return config.ATTACHMENT_STORAGE, path
def _build_storage_path(self): folder = self.attachment.folder assert folder.object is not None if folder.link_type == LinkType.category: # category/<id>/... path_segments = ['category', strict_unicode(folder.category.id)] else: # event/<id>/event/... path_segments = [ 'event', strict_unicode(folder.event.id), folder.link_type.name ] if folder.link_type == LinkType.session: # event/<id>/session/<session_id>/... path_segments.append(strict_unicode(folder.session.id)) elif folder.link_type == LinkType.contribution: # event/<id>/contribution/<contribution_id>/... path_segments.append(strict_unicode(folder.contribution.id)) elif folder.link_type == LinkType.subcontribution: # event/<id>/subcontribution/<subcontribution_id>/... path_segments.append(strict_unicode(folder.subcontribution.id)) self.attachment.assign_id() self.assign_id() filename = '{}-{}-{}'.format(self.attachment.id, self.id, self.filename) path = posixpath.join(*(path_segments + [filename])) return config.ATTACHMENT_STORAGE, path
def _build_storage_path(self): self.abstract.assign_id() path_segments = ['event', strict_unicode(self.abstract.event.id), 'abstracts', strict_unicode(self.abstract.id)] self.assign_id() filename = '{}-{}'.format(self.id, self.filename) path = posixpath.join(*(path_segments + [filename])) return config.ATTACHMENT_STORAGE, path
def _build_storage_path(self): self.abstract.assign_id() path_segments = ['event', strict_unicode(self.abstract.event_new.id), 'abstracts', strict_unicode(self.abstract.id)] self.assign_id() filename = '{}-{}'.format(self.id, self.filename) path = posixpath.join(*(path_segments + [filename])) return Config.getInstance().getAttachmentStorage(), path
def _build_storage_path(self): self.abstract.assign_id() path_segments = ['event', strict_unicode(self.abstract.event.id), 'abstracts', strict_unicode(self.abstract.id)] self.assign_id() filename = '{}-{}'.format(self.id, secure_filename(self.filename, 'file')) path = posixpath.join(*(path_segments + [filename])) return config.ATTACHMENT_STORAGE, path
def _build_storage_path(self): self.assign_id() path_segments = [ 'event', strict_unicode(self.contribution.event_new.id), 'papers', "{}_{}".format(self.id, strict_unicode(self.contribution.id)) ] path = posixpath.join(*(path_segments + [self.filename])) return Config.getInstance().getAttachmentStorage(), path
def _build_storage_path(self): self.registration.registration_form.assign_id() self.registration.assign_id() path_segments = ['event', strict_unicode(self.registration.event_id), 'registrations', strict_unicode(self.registration.registration_form.id), strict_unicode(self.registration.id)] assert None not in path_segments # add timestamp in case someone uploads the same file again filename = '{}-{}-{}'.format(self.field_data.field_id, int(time.time()), secure_filename(self.filename, 'file')) path = posixpath.join(*(path_segments + [filename])) return config.ATTACHMENT_STORAGE, path
def _build_storage_path(self): self.registration.registration_form.assign_id() self.registration.assign_id() path_segments = ['event', strict_unicode(self.registration.event_id), 'registrations', strict_unicode(self.registration.registration_form.id), strict_unicode(self.registration.id)] assert None not in path_segments # add timestamp in case someone uploads the same file again filename = '{}-{}-{}'.format(self.field_data.field_id, int(time.time()), self.filename) path = posixpath.join(*(path_segments + [filename])) return Config.getInstance().getAttachmentStorage(), path
def _get_file_storage_path(self, id_, filename): # we use a generic path to store all imported files since we # are on the table level here and thus cannot use relationships # and the orignal models' logic to construct paths path_segments = ['event', strict_unicode(self.event_id), 'imported'] filename = '{}-{}'.format(id_, filename) path = posixpath.join(*(path_segments + [filename])) return path
def _build_storage_path(self): self.assign_id() path_segments = [ 'event', strict_unicode(self.event.id), 'paper_templates' ] path = posixpath.join(*(path_segments + ['{}_{}'.format(self.id, self.filename)])) return config.ATTACHMENT_STORAGE, path
def _build_storage_path(self): path_segments = [ 'designer_templates', strict_unicode(self.template.id), 'images' ] self.assign_id() filename = '{}-{}'.format(self.id, self.filename) path = posixpath.join(*(path_segments + [filename])) return config.ATTACHMENT_STORAGE, path
def _build_storage_path(self): path_segments = [ 'designer_templates', strict_unicode(self.template.id), 'images' ] self.assign_id() filename = '{}-{}'.format(self.id, self.filename) path = posixpath.join(*(path_segments + [filename])) return Config.getInstance().getAttachmentStorage(), path
def _build_storage_path(self): folder = self.attachment.folder assert folder.object is not None if folder.link_type == LinkType.category: # category/<id>/... path_segments = ['category', strict_unicode(folder.category.id)] else: # event/<id>/event/... path_segments = ['event', strict_unicode(folder.event_new.id), folder.link_type.name] if folder.link_type == LinkType.session: # event/<id>/session/<session_id>/... path_segments.append(strict_unicode(folder.session.id)) elif folder.link_type == LinkType.contribution: # event/<id>/contribution/<contribution_id>/... path_segments.append(strict_unicode(folder.contribution.id)) elif folder.link_type == LinkType.subcontribution: # event/<id>/subcontribution/<subcontribution_id>/... path_segments.append(strict_unicode(folder.subcontribution.id)) self.attachment.assign_id() self.assign_id() filename = '{}-{}-{}'.format(self.attachment.id, self.id, self.filename) path = posixpath.join(*(path_segments + [filename])) return Config.getInstance().getAttachmentStorage(), path
def _build_storage_path(self): path_segments = ['event', strict_unicode(self.event_new.id), 'static'] self.assign_id() filename = '{}-{}'.format(self.id, self.filename) path = posixpath.join(*(path_segments + [filename])) return Config.getInstance().getStaticSiteStorage(), path
def _build_storage_path(self): self.assign_id() path_segments = ['event', strict_unicode(self.event.id), 'paper_templates'] path = posixpath.join(*(path_segments + ['{}_{}'.format(self.id, self.filename)])) return config.ATTACHMENT_STORAGE, path
def _build_storage_path(self): path_segments = ['event', strict_unicode(self.event.id), 'static'] self.assign_id() filename = '{}-{}'.format(self.id, self.filename) path = posixpath.join(*(path_segments + [filename])) return config.STATIC_SITE_STORAGE, path
def _build_storage_path(self): path_segments = ['designer_templates', strict_unicode(self.template.id), 'images'] self.assign_id() filename = '{}-{}'.format(self.id, self.filename) path = posixpath.join(*(path_segments + [filename])) return config.ATTACHMENT_STORAGE, path
def _build_storage_path(self): self.assign_id() path_segments = ['event', strict_unicode(self.contribution.event_new.id), 'papers', "{}_{}".format(self.id, strict_unicode(self.contribution.id))] path = posixpath.join(*(path_segments + [self.filename])) return Config.getInstance().getAttachmentStorage(), path
def _build_storage_path(self): self.assign_id() path_segments = ['event', strict_unicode(self._contribution.event.id), 'papers', '{}_{}'.format(self.id, strict_unicode(self._contribution.id))] path = posixpath.join(*(path_segments + [self.filename])) return config.ATTACHMENT_STORAGE, path
def _build_storage_path(self): self.assign_id() path_segments = ['event', strict_unicode(self.event_new.id), 'paper_templates'] path = posixpath.join(*(path_segments + ['{}_{}'.format(self.id, self.filename)])) return Config.getInstance().getAttachmentStorage(), path