Browse Source

Add a configuration switch to ignore some files.

By default, backup files are ignored and node turned into a node.
main
Vincent Bernat 13 years ago
parent
commit
b0ac4e79ba
2 changed files with 6 additions and 1 deletions
  1. +2
    -1
      hyde/model.py
  2. +4
    -0
      hyde/site.py

+ 2
- 1
hyde/model.py View File

@@ -128,7 +128,8 @@ class Config(Expando):
media_url='/media', media_url='/media',
base_url="/", base_url="/",
not_found='404.html', not_found='404.html',
plugins = []
plugins = [],
ignore = [ "*~", "*.bak" ]
) )
conf = dict(**default_config) conf = dict(**default_config)
self.sitepath = Folder(sitepath) self.sitepath = Folder(sitepath)


+ 4
- 0
hyde/site.py View File

@@ -3,6 +3,7 @@
Parses & holds information about the site to be generated. Parses & holds information about the site to be generated.
""" """
import os import os
import fnmatch
from hyde.exceptions import HydeException from hyde.exceptions import HydeException
from hyde.fs import FS, File, Folder from hyde.fs import FS, File, Folder
from hyde.model import Config from hyde.model import Config
@@ -352,6 +353,9 @@ class RootNode(Node):


@walker.file_visitor @walker.file_visitor
def visit_file(afile): def visit_file(afile):
for pattern in self.site.config.ignore:
if fnmatch.fnmatch(afile.name, pattern):
return
self.add_resource(afile) self.add_resource(afile)






Loading…
Cancel
Save