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


Python ext.Extension類代碼示例

本文整理匯總了Python中jinja2.ext.Extension的典型用法代碼示例。如果您正苦於以下問題:Python Extension類的具體用法?Python Extension怎麽用?Python Extension使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: __init__

    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
開發者ID:MichaelTaylor3D,項目名稱:Mailpile,代碼行數:30,代碼來源:jinjaextensions.py

示例2: __init__

 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
開發者ID:Biobeyoung,項目名稱:Mailpile,代碼行數:8,代碼來源:jinjaextensions.py

示例3: __init__

    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
開發者ID:vletard,項目名稱:Mailpile,代碼行數:56,代碼來源:jinjaextensions.py

示例4: __init__

 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()
開發者ID:bmorgan21,項目名稱:formpump,代碼行數:11,代碼來源:jinjapump.py

示例5: __init__

    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
開發者ID:dlmueller,項目名稱:Mailpile,代碼行數:50,代碼來源:jinjaextensions.py

示例6: __init__

 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
開發者ID:PDAHubbard,項目名稱:Mailpile,代碼行數:14,代碼來源:jinjaextensions.py

示例7: __init__

 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
開發者ID:nhenezi,項目名稱:Mailpile,代碼行數:18,代碼來源:jinjaextensions.py

示例8: __init__

    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
開發者ID:Valodim,項目名稱:Mailpile,代碼行數:44,代碼來源:jinjaextensions.py

示例9: __init__

 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
開發者ID:mischpoCHE,項目名稱:Mailpile,代碼行數:20,代碼來源:jinjaextensions.py

示例10: __init__

 def __init__(self, environment):
     Extension.__init__(self, environment)
     environment.extend(
         foo_custom_output='foo',
     )
開發者ID:dchaplinsky,項目名稱:coffin,代碼行數:5,代碼來源:foo_ext.py

示例11: __init__

 def __init__(self, environment):
     Extension.__init__(self, environment)
     environment.globals['tr'] = self.translate
     self._prepared_translations = {}
開發者ID:deti,項目名稱:boss,代碼行數:4,代碼來源:pdf_render.py

示例12: __init__

 def __init__(self, *args, **kwargs):
     Extension.__init__(self, *args, **kwargs)
     self.lastchar = None
開發者ID:Hermy,項目名稱:foofind-web,代碼行數:3,代碼來源:htmlcompress.py

示例13: __init__

    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
#.........這裏部分代碼省略.........
開發者ID:invenktive,項目名稱:Mailpile,代碼行數:101,代碼來源:jinjaextensions.py

示例14: __call__

 def __call__(self, environment):
     Extension.__init__(self, environment)
     self.env = environment
     return self
開發者ID:axiak,項目名稱:jinjatag,代碼行數:4,代碼來源:extension.py

示例15: __init__

    def __init__(self, environment):
        Extension.__init__(self, environment)

        # state to keep track of which files have been loaded
        environment.extend(_loaded_files=set())
開發者ID:robograder,項目名稱:dada,代碼行數:5,代碼來源:load_extension.py


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