From b0ac4e79baa0290a6c7523597d760c7121a5d585 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 1 May 2011 07:43:44 +0200 Subject: [PATCH] Add a configuration switch to ignore some files. By default, backup files are ignored and node turned into a node. --- hyde/model.py | 3 ++- hyde/site.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hyde/model.py b/hyde/model.py index 3854eee..4742e32 100644 --- a/hyde/model.py +++ b/hyde/model.py @@ -128,7 +128,8 @@ class Config(Expando): media_url='/media', base_url="/", not_found='404.html', - plugins = [] + plugins = [], + ignore = [ "*~", "*.bak" ] ) conf = dict(**default_config) self.sitepath = Folder(sitepath) diff --git a/hyde/site.py b/hyde/site.py index c403b42..5a75f8d 100644 --- a/hyde/site.py +++ b/hyde/site.py @@ -3,6 +3,7 @@ Parses & holds information about the site to be generated. """ import os +import fnmatch from hyde.exceptions import HydeException from hyde.fs import FS, File, Folder from hyde.model import Config @@ -352,6 +353,9 @@ class RootNode(Node): @walker.file_visitor def visit_file(afile): + for pattern in self.site.config.ignore: + if fnmatch.fnmatch(afile.name, pattern): + return self.add_resource(afile)