本文整理汇总了Python中dNG.data.settings.Settings.get_lang_associated方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.get_lang_associated方法的具体用法?Python Settings.get_lang_associated怎么用?Python Settings.get_lang_associated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dNG.data.settings.Settings
的用法示例。
在下文中一共展示了Settings.get_lang_associated方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute_index
# 需要导入模块: from dNG.data.settings import Settings [as 别名]
# 或者: from dNG.data.settings.Settings import get_lang_associated [as 别名]
def execute_index(self):
"""
Action for "index" (most likely root requested)
:since: v1.0.0
"""
default_page_settings = Settings.get_lang_associated("pas_http_site_page_default", self.request.lang)
if (type(default_page_settings) is not dict
or ("module" not in default_page_settings
and "service" not in default_page_settings
and "action" not in default_page_settings
)
): raise TranslatableError("pas_http_core_site_unconfigured", 201)
redirect_request = PredefinedHttpRequest()
if ("module" in default_page_settings): redirect_request.module_package = default_page_settings['module']
if ("service" in default_page_settings): redirect_request.service_package_and_module = default_page_settings['service']
if ("action" in default_page_settings): redirect_request.action = default_page_settings['action']
if ("parameters" in default_page_settings): redirect_request.parameters = default_page_settings['parameters']
self.request.redirect(redirect_request)
示例2: __init__
# 需要导入模块: from dNG.data.settings import Settings [as 别名]
# 或者: from dNG.data.settings.Settings import get_lang_associated [as 别名]
def __init__(self, l10n = None):
"""
Constructor __init__(RegistrationEMailRenderer)
:param l10n: L10n instance
:since: v0.2.00
"""
VerificationEMailRenderer.__init__(self, l10n)
self.verification_details = Settings.get_lang_associated("pas_http_user_registration_welcome_text",
self.l10n.get_lang(),
self.l10n.get("pas_http_user_registration_pending_email_message")
)
示例3: _execute_register
# 需要导入模块: from dNG.data.settings import Settings [as 别名]
# 或者: from dNG.data.settings.Settings import get_lang_associated [as 别名]
def _execute_register(self, username = None, email = None, ex_type = None, source_iline = "", target_iline = "", is_save_mode = False):
"""
Action for "register"
:param username: User name to be used
:param email: Verified e-mail address to be used
:param ex_type: Externally verified service identifier string
:param source_iline: Source URI query string
:param target_iline: Target URI query string
:param is_save_mode: True if the form is submitted
:since: v0.2.00
"""
# pylint: disable=star-args
source = source_iline
if (source_iline == ""): source_iline = "m=user;a=services"
target = target_iline
if (target_iline == ""):
if (Settings.is_defined("pas_http_user_register_default_target_lang_{0}".format(self.request.get_lang()))): target_iline = Settings.get("pas_http_user_register_default_target_lang_{0}".format(self.request.get_lang()))
elif (Settings.is_defined("pas_http_user_register_default_target")): target_iline = Settings.get("pas_http_user_register_default_target")
else: target_iline = source_iline
#
L10n.init("pas_http_core_form")
L10n.init("pas_http_user")
if (not Settings.get("pas_http_user_registration_allowed", True)): raise TranslatableError("pas_http_user_registration_disabled", 403)
if (self.response.is_supported("html_css_files")): self.response.add_theme_css_file("mini_default_sprite.min.css")
Link.set_store("servicemenu",
Link.TYPE_RELATIVE_URL,
L10n.get("core_back"),
{ "__query__": re.sub("\\_\\_\\w+\\_\\_", "", source_iline) },
icon = "mini-default-back",
priority = 7
)
if (not DatabaseTasks.is_available()): raise TranslatableException("pas_core_tasks_daemon_not_available")
form_id = InputFilter.filter_control_chars(self.request.get_parameter("form_id"))
form = FormProcessor(form_id)
if (is_save_mode): form.set_input_available()
is_email_verified = (email is not None)
if (not is_email_verified):
field = EMailField("uemail")
field.set_title(L10n.get("pas_http_user_email"))
field.set_required()
field.set_limits(_max = 255)
field.set_validators([ self._check_email_not_registered ])
form.add(field)
#
if (username is None):
field = TextField("uusername")
field.set_required()
field.set_limits(int(Settings.get("pas_http_core_username_min", 3)), 100)
field.set_size(TextField.SIZE_SMALL)
else:
field = InfoField("uusername")
field.set_value(username)
#
field.set_title(L10n.get("pas_core_username"))
field.set_validators([ self._check_username_not_registered ])
form.add(field)
if (is_email_verified):
field = InfoField("uemail")
field.set_title(L10n.get("pas_http_user_email"))
field.set_value(email)
field.set_validators([ self._check_email_not_registered ])
form.add(field)
#
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)
#.........这里部分代码省略.........