constance

Scripts for generating (an earlier obsolete version of) my personal web site
git clone https://code.djc.id.au/git/constance/
commit 049eaf9b2d704f23621c167dbbfab51d4f5963c0
parent 48bae23bb8c76c9db8a5dc6c0742c46d1ad84387
Author: Dan Callaghan <djc@djc.id.au>
Date:   Sat, 20 Nov 2010 13:09:01 +1000

move default config into its own file (also it's more of a sample than a default)

Diffstat:
MREADME | 2+-
Aconstance.conf.sample | 12++++++++++++
Mconstance.py | 21+--------------------
3 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/README b/README
@@ -10,7 +10,7 @@ mysql-python (for export_wp.py)
 Initial config
 --------------
 
-1. python constance.py --dump-default-config > ~/.constance.conf
+1. cp constance.conf.sample ~/.constance.conf
 2. Edit ~/.constance.conf -- ensure you update the root directory or your 
    working directory will be used!
 3. mkdir ROOT/{blog,tags}
diff --git a/constance.conf.sample b/constance.conf.sample
@@ -0,0 +1,12 @@
+[paths]
+root = ./htdocs
+blog = %(root)s/blog
+tags = %(root)s/tags
+reading_log =
+xslt = ./sample.xsl
+
+[template]
+website = http://localhost
+name = Joe Bloggs
+email = user@domain.com
+disqus_user = 
diff --git a/constance.py b/constance.py
@@ -29,32 +29,13 @@ def output(filename, content):
     open(filename, 'w').write(content)
     print 'Wrote %s' % filename
 
-default_config = """[paths]
-root = ./htdocs
-blog = %(root)s/blog
-tags = %(root)s/tags
-reading_log =
-xslt = ./sample.xsl
-
-[template]
-website = http://localhost
-name = Joe Bloggs
-email = user@domain.com
-disqus_user = 
-"""
-
 def main():
     # set up argument parser
     parser = optparse.OptionParser()
     parser.add_option('--config', metavar='FILENAME')
-    parser.add_option('--dump-default-config', action='store_true')
-    parser.set_defaults(config='~/.constance.conf', dump_default_config=False)
+    parser.set_defaults(config='~/.constance.conf')
     options, args = parser.parse_args()
 
-    if options.dump_default_config:
-        print default_config
-        return
-
     # populate config from default location (which would have been
     # overidden by --config above, if given)
     config = SafeConfigParser()