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'))
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'))
def _process(self): if not settings.get('joined'): flash(_("Synchronization is not possible if you don't join the community first."), 'error') else: contact_name = settings.get('contact_name') contact_email = settings.get('contact_email') try: sync_instance(contact_name, contact_email) except HTTPError as err: flash(_("Synchronization failed, the community hub returned: {err.message}").format(err=err), 'error') except Timeout: flash(_("Synchronization 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'))
def _process(self): if not cephalopod_settings.get('joined'): flash(_("Synchronization is not possible if you don't join the community first."), 'error') else: contact_name = cephalopod_settings.get('contact_name') contact_email = cephalopod_settings.get('contact_email') try: sync_instance(contact_name, contact_email) except HTTPError as err: flash(_('Synchronization failed, the community hub returned: {err}').format(err=err), 'error') except Timeout: flash(_('Synchronization timed-out. Please try again in a while.'), 'error') except RequestException as err: flash(_('Unexpected exception while contacting the Community Hub: {err}').format(err=err)) return redirect(url_for('.index'))
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'))
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'))