[Checkins] SVN: grok/trunk/ Fix bug #80403: situation were a module
name is identical to a package name.
Uli Fouquet
uli at gnufix.de
Sun Apr 6 19:41:22 EDT 2008
Log message for revision 85129:
Fix bug #80403: situation were a module name is identical to a package name.
At least no 'unassociated template' warning in this case any more.
Changed:
U grok/trunk/CHANGES.txt
U grok/trunk/src/grok/templatereg.py
A grok/trunk/src/grok/tests/view/modequalspkgname/
A grok/trunk/src/grok/tests/view/modequalspkgname/__init__.py
A grok/trunk/src/grok/tests/view/modequalspkgname/modequalspkgname.py
A grok/trunk/src/grok/tests/view/modequalspkgname/modequalspkgname_templates/
A grok/trunk/src/grok/tests/view/modequalspkgname/modequalspkgname_templates/index.pt
U grok/trunk/src/grok/tests/view/unassociated.py
-=-
Modified: grok/trunk/CHANGES.txt
===================================================================
--- grok/trunk/CHANGES.txt 2008-04-06 19:07:30 UTC (rev 85128)
+++ grok/trunk/CHANGES.txt 2008-04-06 23:41:18 UTC (rev 85129)
@@ -74,6 +74,11 @@
* Fix https://bugs.launchpad.net/grok/+bug/125720: server control form
had shutdown as default action, even when entering an admin message.
+* Fix https://bugs.launchpad.net/grok/+bug/80403: Fix situation where
+ a module name is identical to the package name. At least modules
+ with templates can now have same name as their package.
+
+
Restructuring
-------------
Modified: grok/trunk/src/grok/templatereg.py
===================================================================
--- grok/trunk/src/grok/templatereg.py 2008-04-06 19:07:30 UTC (rev 85128)
+++ grok/trunk/src/grok/templatereg.py 2008-04-06 23:41:18 UTC (rev 85129)
@@ -32,6 +32,9 @@
if not os.path.isdir(template_dir):
return
+ if module_info.isPackage():
+ return
+
for template_file in os.listdir(template_dir):
if template_file.startswith('.') or template_file.endswith('~'):
continue
Added: grok/trunk/src/grok/tests/view/modequalspkgname/__init__.py
===================================================================
--- grok/trunk/src/grok/tests/view/modequalspkgname/__init__.py (rev 0)
+++ grok/trunk/src/grok/tests/view/modequalspkgname/__init__.py 2008-04-06 23:41:18 UTC (rev 85129)
@@ -0,0 +1 @@
+# a package
Added: grok/trunk/src/grok/tests/view/modequalspkgname/modequalspkgname.py
===================================================================
--- grok/trunk/src/grok/tests/view/modequalspkgname/modequalspkgname.py (rev 0)
+++ grok/trunk/src/grok/tests/view/modequalspkgname/modequalspkgname.py 2008-04-06 23:41:18 UTC (rev 85129)
@@ -0,0 +1,11 @@
+"""
+The sense of this module is, to have the same name as the package it
+resides in. Grokking it should not provoke an `unassociated template`
+error or warning.
+"""
+import grok
+class Cave(grok.Model):
+ pass
+
+class Index(grok.View):
+ pass # see modequalspkgname_templates
Added: grok/trunk/src/grok/tests/view/modequalspkgname/modequalspkgname_templates/index.pt
===================================================================
--- grok/trunk/src/grok/tests/view/modequalspkgname/modequalspkgname_templates/index.pt (rev 0)
+++ grok/trunk/src/grok/tests/view/modequalspkgname/modequalspkgname_templates/index.pt 2008-04-06 23:41:18 UTC (rev 85129)
@@ -0,0 +1,2 @@
+<!-- Just a dummy -->
+
Modified: grok/trunk/src/grok/tests/view/unassociated.py
===================================================================
--- grok/trunk/src/grok/tests/view/unassociated.py 2008-04-06 19:07:30 UTC (rev 85128)
+++ grok/trunk/src/grok/tests/view/unassociated.py 2008-04-06 23:41:18 UTC (rev 85129)
@@ -13,6 +13,16 @@
'grok.tests.view.unassociated': index. Define view classes inheriting from
grok.View to enable the template(s).
+Also templates of modules named equally as the package name the module
+resides in, should be found without error or warning. We check this
+with the local package `modequalspkgname`::
+
+ >>> warnings.warn = warn
+
+ >>> pkg = __name__.rsplit('.', 1)[0] + '.modequalspkgname'
+ >>> grok.testing.grok(pkg) is None
+ True
+
>>> warnings.warn = saved_warn
"""
More information about the Checkins
mailing list