当前位置: 首页>>代码示例>>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;未经允许,请勿转载。