Validates adding a submitted product to the wishlist
175744
protected function validateAddToWishlist()
    {
        $this->setSubmitted('user_id', $this->getCartUid());
        $this->setSubmitted('store_id', $this->getStoreId());
        $this->validateComponent('wishlist');
    }
658958
def validate_confirm_form(self):
        
        wpp = PayPalWPP(self.request)
        pp_data = dict(token=self.request.POST['token'], payerid=self.request.POST['PayerID'])
        self.item.update(pp_data)

        # @@@ This check and call could be moved into PayPalWPP.
        try:
            if self.is_recurring():
                warn_untested()
                nvp = wpp.createRecurringPaymentsProfile(self.item)
            else:
                nvp = wpp.doExpressCheckoutPayment(self.item)
            self.handle_nvp(nvp)
        except PayPalFailure:
            self.context['errors'] = self.errors['processing']
            return self.render_payment_form()
        else:
            return HttpResponseRedirect(self.success_url)
664641
function validate_options( $input ) {

		/*
		 * Restore Defaults.
		 *
		 * In the event that the user clicked the "Restore Defaults"
		 * button, the options defined in the theme's options.php
		 * file will be added to the option for the active theme.
		 */

		if ( isset( $_POST['reset'] ) ) {
			add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'options-framework' ), 'updated fade' );
			return $this->get_default_values();
		}

		/*
		 * Update Settings
		 *
		 * This used to check for $_POST['update'], but has been updated
		 * to be compatible with the theme customizer introduced in WordPress 3.4
		 */

		$clean = array();
		$options = & Options_Framework::_optionsframework_options();
		foreach ( $options as $option ) {

			if ( ! isset( $option['id'] ) ) {
				continue;
			}

			if ( ! isset( $option['type'] ) ) {
				continue;
			}

			$id = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower( $option['id'] ) );

			// Set checkbox to false if it wasn't sent in the $_POST
			if ( 'checkbox' == $option['type'] && ! isset( $input[$id] ) ) {
				$input[$id] = false;
			}

			// Set each item in the multicheck to false if it wasn't sent in the $_POST
			if ( 'multicheck' == $option['type'] && ! isset( $input[$id] ) ) {
				foreach ( $option['options'] as $key => $value ) {
					$input[$id][$key] = false;
				}
			}

			// For a value to be submitted to database it must pass through a sanitization filter
			if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
				$clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option );
			}
		}

		// Hook to run after validation
		do_action( 'optionsframework_after_validate', $clean );

		return $clean;
	}
188466
def validate():
    
    msg = Printer()
    with msg.loading("Loading compatibility table..."):
        r = requests.get(about.__compatibility__)
        if r.status_code != 200:
            msg.fail(
                "Server error ({})".format(r.status_code),
                "Couldn't fetch compatibility table.",
                exits=1,
            )
    msg.good("Loaded compatibility table")
    compat = r.json()["spacy"]
    version = about.__version__
    version = version.rsplit(".dev", 1)[0]
    current_compat = compat.get(version)
    if not current_compat:
        msg.fail(
            "Can't find spaCy v{} in compatibility table".format(version),
            about.__compatibility__,
            exits=1,
        )
    all_models = set()
    for spacy_v, models in dict(compat).items():
        all_models.update(models.keys())
        for model, model_vs in models.items():
            compat[spacy_v][model] = [reformat_version(v) for v in model_vs]
    model_links = get_model_links(current_compat)
    model_pkgs = get_model_pkgs(current_compat, all_models)
    incompat_links = {l for l, d in model_links.items() if not d["compat"]}
    incompat_models = {d["name"] for _, d in model_pkgs.items() if not d["compat"]}
    incompat_models.update(
        [d["name"] for _, d in model_links.items() if not d["compat"]]
    )
    na_models = [m for m in incompat_models if m not in current_compat]
    update_models = [m for m in incompat_models if m in current_compat]
    spacy_dir = Path(__file__).parent.parent

    msg.divider("Installed models (spaCy v{})".format(about.__version__))
    msg.info("spaCy installation: {}".format(path2str(spacy_dir)))

    if model_links or model_pkgs:
        header = ("TYPE", "NAME", "MODEL", "VERSION", "")
        rows = []
        for name, data in model_pkgs.items():
            rows.append(get_model_row(current_compat, name, data, msg))
        for name, data in model_links.items():
            rows.append(get_model_row(current_compat, name, data, msg, "link"))
        msg.table(rows, header=header)
    else:
        msg.text("No models found in your current environment.", exits=0)
    if update_models:
        msg.divider("Install updates")
        msg.text("Use the following commands to update the model packages:")
        cmd = "python -m spacy download {}"
        print("\n".join([cmd.format(pkg) for pkg in update_models]) + "\n")
    if na_models:
        msg.text(
            "The following models are not available for spaCy "
            "v{}: {}".format(about.__version__, ", ".join(na_models))
        )
    if incompat_links:
        msg.text(
            "You may also want to overwrite the incompatible links using the "
            "`python -m spacy link` command with `--force`, or remove them "
            "from the data directory. "
            "Data path: {path}".format(path=path2str(get_data_path()))
        )
    if incompat_models or incompat_links:
        sys.exit(1)
