當前位置: 首頁>>代碼示例>>Python>>正文


Python InputFilter.filter_email_address方法代碼示例

本文整理匯總了Python中dNG.data.text.input_filter.InputFilter.filter_email_address方法的典型用法代碼示例。如果您正苦於以下問題:Python InputFilter.filter_email_address方法的具體用法?Python InputFilter.filter_email_address怎麽用?Python InputFilter.filter_email_address使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dNG.data.text.input_filter.InputFilter的用法示例。


在下文中一共展示了InputFilter.filter_email_address方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: validate_settings

# 需要導入模塊: from dNG.data.text.input_filter import InputFilter [as 別名]
# 或者: from dNG.data.text.input_filter.InputFilter import filter_email_address [as 別名]
	def validate_settings(self, data):
	#
		"""
Called to validate the given settings.

:param data: Setting dict to be verified

:since: v0.1.00
		"""

		_return = False

		if (isinstance(data, dict)
		    and DatabaseTasks.is_available()
		    and "recipient" in data
		    and "email_content_field_names" in data
		    and ("email_subject_field_name" in data or "email_subject_title" in data)
		   ):
		#
			_return = True

			recipient = InputFilter.filter_email_address(data['recipient'])
			if (recipient == ""): _return = False

			if (type(data['email_content_field_names']) is not list): _return = False
			if ("email_subject_title" in data and len(data['email_subject_title']) < 1): _return = False
		#

		return _return
	#
#

##j## EOF
開發者ID:dNG-git,項目名稱:pas_http_file_form,代碼行數:35,代碼來源:file_form_mailer.py

示例2: _execute_register

# 需要導入模塊: from dNG.data.text.input_filter import InputFilter [as 別名]
# 或者: from dNG.data.text.input_filter.InputFilter import filter_email_address [as 別名]

#.........這裏部分代碼省略.........

        if (ex_type is None):
            field = PasswordField("upassword")
            field.set_title(L10n.get("pas_http_user_password"))
            field.set_required()
            field.set_limits(int(Settings.get("pas_http_user_password_min", 6)))
            field.set_mode(PasswordField.PASSWORD_CLEARTEXT | PasswordField.PASSWORD_WITH_REPETITION)
            form.add(field)
        #

        tos_filepath = Settings.get_lang_associated("pas_http_user_tos_filepath",
                                                    self.request.get_lang(),
                                                    "{0}/settings/pas_user_tos.ftg".format(Settings.get("path_data"))
                                                   )

        field = FormTagsFileField("utos")
        field.set_title(L10n.get("pas_http_user_tos"))
        field.set_required()
        field.set_formtags_filepath(tos_filepath)
        form.add(field)

        tos_choices = [ { "title": L10n.get("core_yes"), "value": "accepted" },
                        { "title": L10n.get("core_no"), "value": "denied" }
                      ]

        field = RadioField("utos_accepted")
        field.set_title(L10n.get("pas_http_user_tos_accepted"))
        field.set_choices(tos_choices)
        field.set_required()
        field.set_validators([ self._check_tos_accepted ])
        form.add(field)

        if (is_save_mode and form.check()):
            if (not is_email_verified): email = InputFilter.filter_email_address(form.get_value("uemail"))
            if (username is None): username = InputFilter.filter_control_chars(form.get_value("uusername"))

            user_profile_class = NamedLoader.get_class("dNG.data.user.Profile")
            if (user_profile_class is None): raise TranslatableException("core_unknown_error")

            user_profile = user_profile_class()

            user_profile_data = { "name": username,
                                  "lang": self.request.get_lang(),
                                  "email": email
                                }

            if (ex_type is None):
                password = InputFilter.filter_control_chars(form.get_value("upassword"))
                user_profile.set_password(password)
            else:
                user_profile_data['type'] = user_profile_class.TYPE_EXTERNAL_VERIFIED_MEMBER
                user_profile_data['type_ex'] = ex_type
            #

            with TransactionContext():
                user_profile.set_data_attributes(**user_profile_data)

                if (not is_email_verified): user_profile.lock()
                else: user_profile.unlock()

                user_profile.save()
            #

            user_id = user_profile.get_id()

            if (not is_email_verified):
開發者ID:dNG-git,項目名稱:pas_http_user,代碼行數:70,代碼來源:registration_mixin.py


注:本文中的dNG.data.text.input_filter.InputFilter.filter_email_address方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。