本文整理汇总了Python中jinja2.ext.Extension.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Extension.__init__方法的具体用法?Python Extension.__init__怎么用?Python Extension.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jinja2.ext.Extension
的用法示例。
在下文中一共展示了Extension.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
self.env = environment
environment.globals['mailpile'] = self._command
environment.globals['regex_replace'] = self._regex_replace
environment.filters['regex_replace'] = self._regex_replace
environment.globals['friendly_bytes'] = self._friendly_bytes
environment.filters['friendly_bytes'] = self._friendly_bytes
environment.globals['friendly_number'] = self._friendly_number
environment.filters['friendly_number'] = self._friendly_number
environment.globals['show_avatar'] = self._show_avatar
environment.filters['show_avatar'] = self._show_avatar
environment.globals['navigation_on'] = self._navigation_on
environment.filters['navigation_on'] = self._navigation_on
environment.globals['show_tags'] = self._show_tags
environment.filters['show_tags'] = self._show_tags
# See utils.py for these functions:
environment.globals['elapsed_datetime'] = elapsed_datetime
environment.filters['elapsed_datetime'] = elapsed_datetime
environment.globals['friendly_datetime'] = friendly_datetime
environment.filters['friendly_datetime'] = friendly_datetime
environment.globals['friendly_time'] = friendly_time
environment.filters['friendly_time'] = friendly_time
# See plugins/__init__.py for these functions:
environment.globals['get_activities'] = get_activities
environment.globals['get_selection_actions'] = get_selection_actions
environment.globals['get_display_actions'] = get_display_actions
environment.globals['get_display_modes'] = get_display_modes
示例2: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
self.env = environment
environment.globals['mailpile'] = self._command
environment.globals['regex_replace'] = self._regex_replace
environment.filters['regex_replace'] = self._regex_replace
environment.globals['friendly_date'] = self._friendly_date
environment.filters['friendly_date'] = self._friendly_date
示例3: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
self.env = environment
environment.globals['mailpile'] = self._command
environment.globals['mailpile_render'] = self._command_render
environment.globals['use_data_view'] = self._use_data_view
environment.globals['regex_replace'] = self._regex_replace
environment.filters['regex_replace'] = self._regex_replace
environment.globals['friendly_bytes'] = self._friendly_bytes
environment.filters['friendly_bytes'] = self._friendly_bytes
environment.globals['friendly_number'] = self._friendly_number
environment.filters['friendly_number'] = self._friendly_number
environment.globals['show_avatar'] = self._show_avatar
environment.filters['show_avatar'] = self._show_avatar
environment.globals['navigation_on'] = self._navigation_on
environment.filters['navigation_on'] = self._navigation_on
environment.globals['has_label_tags'] = self._has_label_tags
environment.filters['has_label_tags'] = self._has_label_tags
environment.globals['show_message_signature'
] = self._show_message_signature
environment.filters['show_message_signature'
] = self._show_message_signature
environment.globals['show_message_encryption'
] = self._show_message_encryption
environment.filters['show_message_encryption'
] = self._show_message_encryption
environment.globals['contact_url'] = self._contact_url
environment.filters['contact_url'] = self._contact_url
environment.globals['contact_name'] = self._contact_name
environment.filters['contact_name'] = self._contact_name
# See utils.py for these functions:
environment.globals['elapsed_datetime'] = elapsed_datetime
environment.filters['elapsed_datetime'] = elapsed_datetime
environment.globals['friendly_datetime'] = friendly_datetime
environment.filters['friendly_datetime'] = friendly_datetime
environment.globals['friendly_time'] = friendly_time
environment.filters['friendly_time'] = friendly_time
# These are helpers for injecting plugin elements
environment.globals['get_ui_elements'] = self._get_ui_elements
environment.globals['ui_elements_setup'] = self._ui_elements_setup
environment.filters['add_state_query_string'] = self._add_state_query_string
# This is a worse versin of urlencode, but without it we require
# Jinja 2.7, which isn't apt-get installable.
environment.globals['urlencode'] = self._urlencode
environment.filters['urlencode'] = self._urlencode
# Make a function-version of the safe command
environment.globals['safe'] = self._safe
environment.filters['json'] = self._json
# Strip trailing blank lines from email
environment.globals['nice_text'] = self._nice_text
environment.filters['nice_text'] = self._nice_text
示例4: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
environment.extend(
default_form_action="",
error_renderers={},
value_dict_name="form_vars",
error_dict_name="form_errors",
form_name_key=None,
form_ctx_key=None,
)
self.form = StubForm()
示例5: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
self.env = environment
environment.globals['mailpile'] = self._command
environment.globals['mailpile_render'] = self._command_render
environment.globals['regex_replace'] = self._regex_replace
environment.filters['regex_replace'] = self._regex_replace
environment.globals['friendly_bytes'] = self._friendly_bytes
environment.filters['friendly_bytes'] = self._friendly_bytes
environment.globals['friendly_number'] = self._friendly_number
environment.filters['friendly_number'] = self._friendly_number
environment.globals['show_avatar'] = self._show_avatar
environment.filters['show_avatar'] = self._show_avatar
environment.globals['navigation_on'] = self._navigation_on
environment.filters['navigation_on'] = self._navigation_on
environment.globals['has_label_tags'] = self._has_label_tags
environment.filters['has_label_tags'] = self._has_label_tags
environment.globals['show_message_signature'
] = self._show_message_signature
environment.filters['show_message_signature'
] = self._show_message_signature
environment.globals['show_message_encryption'
] = self._show_message_encryption
environment.filters['show_message_encryption'
] = self._show_message_encryption
environment.globals['contact_url'] = self._contact_url
environment.filters['contact_url'] = self._contact_url
environment.globals['contact_name'] = self._contact_name
environment.filters['contact_name'] = self._contact_name
# See utils.py for these functions:
environment.globals['elapsed_datetime'] = elapsed_datetime
environment.filters['elapsed_datetime'] = elapsed_datetime
environment.globals['friendly_datetime'] = friendly_datetime
environment.filters['friendly_datetime'] = friendly_datetime
environment.globals['friendly_time'] = friendly_time
environment.filters['friendly_time'] = friendly_time
# See plugins/__init__.py for these functions:
environment.globals['get_activities'] = get_activities
environment.globals['get_selection_actions'] = get_selection_actions
environment.globals['get_display_actions'] = get_display_actions
environment.globals['get_display_modes'] = get_display_modes
environment.globals['get_assets'] = get_assets
environment.globals['get_body_blocks'] = get_body_blocks
# This is a worse versin of urlencode, but without it we require
# Jinja 2.7, which isn't apt-get installable.
environment.globals['urlencode'] = self._urlencode
environment.filters['urlencode'] = self._urlencode
示例6: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
self.env = environment
environment.globals['mailpile'] = self._command
environment.globals['regex_replace'] = self._regex_replace
environment.filters['regex_replace'] = self._regex_replace
environment.globals['friendly_date'] = self._friendly_date
environment.filters['friendly_date'] = self._friendly_date
environment.globals['show_avatar'] = self._show_avatar
environment.filters['show_avatar'] = self._show_avatar
environment.globals['navigation_on'] = self._navigation_on
environment.filters['navigation_on'] = self._navigation_on
environment.globals['abbreviate_number'] = self._abbreviate_number
environment.filters['abbreviate_number'] = self._abbreviate_number
示例7: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
self.env = environment
environment.globals["mailpile"] = self._command
environment.globals["regex_replace"] = self._regex_replace
environment.filters["regex_replace"] = self._regex_replace
environment.globals["friendly_date"] = self._friendly_date
environment.filters["friendly_date"] = self._friendly_date
environment.globals["friendly_bytes"] = self._friendly_bytes
environment.filters["friendly_bytes"] = self._friendly_bytes
environment.globals["friendly_number"] = self._friendly_number
environment.filters["friendly_number"] = self._friendly_number
environment.globals["show_avatar"] = self._show_avatar
environment.filters["show_avatar"] = self._show_avatar
environment.globals["navigation_on"] = self._navigation_on
environment.filters["navigation_on"] = self._navigation_on
environment.globals["show_tags"] = self._show_tags
environment.filters["show_tags"] = self._show_tags
示例8: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
self.env = environment
environment.globals['mailpile'] = self._command
environment.globals['regex_replace'] = self._regex_replace
environment.filters['regex_replace'] = self._regex_replace
environment.globals['friendly_bytes'] = self._friendly_bytes
environment.filters['friendly_bytes'] = self._friendly_bytes
environment.globals['friendly_number'] = self._friendly_number
environment.filters['friendly_number'] = self._friendly_number
environment.globals['show_avatar'] = self._show_avatar
environment.filters['show_avatar'] = self._show_avatar
environment.globals['navigation_on'] = self._navigation_on
environment.filters['navigation_on'] = self._navigation_on
environment.globals['show_tags'] = self._show_tags
environment.filters['show_tags'] = self._show_tags
environment.globals['message_signature_classes'
] = self._message_signature_classes
environment.filters['message_signature_classes'
] = self._message_signature_classes
environment.globals['message_encryption_classes'
] = self._message_encryption_classes
environment.filters['message_encryption_classes'
] = self._message_encryption_classes
environment.globals['contact_url'] = self._contact_url
environment.filters['contact_url'] = self._contact_url
environment.globals['contact_name'] = self._contact_name
environment.filters['contact_name'] = self._contact_name
# See utils.py for these functions:
environment.globals['elapsed_datetime'] = elapsed_datetime
environment.filters['elapsed_datetime'] = elapsed_datetime
environment.globals['friendly_datetime'] = friendly_datetime
environment.filters['friendly_datetime'] = friendly_datetime
environment.globals['friendly_time'] = friendly_time
environment.filters['friendly_time'] = friendly_time
# See plugins/__init__.py for these functions:
environment.globals['get_activities'] = get_activities
environment.globals['get_selection_actions'] = get_selection_actions
environment.globals['get_display_actions'] = get_display_actions
environment.globals['get_display_modes'] = get_display_modes
environment.globals['get_assets'] = get_assets
environment.globals['get_body_blocks'] = get_body_blocks
示例9: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
self.env = environment
environment.globals['mailpile'] = self._command
environment.globals['regex_replace'] = self._regex_replace
environment.filters['regex_replace'] = self._regex_replace
environment.globals['elapsed_datetime'] = self._elapsed_datetime
environment.filters['elapsed_datetime'] = self._elapsed_datetime
environment.globals['friendly_datetime'] = self._friendly_datetime
environment.filters['friendly_datetime'] = self._friendly_datetime
environment.globals['friendly_bytes'] = self._friendly_bytes
environment.filters['friendly_bytes'] = self._friendly_bytes
environment.globals['friendly_number'] = self._friendly_number
environment.filters['friendly_number'] = self._friendly_number
environment.globals['show_avatar'] = self._show_avatar
environment.filters['show_avatar'] = self._show_avatar
environment.globals['navigation_on'] = self._navigation_on
environment.filters['navigation_on'] = self._navigation_on
environment.globals['show_tags'] = self._show_tags
environment.filters['show_tags'] = self._show_tags
示例10: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
environment.extend(
foo_custom_output='foo',
)
示例11: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
environment.globals['tr'] = self.translate
self._prepared_translations = {}
示例12: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Extension.__init__(self, *args, **kwargs)
self.lastchar = None
示例13: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
e = self.env = environment
s = self
e.globals["mailpile"] = s._command
e.globals["mailpile_render"] = s._command_render
e.globals["U"] = s._url_path_fix
e.globals["make_rid"] = randomish_uid
e.globals["is_dev_version"] = s._is_dev_version
e.filters["random"] = s._random
e.globals["random"] = s._random
e.filters["truthy"] = s._truthy
e.globals["truthy"] = s._truthy
e.filters["with_context"] = s._with_context
e.globals["with_context"] = s._with_context
e.filters["url_path_fix"] = s._url_path_fix
e.globals["use_data_view"] = s._use_data_view
e.globals["regex_replace"] = s._regex_replace
e.filters["regex_replace"] = s._regex_replace
e.globals["friendly_bytes"] = s._friendly_bytes
e.filters["friendly_bytes"] = s._friendly_bytes
e.globals["friendly_number"] = s._friendly_number
e.filters["friendly_number"] = s._friendly_number
e.globals["show_avatar"] = s._show_avatar
e.filters["show_avatar"] = s._show_avatar
e.globals["navigation_on"] = s._navigation_on
e.filters["navigation_on"] = s._navigation_on
e.globals["has_label_tags"] = s._has_label_tags
e.filters["has_label_tags"] = s._has_label_tags
e.globals["show_message_signature"] = s._show_message_signature
e.filters["show_message_signature"] = s._show_message_signature
e.globals["show_message_encryption"] = s._show_message_encryption
e.filters["show_message_encryption"] = s._show_message_encryption
e.globals["show_text_part_signature"] = s._show_text_part_signature
e.filters["show_text_part_signature"] = s._show_text_part_signature
e.globals["show_text_part_encryption"] = s._show_text_part_encryption
e.filters["show_text_part_encryption"] = s._show_text_part_encryption
e.globals["show_crypto_policy"] = s._show_crypto_policy
e.filters["show_crypto_policy"] = s._show_crypto_policy
e.globals["contact_url"] = s._contact_url
e.filters["contact_url"] = s._contact_url
e.globals["contact_name"] = s._contact_name
e.filters["contact_name"] = s._contact_name
e.globals["thread_upside_down"] = s._thread_upside_down
e.filters["thread_upside_down"] = s._thread_upside_down
e.globals["fix_urls"] = s._fix_urls
e.filters["fix_urls"] = s._fix_urls
# See utils.py for these functions:
e.globals["elapsed_datetime"] = elapsed_datetime
e.filters["elapsed_datetime"] = elapsed_datetime
e.globals["friendly_datetime"] = friendly_datetime
e.filters["friendly_datetime"] = friendly_datetime
e.globals["friendly_time"] = friendly_time
e.filters["friendly_time"] = friendly_time
# These are helpers for injecting plugin elements
e.globals["get_ui_elements"] = s._get_ui_elements
e.globals["ui_elements_setup"] = s._ui_elements_setup
e.globals["add_state_query_string"] = s._add_state_query_string
e.filters["add_state_query_string"] = s._add_state_query_string
# This is a worse versin of urlencode, but without it we require
# Jinja 2.7, which isn't apt-get installable.
e.globals["urlencode"] = s._urlencode
e.filters["urlencode"] = s._urlencode
# Same thing for selectattr
e.globals["selectattr"] = s._selectattr
e.filters["selectattr"] = s._selectattr
# Make a function-version of the safe command
e.globals["safe"] = s._safe
e.filters["json"] = s._json
e.filters["escapejs"] = s._escapejs
# Strip trailing blank lines from email
e.globals["nice_text"] = s._nice_text
e.filters["nice_text"] = s._nice_text
# Transforms \n into HTML <br />
e.globals["to_br"] = s._to_br
e.filters["to_br"] = s._to_br
# Strip Re: Fwd: from subject lines
e.globals["nice_subject"] = s._nice_subject
e.filters["nice_subject"] = s._nice_subject
# And [list] headings as well
e.globals["bare_subject"] = s._bare_subject
e.filters["bare_subject"] = s._bare_subject
# Make unruly names a lil bit nicer
e.globals["nice_name"] = s._nice_name
e.filters["nice_name"] = s._nice_name
# Makes a UI usable classification of attachment from mimetype
e.globals["attachment_type"] = s._attachment_type
e.filters["attachment_type"] = s._attachment_type
# Loads theme settings JSON manifest
e.globals["theme_settings"] = s._theme_settings
#.........这里部分代码省略.........
示例14: __call__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __call__(self, environment):
Extension.__init__(self, environment)
self.env = environment
return self
示例15: __init__
# 需要导入模块: from jinja2.ext import Extension [as 别名]
# 或者: from jinja2.ext.Extension import __init__ [as 别名]
def __init__(self, environment):
Extension.__init__(self, environment)
# state to keep track of which files have been loaded
environment.extend(_loaded_files=set())