示例#1
0
    def _process_POST(self):
        name = request.form.get('contact_name', settings.get('contact_name'))
        email = request.form.get('contact_email',
                                 settings.get('contact_email'))
        enabled = request.form.get('joined', False)
        uuid = settings.get('uuid')
        try:
            if not enabled:
                unregister_instance()
            elif enabled and uuid:
                sync_instance(name, email)
            elif enabled and not uuid:
                register_instance(name, email)
        except HTTPError as err:
            flash(
                _("Operation failed, the community hub returned: {err.message}"
                  ).format(err=err), 'error')
        except Timeout:
            flash(_("The operation timed-out. Please try again in a while."),
                  'error')
        except RequestException as err:
            flash(
                _("Unexpected exception while contacting the Community Hub: {err.message}"
                  ).format(err=err))

        return redirect(url_for('.index'))
示例#2
0
    def _process_form(self, form):
        name = form.contact_name.data
        email = form.contact_email.data
        enabled = form.joined.data
        uuid = cephalopod_settings.get('uuid')
        try:
            if not enabled:
                unregister_instance()
            elif enabled and uuid:
                sync_instance(name, email)
            elif enabled and not uuid:
                register_instance(name, email)
        except HTTPError as err:
            flash(
                _("Operation failed, the community hub returned: {err.message}"
                  ).format(err=err), 'error')
        except Timeout:
            flash(_("The operation timed-out. Please try again in a while."),
                  'error')
        except RequestException as err:
            flash(
                _("Unexpected exception while contacting the Community Hub: {err.message}"
                  ).format(err=err))

        return redirect(url_for('.index'))
示例#3
0
    def _process_POST(self):
        name = request.form.get('contact_name', settings.get('contact_name'))
        email = request.form.get('contact_email', settings.get('contact_email'))
        enabled = request.form.get('joined', False)
        uuid = settings.get('uuid')
        try:
            if not enabled:
                unregister_instance()
            elif enabled and uuid:
                sync_instance(name, email)
            elif enabled and not uuid:
                register_instance(name, email)
        except HTTPError as err:
            flash(_("Operation failed, the community hub returned: {err.message}").format(err=err), 'error')
        except Timeout:
            flash(_("The operation timed-out. Please try again in a while."), 'error')
        except RequestException as err:
            flash(_("Unexpected exception while contacting the Community Hub: {err.message}").format(err=err))

        return redirect(url_for('.index'))
示例#4
0
    def _process_form(self, form):
        name = form.contact_name.data
        email = form.contact_email.data
        enabled = form.joined.data
        uuid = cephalopod_settings.get('uuid')
        try:
            if not enabled:
                unregister_instance()
            elif enabled and uuid:
                sync_instance(name, email)
            elif enabled and not uuid:
                register_instance(name, email)
        except HTTPError as err:
            flash(_("Operation failed, the community hub returned: {err.message}").format(err=err), 'error')
        except Timeout:
            flash(_("The operation timed-out. Please try again in a while."), 'error')
        except RequestException as err:
            flash(_("Unexpected exception while contacting the Community Hub: {err.message}").format(err=err))

        return redirect(url_for('.index'))