943562
function(block, shouldValidate) {
    if (!config.skipValidation && shouldValidate && !block.valid()) {
      this.mediator.trigger('errors:add', { text: _.result(block, 'validationFailMsg') });
      utils.log("Block " + block.blockID + " failed validation");
      return;
    }

    if (block.type === 'text' && block.isEmpty()) {
      return;
    }

    var blockData = block.getData();
    utils.log("Adding data for block " + block.blockID + " to block store:",
              blockData);
    this.store.addData(blockData);
  }
1314536
protected function submitAddProductClassField()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('product_class_field');
        $this->addProductClassField();
    }
1203101
public function addRepeatableItem()
    {
        if (! Guard::verifyAjaxNonce('cuztom', 'security')) {
            return;
        }

        $field = self::getField();
        $count = self::$request->get('count');

        $response = ((! $field->limit) || ($field->limit > $count))
            ? new Response(true, $field->outputInput())
            : new Response(false, __('Limit reached!', 'cuztom'));

        echo $response->toJson();

        // wp
        die();
    }
393409
def check(self, item_id):
        
        response = self._request("/submission/sample/{sample_id}".format(sample_id=item_id), headers=self.headers)

        if response.status_code == 404:
            # unknown id
            return False

        try:
            finished = False
            for submission in response.json()['data']:
                finished = finished or submission['submission_finished']
            if finished:
                return True

        except (ValueError, KeyError) as e:
            raise sandboxapi.SandboxError(e)

        return False
396995
def admin_add
      return if !user_is_allowed('products', 'add')
      
      resp = Caboose::StdClass.new(
        :error => nil,
        :redirect => nil
      )
      
      title = params[:title]
      
      if title.length == 0
        resp.error = "The title cannot be empty."
      else
        p = Product.new(:title => title)
        p.save
        resp.redirect = "/admin/products/#{p.id}/general"
      end
      render :json => resp    
    end
486984
def update(self, item, dry_run=None):
        """"""
        return self.backend.update(validate(item, version=self.version, context=self.context), dry_run=dry_run)
1354232
protected function submitAddStore()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->setSubmittedJson('data');

        $this->validateComponent('store');
        $this->addStore();
    }
363104
protected function validateEditProductClassField()
    {
        $this->setSubmitted('product_class');
        $this->setSubmitted('product_class_id', $this->data_product_class['product_class_id']);

        $this->validateComponent('product_class_field');

        return !$this->hasErrors(false);
    }
751658
function fakeItemMatch() {
      var matches = [];

      for (var i = 0; i < dropdownItems; i++) {
        matches.push('Item ' + i);
      }

      return matches;
    }
1207479
def __check_valid(self, post_data):
        '''
        
        '''
        user_create_status = {'success': False, 'code': '00'}

        if not tools.check_username_valid(post_data['user_name']):
            user_create_status['code'] = '11'
            return user_create_status
        elif not tools.check_email_valid(post_data['user_email']):
            user_create_status['code'] = '21'
            return user_create_status
        elif MUser.get_by_name(post_data['user_name']):
            user_create_status['code'] = '12'
            return user_create_status
        elif MUser.get_by_email(post_data['user_email']):
            user_create_status['code'] = '22'
            return user_create_status

        user_create_status['success'] = True
        return user_create_status
95756
protected function submitAddCart()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->setSubmittedJson('data');
        $this->validateComponent('cart');
        $this->addAddCart();
    }
176489
protected function validateEditDashboard()
    {
        $submitted = $this->setSubmitted('dashboard');

        foreach ($submitted as &$item) {
            $item['status'] = !empty($item['status']);
            $item['weight'] = intval($item['weight']);
        }

        $this->setSubmitted(null, $submitted);
    }
87971
protected function submitEditProductClass()
    {
        if ($this->isPosted('delete') && $this->canDeleteProductClass()) {
            $this->deleteProductClass();
        } else if ($this->isPosted('save') && $this->validateEditProductClass()) {
            if (isset($this->data_product_class['product_class_id'])) {
                $this->updateProductClass();
            } else {
                $this->addProductClass();
            }
        }
    }