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


Python FlatPages._file_cache方法代碼示例

本文整理匯總了Python中flask_flatpages.FlatPages._file_cache方法的典型用法代碼示例。如果您正苦於以下問題:Python FlatPages._file_cache方法的具體用法?Python FlatPages._file_cache怎麽用?Python FlatPages._file_cache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在flask_flatpages.FlatPages的用法示例。


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

示例1: test_basic

# 需要導入模塊: from flask_flatpages import FlatPages [as 別名]
# 或者: from flask_flatpages.FlatPages import _file_cache [as 別名]
    def test_basic(self):
        pages = FlatPages(Flask(__name__))

        hello = pages.get('headerid')
        self.assertEqual(
            hello.html,
            u'<h1>Page Header</h1>\n<h2>Paragraph Header</h2>\n<p>Text</p>'
        )

        pages.app.config['FLATPAGES_MARKDOWN_EXTENSIONS'] = []
        pages.reload()
        pages._file_cache = {}

        hello = pages.get('headerid')
        self.assertEqual(
            hello.html,
            u'<h1>Page Header</h1>\n<h2>Paragraph Header</h2>\n<p>Text</p>'
        )

        pages.app.config['FLATPAGES_MARKDOWN_EXTENSIONS'] = [
            'codehilite', 'headerid'
        ]
        pages.reload()
        pages._file_cache = {}

        hello = pages.get('headerid')
        self.assertEqual(
            hello.html,
            '<h1 id="page-header">Page Header</h1>\n'
            '<h2 id="paragraph-header">Paragraph Header</h2>\n'
            '<p>Text</p>'
        )
開發者ID:danielgloven,項目名稱:Flask-FlatPages,代碼行數:34,代碼來源:test_markdown_extensions.py

示例2: test_extension_object

# 需要導入模塊: from flask_flatpages import FlatPages [as 別名]
# 或者: from flask_flatpages.FlatPages import _file_cache [as 別名]
 def test_extension_object(self):
     app = Flask(__name__)
     from markdown.extensions.codehilite import CodeHiliteExtension
     codehilite = CodeHiliteExtension()
     app.config['FLATPAGES_MARKDOWN_EXTENSIONS'] = [codehilite]
     pages = FlatPages(app)
     self.check_default_codehilite_page(pages)
     codehilite = CodeHiliteExtension(linenums='True') #Check config applies
     app.config['FLATPAGES_MARKDOWN_EXTENSIONS'] = [codehilite]
     pages.reload()
     pages._file_cache = {}
     self.check_codehilite_with_linenums(pages)
開發者ID:SimonSapin,項目名稱:Flask-FlatPages,代碼行數:14,代碼來源:test_markdown_extensions.py

示例3: test_codehilite_linenums_disabled

# 需要導入模塊: from flask_flatpages import FlatPages [as 別名]
# 或者: from flask_flatpages.FlatPages import _file_cache [as 別名]
 def test_codehilite_linenums_disabled(self):
     #Test explicity disabled
     app = Flask(__name__)
     app.config['FLATPAGES_MARKDOWN_EXTENSIONS'] = ['codehilite']
     pages = FlatPages(app)
     self.check_default_codehilite_page(pages)
     #Test explicity disabled
     pages.app.config['FLATPAGES_EXTENSION_CONFIGS'] = {
         'codehilite': {
             'linenums': 'False'
         }
     }
     pages.reload()
     pages._file_cache = {}
     self.check_default_codehilite_page(pages)
開發者ID:SimonSapin,項目名稱:Flask-FlatPages,代碼行數:17,代碼來源:test_markdown_extensions.py

示例4: test_extension_importpath

# 需要導入模塊: from flask_flatpages import FlatPages [as 別名]
# 或者: from flask_flatpages.FlatPages import _file_cache [as 別名]
 def test_extension_importpath(self):
     app = Flask(__name__)
     app.config['FLATPAGES_MARKDOWN_EXTENSIONS'] = [
         'markdown.extensions.codehilite:CodeHiliteExtension'
     ]
     pages = FlatPages(app)
     self.check_default_codehilite_page(pages)
     app.config['FLATPAGES_EXTENSION_CONFIGS'] = { #Markdown 3 style config
         'markdown.extensions.codehilite:CodeHiliteExtension': {
             'linenums': True
         }
     }
     pages.reload()
     pages._file_cache = {}
     self.check_codehilite_with_linenums(pages)
開發者ID:SimonSapin,項目名稱:Flask-FlatPages,代碼行數:17,代碼來源:test_markdown_extensions.py

示例5: test_headerid_with_toc

# 需要導入模塊: from flask_flatpages import FlatPages [as 別名]
# 或者: from flask_flatpages.FlatPages import _file_cache [as 別名]
    def test_headerid_with_toc(self):
        app = Flask(__name__)
        pages = FlatPages(app)
        pages.app.config['FLATPAGES_MARKDOWN_EXTENSIONS'] = [
            'codehilite', 'toc' #headerid is deprecated in Markdown 3.0
        ]
        pages.reload()
        pages._file_cache = {}

        hello = pages.get('headerid')
        self.assertEqual(
            hello.html,
            '<h1 id="page-header">Page Header</h1>\n'
            '<h2 id="paragraph-header">Paragraph Header</h2>\n'
            '<p>Text</p>'
        )
        self.check_default_codehilite_page(pages) #test codehilite also loaded
開發者ID:SimonSapin,項目名稱:Flask-FlatPages,代碼行數:19,代碼來源:test_markdown_extensions.py

示例6: test_mixed_extension_types

# 需要導入模塊: from flask_flatpages import FlatPages [as 別名]
# 或者: from flask_flatpages.FlatPages import _file_cache [as 別名]
 def test_mixed_extension_types(self):
     app = Flask(__name__)
     from markdown.extensions.toc import TocExtension
     toc = TocExtension()
     app.config['FLATPAGES_MARKDOWN_EXTENSIONS'] = [
         toc,
         'codehilite',
         'markdown.extensions.extra:ExtraExtension'
     ]
     pages = FlatPages(app)
     self.check_toc_page(pages)
     self.check_default_codehilite_page(pages)
     self.check_extra(pages)
     app.config['FLATPAGES_EXTENSION_CONFIGS'] = {
         'codehilite': {
             'linenums': 'True'
         }
     }
     pages.reload()
     pages._file_cache = {}
     self.check_toc_page(pages)
     self.check_extra(pages)
     self.check_codehilite_with_linenums(pages)
開發者ID:SimonSapin,項目名稱:Flask-FlatPages,代碼行數:25,代碼來源:test_markdown_extensions.py


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