Add success message
970286
def form_valid(self, form):
        """"""
        response = super().form_valid(form)
        messages.success(self.request, "Successfully created ({})".format(self.object))
        return response
658087
function add_admin_message( $message, $title = '', $type = 'success' ) {
            $this->_admin_notices->add( $message, $title, $type );
        }
171375
def success(self, cmd, desc=''):
        '''  '''
        return self._label_desc(cmd, desc, self.success_color)
469990
def approve(self, request, *args, **kwargs):
        
        self.object = self.get_object()
        success_url = self.get_success_url()
        self.object.approved = True
        self.object.save()
        messages.success(self.request, self.success_message)
        return HttpResponseRedirect(success_url)
992579
public function success($message, array $placeholders = [], $dismissible = true)
    {
        $this->message($message, null, $placeholders, 'success', $dismissible);

        return $this;
    }
1157557
def add_message(self, request, level, message_template,
                    message_context=None, extra_tags=''):
        
        if 'django.contrib.messages' in settings.INSTALLED_APPS:
            try:
                if message_context is None:
                    message_context = {}
                message = render_to_string(message_template,
                                           message_context).strip()
                if message:
                    messages.add_message(request, level, message,
                                         extra_tags=extra_tags)
            except TemplateDoesNotExist:
                pass
1234567
function _add_connectivity_issue_message( $api_result, $is_first_failure = true ) {
            if ( ! $this->is_premium() && $this->_enable_anonymous ) {
                // Don't add message if it's the free version and can run anonymously.
                return;
            }

            if ( ! function_exists( 'wp_nonce_url' ) ) {
                require_once ABSPATH . 'wp-includes/functions.php';
            }

            $current_user = self::_get_current_wp_user();
//			$admin_email = get_option( 'admin_email' );
            $admin_email = $current_user->user_email;

            // Aliases.
            $deactivate_plugin_title = $this->esc_html_inline( 'That\'s exhausting, please deactivate', 'deactivate-plugin-title' );
            $deactivate_plugin_desc  = $this->esc_html_inline( 'We feel your frustration and sincerely apologize for the inconvenience. Hope to see you again in the future.', 'deactivate-plugin-desc' );
            $install_previous_title  = $this->esc_html_inline( 'Let\'s try your previous version', 'install-previous-title' );
            $install_previous_desc   = $this->esc_html_inline( 'Uninstall this version and install the previous one.', 'install-previous-desc' );
            $fix_issue_title         = $this->esc_html_inline( 'Yes - I\'m giving you a chance to fix it', 'fix-issue-title' );
            $fix_issue_desc          = $this->esc_html_inline( 'We will do our best to whitelist your server and resolve this issue ASAP. You will get a follow-up email to %s once we have an update.', 'fix-issue-desc' );
            /* translators: %s: product title (e.g. "Awesome Plugin" requires an access to...) */
            $x_requires_access_to_api    = $this->esc_html_inline( '%s requires an access to our API.', 'x-requires-access-to-api' );
            $sysadmin_title              = $this->esc_html_inline( 'I\'m a system administrator', 'sysadmin-title' );
            $happy_to_resolve_issue_asap = $this->esc_html_inline( 'We are sure it\'s an issue on our side and more than happy to resolve it for you ASAP if you give us a chance.', 'happy-to-resolve-issue-asap' );

            $message = false;
            if ( is_object( $api_result ) &&
                 isset( $api_result->error ) &&
                 isset( $api_result->error->code )
            ) {
                switch ( $api_result->error->code ) {
                    case 'curl_missing':
                        $missing_methods = '';
                        if ( is_array( $api_result->missing_methods ) &&
                             ! empty( $api_result->missing_methods )
                        ) {
                            foreach ( $api_result->missing_methods as $m ) {
                                if ( 'curl_version' === $m ) {
                                    continue;
                                }

                                if ( ! empty( $missing_methods ) ) {
                                    $missing_methods .= ', ';
                                }

                                $missing_methods .= sprintf( '<code>%s</code>', $m );
                            }

                            if ( ! empty( $missing_methods ) ) {
                                $missing_methods = sprintf(
                                    '<br><br><b>%s</b> %s',
                                    $this->esc_html_inline( 'Disabled method(s):', 'curl-disabled-methods' ),
                                    $missing_methods
                                );
                            }
                        }

                        $message = sprintf(
                            $x_requires_access_to_api . ' ' .
                            $this->esc_html_inline( 'We use PHP cURL library for the API calls, which is a very common library and usually installed and activated out of the box. Unfortunately, cURL is not activated (or disabled) on your server.', 'curl-missing-message' ) . ' ' .
                            $missing_methods .
                            ' %s',
                            '<b>' . $this->get_plugin_name() . '</b>',
                            sprintf(
                                '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
                                sprintf(
                                    '<a class="fs-resolve" data-type="curl" href="#"><b>%s</b></a>%s',
                                    $this->get_text_inline( 'I don\'t know what is cURL or how to install it, help me!', 'curl-missing-no-clue-title' ),
                                    ' - ' . sprintf(
                                        $this->get_text_inline( 'We\'ll make sure to contact your hosting company and resolve the issue. You will get a follow-up email to %s once we have an update.', 'curl-missing-no-clue-desc' ),
                                        '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
                                    )
                                ),
                                sprintf(
                                    '<b>%s</b> - %s',
                                    $sysadmin_title,
                                    esc_html( sprintf( $this->get_text_inline( 'Great, please install cURL and enable it in your php.ini file. In addition, search for the \'disable_functions\' directive in your php.ini file and remove any disabled methods starting with \'curl_\'. To make sure it was successfully activated, use \'phpinfo()\'. Once activated, deactivate the %s and reactivate it back again.', 'curl-missing-sysadmin-desc' ), $this->get_module_label( true ) ) )
                                ),
                                sprintf(
                                    '<a href="%s"><b>%s</b></a> - %s',
                                    wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=all&amp;paged=1&amp;s=', 'deactivate-plugin_' . $this->_plugin_basename ),
                                    $deactivate_plugin_title,
                                    $deactivate_plugin_desc
                                )
                            )
                        );
                        break;
                    case 'cloudflare_ddos_protection':
                        $message = sprintf(
                            $x_requires_access_to_api . ' ' .
                            $this->esc_html_inline( 'From unknown reason, CloudFlare, the firewall we use, blocks the connection.', 'cloudflare-blocks-connection-message' ) . ' ' .
                            $happy_to_resolve_issue_asap .
                            ' %s',
                            '<b>' . $this->get_plugin_name() . '</b>',
                            sprintf(
                                '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
                                sprintf(
                                    '<a class="fs-resolve" data-type="cloudflare" href="#"><b>%s</b></a>%s',
                                    $fix_issue_title,
                                    ' - ' . sprintf(
                                        $fix_issue_desc,
                                        '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
                                    )
                                ),
                                sprintf(
                                    '<a href="%s" target="_blank"><b>%s</b></a> - %s',
                                    sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
                                    $install_previous_title,
                                    $install_previous_desc
                                ),
                                sprintf(
                                    '<a href="%s"><b>%s</b></a> - %s',
                                    wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=all&amp;paged=1&amp;s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
                                    $deactivate_plugin_title,
                                    $deactivate_plugin_desc
                                )
                            )
                        );
                        break;
                    case 'squid_cache_block':
                        $message = sprintf(
                            $x_requires_access_to_api . ' ' .
                            $this->esc_html_inline( 'It looks like your server is using Squid ACL (access control lists), which blocks the connection.', 'squid-blocks-connection-message' ) .
                            ' %s',
                            '<b>' . $this->get_plugin_name() . '</b>',
                            sprintf(
                                '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
                                sprintf(
                                    '<a class="fs-resolve" data-type="squid" href="#"><b>%s</b></a> - %s',
                                    $this->esc_html_inline( 'I don\'t know what is Squid or ACL, help me!', 'squid-no-clue-title' ),
                                    sprintf(
                                        $this->esc_html_inline( 'We\'ll make sure to contact your hosting company and resolve the issue. You will get a follow-up email to %s once we have an update.', 'squid-no-clue-desc' ),
                                        '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
                                    )
                                ),
                                sprintf(
                                    '<b>%s</b> - %s',
                                    $sysadmin_title,
                                    sprintf(
                                        $this->esc_html_inline( 'Great, please whitelist the following domains: %s. Once you are done, deactivate the %s and activate it again.', 'squid-sysadmin-desc' ),
                                        // We use a filter since the plugin might require additional API connectivity.
                                        '<b>' . implode( ', ', $this->apply_filters( 'api_domains', array(
                                            'api.freemius.com',
                                            'wp.freemius.com'
                                        ) ) ) . '</b>',
                                        $this->_module_type
                                    )
                                ),
                                sprintf(
                                    '<a href="%s"><b>%s</b></a> - %s',
                                    wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=all&amp;paged=1&amp;s=', 'deactivate-plugin_' . $this->_plugin_basename ),
                                    $deactivate_plugin_title,
                                    $deactivate_plugin_desc
                                )
                            )
                        );
                        break;
//					default:
//						$message = $this->get_text_inline( 'connectivity-test-fails-message' );
//						break;
                }
            }

            $message_id = 'failed_connect_api';
            $type       = 'error';

            $connectivity_test_fails_message = $this->esc_html_inline( 'From unknown reason, the API connectivity test failed.', 'connectivity-test-fails-message' );

            if ( false === $message ) {
                if ( $is_first_failure ) {
                    // First attempt failed.
                    $message = sprintf(
                        $x_requires_access_to_api . ' ' .
                        $connectivity_test_fails_message . ' ' .
                        $this->esc_html_inline( 'It\'s probably a temporary issue on our end. Just to be sure, with your permission, would it be o.k to run another connectivity test?', 'connectivity-test-maybe-temporary' ) . '<br><br>' .
                        '%s',
                        '<b>' . $this->get_plugin_name() . '</b>',
                        sprintf(
                            '<div id="fs_firewall_issue_options">%s %s</div>',
                            sprintf(
                                '<a  class="button button-primary fs-resolve" data-type="retry_ping" href="#">%s</a>',
                                $this->get_text_inline( 'Yes - do your thing', 'yes-do-your-thing' )
                            ),
                            sprintf(
                                '<a href="%s" class="button">%s</a>',
                                wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=all&amp;paged=1&amp;s=', 'deactivate-plugin_' . $this->_plugin_basename ),
                                $this->get_text_inline( 'No - just deactivate', 'no-deactivate' )
                            )
                        )
                    );

                    $message_id = 'failed_connect_api_first';
                    $type       = 'promotion';
                } else {
                    // Second connectivity attempt failed.
                    $message = sprintf(
                        $x_requires_access_to_api . ' ' .
                        $connectivity_test_fails_message . ' ' .
                        $happy_to_resolve_issue_asap .
                        ' %s',
                        '<b>' . $this->get_plugin_name() . '</b>',
                        sprintf(
                            '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
                            sprintf(
                                '<a class="fs-resolve" data-type="general" href="#"><b>%s</b></a>%s',
                                $fix_issue_title,
                                ' - ' . sprintf(
                                    $fix_issue_desc,
                                    '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
                                )
                            ),
                            sprintf(
                                '<a href="%s" target="_blank"><b>%s</b></a> - %s',
                                sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
                                $install_previous_title,
                                $install_previous_desc
                            ),
                            sprintf(
                                '<a href="%s"><b>%s</b></a> - %s',
                                wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=all&amp;paged=1&amp;s=', 'deactivate-plugin_' . $this->_plugin_basename ),
                                $deactivate_plugin_title,
                                $deactivate_plugin_desc
                            )
                        )
                    );
                }
            }

            $this->_admin_notices->add_sticky(
                $message,
                $message_id,
                $this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...',
                $type
            );
        }
