Esempio n. 1
0
 def import_dialog(self, errors=None, defaults=None, format=u'html'):
     data = {'welcome_enabled': can_welcome()}
     if defaults is None:
         defaults = dict(request.POST)
     tpl = render('admin/import_dialog.html',
                  data,
                  overlay=format == u'overlay')
     return formencode.htmlfill.render(tpl,
                                       defaults=defaults,
                                       errors=errors,
                                       force_defaults=False)
Esempio n. 2
0
 def import_do(self):
     options = ImportForm().to_python(dict(request.params))
     if not can_welcome() and options['welcome']:
         return ret_abort(_("Requested generation of welcome codes, but "
                            "welcome functionality"
                            "(adhocracy.enable_welcome) is not enabled."),
                          code=403)
     obj = request.POST['importfile']
     options['user_personal'] = True
     adhocracy.lib.importexport.import_(options, obj.file)
     return render('admin/import_success.html', {})
Esempio n. 3
0
File: admin.py Progetto: alkadis/vcv
 def import_dialog(self, errors=None, defaults=None, format=u'html'):
     data = {
         'welcome_enabled': can_welcome()
     }
     if defaults is None:
         defaults = dict(request.POST)
     tpl = render('admin/import_dialog.html', data,
                  overlay=format == u'overlay')
     return formencode.htmlfill.render(
         tpl,
         defaults=defaults,
         errors=errors,
         force_defaults=False)
Esempio n. 4
0
    def import_do(self):
        try:
            options = ImportForm().to_python(dict(request.params))
        except formencode.Invalid as i:
            return self.import_dialog(errors=i.unpack_errors())

        if not can_welcome() and options['welcome']:
            return ret_abort(_("Requested generation of welcome codes, but "
                               "welcome functionality"
                               "(adhocracy.enable_welcome) is not enabled."),
                             code=403)
        obj = request.POST['importfile']
        options['user_personal'] = True
        adhocracy.lib.importexport.import_(options, obj.file)
        return render('admin/import_success.html', {})
Esempio n. 5
0
    def import_do(self):
        try:
            options = ImportForm().to_python(dict(request.params))
        except formencode.Invalid as i:
            return self.import_dialog(errors=i.unpack_errors())

        if not can_welcome() and options["welcome"]:
            return ret_abort(
                _(
                    "Requested generation of welcome codes, but "
                    "welcome functionality"
                    "(adhocracy.enable_welcome) is not enabled."
                ),
                code=403,
            )
        obj = request.POST["importfile"]
        options["user_personal"] = True
        adhocracy.lib.importexport.import_(options, obj.file)
        return render("admin/import_success.html", {})
Esempio n. 6
0
 def import_dialog(self):
     data = {
         'welcome_enabled': can_welcome()
     }
     return render('admin/import_dialog.html', data)