Browse Source

Added ability to clear caches

main
Lakshmi Vyasarajan 13 years ago
parent
commit
7beba96614
4 changed files with 15 additions and 0 deletions
  1. +1
    -0
      hyde/engine.py
  2. +7
    -0
      hyde/ext/templates/jinja.py
  3. +1
    -0
      hyde/generator.py
  4. +6
    -0
      hyde/template.py

+ 1
- 0
hyde/engine.py View File

@@ -88,6 +88,7 @@ class Engine(Application):
incremental = False incremental = False


gen.generate_all(incremental=incremental) gen.generate_all(incremental=incremental)
logger.info("Generation complete.")


@subcommand('serve', help='Serve the website') @subcommand('serve', help='Serve the website')
@store('-a', '--address', default='localhost', dest='address', @store('-a', '--address', default='localhost', dest='address',


+ 7
- 0
hyde/ext/templates/jinja.py View File

@@ -581,6 +581,13 @@ class Jinja2Template(Template):
if jinja2_filters: if jinja2_filters:
jinja2_filters.register(self.env) jinja2_filters.register(self.env)


def clear_caches(self):
"""
Clear all caches to prepare for regeneration
"""
if self.env.bytecode_cache:
self.env.bytecode_cache.clear()



def get_dependencies(self, path): def get_dependencies(self, path):
""" """


+ 1
- 0
hyde/generator.py View File

@@ -190,6 +190,7 @@ class Generator(object):
""" """
logger.info("Reading site contents") logger.info("Reading site contents")
self.load_template_if_needed() self.load_template_if_needed()
self.template.clear_caches()
self.initialize() self.initialize()
self.load_site_if_needed() self.load_site_if_needed()
self.events.begin_site() self.events.begin_site()


+ 6
- 0
hyde/template.py View File

@@ -67,6 +67,12 @@ class Template(object):
""" """
return return


def clear_caches(self):
"""
Clear all caches to prepare for regeneration
"""
return

def get_dependencies(self, text): def get_dependencies(self, text):
""" """
Finds the dependencies based on the included Finds the dependencies based on the included


Loading…
Cancel
Save