657257
public function successPosAction()
    {
        $response = $this->getRequest()->getParams();
        $result = $this->processPosResponse($response);

        if ($result) {
            $session = $this->_getCheckout();
            $session->unsAdyenRealOrderId();
            $session->setQuoteId($session->getAdyenQuoteId(true));
            $session->getQuote()->setIsActive(false)->save();
            $this->_redirect('checkout/onepage/success', array('utm_nooverride' => '1'));
        } else {
            $this->cancel();
        }
    }
1108791
def success(self, msg, *args, **kw):
        """"""
        if self.isEnabledFor(SUCCESS):
            self._log(SUCCESS, msg, args, **kw)
138544
public final void success () {
		Status previousStatus = status;
		status = Status.SUCCEEDED;
		if (tree.listeners != null && tree.listeners.size > 0) tree.notifyStatusUpdated(this, previousStatus);
		end();
		if (control != null) control.childSuccess(this);
	}
464287
def push(self, message, callback_arg=None):
        

        if message['action'] == 'upsert':
            message.setdefault('key_names', self.key_names)

        message['client_id'] = self.client_id
        message.setdefault('table_name', self.table_name)

        self._add_message(message, callback_arg)

        batch = self._take_batch(self.target_messages_per_batch)
        if batch:
            self._send_batch(batch)
