diff piecrust/sources/base.py @ 932:0eca08213354

sources: Give better exception messages when a class is missing a method.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 04 Oct 2017 09:10:41 -0700
parents 1d0364614665
children 84fc72a17f7a
line wrap: on
line diff
--- a/piecrust/sources/base.py	Wed Oct 04 09:09:56 2017 -0700
+++ b/piecrust/sources/base.py	Wed Oct 04 09:10:41 2017 -0700
@@ -131,23 +131,29 @@
         return cache
 
     def getContents(self, group):
-        raise NotImplementedError("'%s' doesn't implement 'getContents'." %
-                                  self.__class__)
+        raise NotImplementedError(
+            "'%s' doesn't implement 'getContents'." % self.__class__)
 
     def getParentGroup(self, item):
-        raise NotImplementedError()
+        raise NotImplementedError(
+            "'%s' doesn't implement 'getParentGroup'." % self.__class__)
 
     def getRelatedContents(self, item, relationship):
-        raise NotImplementedError()
+        raise NotImplementedError(
+            "'%s' doesn't implement 'getRelatedContents'." % self.__class__)
 
     def findGroup(self, rel_spec):
-        raise NotImplementedError()
+        raise NotImplementedError(
+            "'%s' doesn't implement 'findGroup'." % self.__class__)
 
     def findContent(self, route_params):
-        raise NotImplementedError()
+        raise NotImplementedError(
+            "'%s' doesn't implement 'findContent'." % self.__class__)
 
     def getSupportedRouteParameters(self):
-        raise NotImplementedError()
+        raise NotImplementedError(
+            "'%s' doesn't implement 'getSupportedRouteParameters'." %
+            self.__class__)
 
     def prepareRenderContext(self, ctx):
         pass