Пример #1
0
def create_paper_template(event, data):
    file = data.pop('template')
    template = PaperTemplate(event=event)
    template.populate_from_dict(data)
    _store_paper_template_file(template, file)
    db.session.flush()
    logger.info('Paper template %r uploaded by %r', template, session.user)
    return template
Пример #2
0
def create_paper_template(event, data):
    file = data.pop('template')
    template = PaperTemplate(event=event)
    template.populate_from_dict(data)
    _store_paper_template_file(template, file)
    db.session.flush()
    logger.info('Paper template %r uploaded by %r', template, session.user)
    return template
Пример #3
0
    def _migrate_templates(self):
        for __, old_tpl in self.pr._templates.viewitems():
            old_filename = convert_to_unicode(old_tpl._Template__file.name)
            storage_backend, storage_path, size, md5 = self._get_local_file_info(
                old_tpl._Template__file)
            if storage_path is None:
                self.print_error(
                    '%[red!]File not found on disk; skipping it [{}]'.format(
                        old_filename))
                continue

            filename = secure_filename(old_filename, 'attachment')
            content_type = mimetypes.guess_type(
                old_filename)[0] or 'application/octet-stream'
            tpl = PaperTemplate(
                filename=filename,
                content_type=content_type,
                size=size,
                md5=md5,
                storage_backend=storage_backend,
                storage_file_id=storage_path,
                name=convert_to_unicode(old_tpl._Template__name)
                or old_filename,
                description=convert_to_unicode(old_tpl._Template__description))
            self.event.paper_templates.append(tpl)
Пример #4
0
 def _process_args(self):
     RHPapersBase._process_args(self)
     self.template = PaperTemplate.get_one(request.view_args['template_id'])
Пример #5
0
 def _process_args(self):
     RHManagePapersBase._process_args(self)
     self.template = PaperTemplate.get_or_404(
         request.view_args['template_id'])
Пример #6
0
 def _checkParams(self, params):
     RHPapersBase._checkParams(self, params)
     self.template = PaperTemplate.get_one(request.view_args['template_id'])
Пример #7
0
 def _process_args(self):
     RHPapersBase._process_args(self)
     self.template = PaperTemplate.get_one(request.view_args['template_id'])