149384
def folder_created_message(self, request, folder):
        
        messages.success(request, _("Folder {} was created".format(folder)))
1140535
async def add_message(self, request):
        """"""
        session = await get_session(request)
        user_id = session.get('user_id')
        if not user_id:
            raise web.HTTPNotAuthorized()
        form = await request.post()

        if form.get('text'):
            user = await self.mongo.user.find_one(
                {'_id': ObjectId(session['user_id'])},
                {'email': 1, 'username': 1})

            await self.mongo.message.insert(
                {'author_id': ObjectId(user_id),
                 'email': user['email'],
                 'username': user['username'],
                 'text': form['text'],
                 'pub_date': datetime.datetime.utcnow()})
        return redirect(request, 'timeline')
1050001
def print_success(msg, color=True):
    
    if color and is_posix():
        safe_print(u"%s[INFO] %s%s" % (ANSI_OK, msg, ANSI_END))
    else:
        safe_print(u"[INFO] %s" % (msg))
683367
def print_success(msg):
    
    if IS_POSIX:
        print(u"%s[INFO] %s%s" % (ANSI_OK, msg, ANSI_END))
    else:
        print(u"[INFO] %s" % (msg))
1270070
def add_message(self, text, type=None):
        """"""
        key = self._msg_key
        self.setdefault(key, [])
        self[key].append(message(type, text))
        self.save()
705062
def add_message(self, msg):
        
        row = self.rowCount()
        self.insertRow(row)

        # type
        item = QtWidgets.QTableWidgetItem(
            self._make_icon(msg.status), msg.status_string)
        item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
        item.setData(QtCore.Qt.UserRole, msg)
        self.setItem(row, COL_TYPE, item)

        # filename
        item = QtWidgets.QTableWidgetItem(
            QtCore.QFileInfo(msg.path).fileName())
        item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
        item.setData(QtCore.Qt.UserRole, msg)
        self.setItem(row, COL_FILE_NAME, item)

        # line
        if msg.line < 0:
            item = QtWidgets.QTableWidgetItem("-")
        else:
            item = QtWidgets.QTableWidgetItem(str(msg.line + 1))
        item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
        item.setData(QtCore.Qt.UserRole, msg)
        self.setItem(row, COL_LINE_NBR, item)

        # desc
        item = QtWidgets.QTableWidgetItem(msg.description)
        item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
        item.setData(QtCore.Qt.UserRole, msg)
        self.setItem(row, COL_MSG, item)