changeset 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 0e88640a994d
children 7e7fc7926307
files piecrust/sources/base.py
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
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