changeset 156:683baa977d97

Simplify `AutoConfigSource` by inheriting from `SimplePageSource`.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 27 Dec 2014 18:14:46 -0800
parents 70b86e904b85
children 55910ab4bfea
files piecrust/sources/autoconfig.py
diffstat 1 files changed, 2 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/sources/autoconfig.py	Sat Dec 27 18:14:06 2014 -0800
+++ b/piecrust/sources/autoconfig.py	Sat Dec 27 18:14:46 2014 -0800
@@ -2,7 +2,7 @@
 import os.path
 import logging
 from piecrust.sources.base import (
-        PageSource, IPreparingSource, SimplePaginationSourceMixin,
+        SimplePageSource, IPreparingSource, SimplePaginationSourceMixin,
         PageNotFoundError, InvalidFileSystemEndpointError,
         PageFactory, MODE_CREATING, MODE_PARSING)
 
@@ -10,17 +10,12 @@
 logger = logging.getLogger(__name__)
 
 
-class AutoConfigSource(PageSource,
+class AutoConfigSource(SimplePageSource,
                        SimplePaginationSourceMixin):
     SOURCE_NAME = 'autoconfig'
-    PATH_FORMAT = '%(values)s/%(slug)s.%(ext)s'
 
     def __init__(self, app, name, config):
         super(AutoConfigSource, self).__init__(app, name, config)
-        self.fs_endpoint = config.get('fs_endpoint', name)
-        self.fs_endpoint_path = os.path.join(self.root_dir, self.fs_endpoint)
-        self.supported_extensions = list(app.config.get('site/auto_formats').keys())
-        self.default_auto_format = app.config.get('site/default_auto_format')
         self.setting_name = config.get('setting_name', name)
         self.collapse_single_values = config.get('collapse_single_values', False)
         self.only_single_values = config.get('only_single_values', False)
@@ -54,10 +49,6 @@
             values = values[0]
         return {self.setting_name: values}
 
-    def resolveRef(self, ref_path):
-        return os.path.normpath(
-                os.path.join(self.fs_endpoint_path, ref_path))
-
     def findPagePath(self, metadata, mode):
         for dirpath, dirnames, filenames in os.walk(self.fs_endpoint_path):
             for f in filenames: