From 3625162f9f4a2d983563542733d959661308567d Mon Sep 17 00:00:00 2001 From: Stian Ellingsen Date: Mon, 30 May 2011 17:36:23 +0200 Subject: [PATCH 1/2] Let tagger plugin generate archives without any filename extension. --- hyde/ext/plugins/tagger.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hyde/ext/plugins/tagger.py b/hyde/ext/plugins/tagger.py index 7551d7e..ec34c03 100644 --- a/hyde/ext/plugins/tagger.py +++ b/hyde/ext/plugins/tagger.py @@ -142,5 +142,6 @@ class TaggerPlugin(Plugin): "walk_resources_tagged_with_%s" % tag) )) archive_text = self.template.render(text, context) - archive_file = File(target.child("%s.%s" % (tag, extension))) + archive_file = File(target.child("%s.%s" % (tag, extension) + if extension is not None else tag)) archive_file.write(archive_text) From 1c22e0ed09d4ef21389a9bfb8c7ea60c995d8237 Mon Sep 17 00:00:00 2001 From: Stian Ellingsen Date: Mon, 30 May 2011 21:36:34 +0200 Subject: [PATCH 2/2] Add ability to change the MIME type extensions map in 'hyde serve'. --- hyde/engine.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hyde/engine.py b/hyde/engine.py index 943b2cb..9a99b84 100644 --- a/hyde/engine.py +++ b/hyde/engine.py @@ -99,6 +99,9 @@ class Engine(Application): help='The configuration used to generate the site') @store('-d', '--deploy-path', dest='deploy', default=None, help='Where should the site be generated?') + @append('-t', '--type', dest='types', default=[], nargs='+', + metavar=('TYPE', 'EXT'), help='Add a MIME type mapping for' + ' one or more extensions, or set the default MIME type.') def serve(self, args): """ The serve command. Serves the site at the given @@ -109,7 +112,10 @@ class Engine(Application): sitepath = Folder(Folder(args.sitepath).fully_expanded_path) config_file = sitepath.child(args.config) site = self.make_site(args.sitepath, args.config, args.deploy) - from hyde.server import HydeWebServer + from hyde.server import HydeWebServer, HydeRequestHandler + for t in args.types: + for e in t[1:] or ['']: + HydeRequestHandler.extensions_map[e] = t[0] server = HydeWebServer(site, args.address, args.port) logger.info("Starting webserver at [%s]:[%d]", args.address, args.port) try: