[Checkins] SVN: megrok.resourcelibrary/trunk/ Really fix the error
reporting when passing wrong directories.
Martijn Faassen
faassen at infrae.com
Fri Aug 8 11:44:44 EDT 2008
Log message for revision 89547:
Really fix the error reporting when passing wrong directories.
Changed:
U megrok.resourcelibrary/trunk/CHANGES.txt
U megrok.resourcelibrary/trunk/src/megrok/resourcelibrary/README.txt
U megrok.resourcelibrary/trunk/src/megrok/resourcelibrary/meta.py
-=-
Modified: megrok.resourcelibrary/trunk/CHANGES.txt
===================================================================
--- megrok.resourcelibrary/trunk/CHANGES.txt 2008-08-08 15:43:37 UTC (rev 89546)
+++ megrok.resourcelibrary/trunk/CHANGES.txt 2008-08-08 15:44:43 UTC (rev 89547)
@@ -5,7 +5,7 @@
-----------------
* Grokker mistakenly relied on (not imported) ``GrokImportError`` in failure
- case. Corrected this to ``GrokError``.
+ case. Corrected this to ``GrokError`` and added a test for it.
0.9.1 (2008-08-06)
------------------
Modified: megrok.resourcelibrary/trunk/src/megrok/resourcelibrary/README.txt
===================================================================
--- megrok.resourcelibrary/trunk/src/megrok/resourcelibrary/README.txt 2008-08-08 15:43:37 UTC (rev 89546)
+++ megrok.resourcelibrary/trunk/src/megrok/resourcelibrary/README.txt 2008-08-08 15:44:43 UTC (rev 89547)
@@ -83,6 +83,16 @@
alert('Hi there!');
}
+It's an error to point to a directory that doesn't exist::
+
+ >>> class WrongDirectory(megrok.resourcelibrary.ResourceLibrary):
+ ... grok.name('wrong-directory')
+ ... megrok.resourcelibrary.directory('tests/doesnt_exist')
+ >>> grok_component('WrongDirectory', WrongDirectory)
+ Traceback (most recent call last):
+ ...
+ GrokError: Directory 'tests/doesnt_exist' is not a valid directory passed to the 'wrong-directory' directive.
+
Automactic inclusion of resources
---------------------------------
Modified: megrok.resourcelibrary/trunk/src/megrok/resourcelibrary/meta.py
===================================================================
--- megrok.resourcelibrary/trunk/src/megrok/resourcelibrary/meta.py 2008-08-08 15:43:37 UTC (rev 89546)
+++ megrok.resourcelibrary/trunk/src/megrok/resourcelibrary/meta.py 2008-08-08 15:44:43 UTC (rev 89547)
@@ -34,11 +34,12 @@
def execute(self, class_, config, name, directory, use, include, layer,
permission,
**kw):
+ orig_directory = directory
directory = class_.module_info.getResourcePath(directory)
if not os.path.isdir(directory):
raise GrokError(
- "You can only pass a directory to the '%s' directive." %
- self.name)
+ "Directory '%s' is not a valid directory passed to the '%s' directive." %
+ (orig_directory, name), class_)
library_info[name] = LibraryInfo()
library_info[name].required.extend(use)
More information about the Checkins
mailing list