changeset 745:0b4eb0e37363

themes: Expand `~` paths, fix error message.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 05 Jun 2016 00:00:44 -0700
parents d8d2b504306a
children 0fdf1e43bf92
files piecrust/themes/base.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/themes/base.py	Sat Jun 04 09:20:30 2016 -0700
+++ b/piecrust/themes/base.py	Sun Jun 05 00:00:44 2016 -0700
@@ -35,9 +35,11 @@
         dirs = []
         themes_dirs = site_config.get('themes_dirs', [])
         if isinstance(themes_dirs, str):
-            dirs.append(os.path.join(self.root_dir, themes_dirs))
+            dirs.append(os.path.join(self.root_dir,
+                                     os.path.expanduser(themes_dirs)))
         else:
-            dirs += [os.path.join(self.root_dir, p) for p in themes_dirs]
+            dirs += [os.path.join(self.root_dir, os.path.expanduser(p))
+                     for p in themes_dirs]
 
         # Add the default `themes` directory.
         default_themes_dir = os.path.join(self.root_dir, THEMES_DIR)
@@ -51,6 +53,6 @@
                 return theme_dir
 
         raise ThemeNotFoundError(
-                "Can't find theme '%s'. Looked in: %s",
+                "Can't find theme '%s'. Looked in: %s" %
                 (theme, ', '.join(dirs)))