constance

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

use .constance.conf instead of .constance for default config filename

Diffstat:
MREADME | 6+++---
Mconstance.py | 7++-----
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/README b/README
@@ -10,9 +10,9 @@ mysql-python (for export_wp.py)
 Initial config
 --------------
 
-1. python constance.py --dump-default-config > ~/.constance
-2. Edit ~/.constance - ensure you update the root directory or your working
-   directory will be used!
+1. python constance.py --dump-default-config > ~/.constance.conf
+2. Edit ~/.constance.conf -- ensure you update the root directory or your 
+   working directory will be used!
 3. mkdir ROOT/{blog,tags}
 4. Edit your XSLT stylesheet
 5. Copy or symlink htaccess to ROOT/.htaccess
diff --git a/constance.py b/constance.py
@@ -44,14 +44,11 @@ disqus_user =
 """
 
 def main():
-    config_filename = os.path.expanduser('~/.constance')
-
     # 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=config_filename)
-    parser.set_defaults(dump_default_config=False)
+    parser.set_defaults(config='~/.constance.conf', dump_default_config=False)
     options, args = parser.parse_args()
 
     if options.dump_default_config:
@@ -61,7 +58,7 @@ def main():
     # populate config from default location (which would have been
     # overidden by --config above, if given)
     config = SafeConfigParser()
-    with open(options.config, 'r') as fp:
+    with open(os.path.expanduser(options.config), 'r') as fp:
         config.readfp(fp)
     template_config = dict(config.items('template'))