本文整理汇总了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
示例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):