[Checkins] SVN: grok/trunk/src/grok/ Got rid of the deprecation
warnings during testing.
Lennart Regebro
regebro at gmail.com
Thu Nov 8 08:07:09 EST 2007
Log message for revision 81602:
Got rid of the deprecation warnings during testing.
Changed:
U grok/trunk/src/grok/components.py
U grok/trunk/src/grok/ftests/view/macros.py
-=-
Modified: grok/trunk/src/grok/components.py
===================================================================
--- grok/trunk/src/grok/components.py 2007-11-08 11:00:03 UTC (rev 81601)
+++ grok/trunk/src/grok/components.py 2007-11-08 13:07:09 UTC (rev 81602)
@@ -147,13 +147,16 @@
# This is BBB code for Zope page templates only:
if not isinstance(self.template, PageTemplate):
raise AttributeError("View has no item %s" % key)
+
+ value = self.template._template.macros[key]
# When this deprecation is done with, this whole __getitem__ can
# be removed.
warnings.warn("Calling macros directly on the view is deprecated. "
- "Please use view/@@viewname/macros/macroname\n"
+ "Please use context/@@viewname/macros/macroname\n"
"View %r, macro %s" % (self, key),
DeprecationWarning)
- return self.template._template.macros[key]
+ return value
+
def url(self, obj=None, name=None):
# if the first argument is a string, that's the name. There should
Modified: grok/trunk/src/grok/ftests/view/macros.py
===================================================================
--- grok/trunk/src/grok/ftests/view/macros.py 2007-11-08 11:00:03 UTC (rev 81601)
+++ grok/trunk/src/grok/ftests/view/macros.py 2007-11-08 13:07:09 UTC (rev 81602)
@@ -50,7 +50,7 @@
pass
painting = grok.PageTemplate("""\
-<html metal:use-macro="context/@@layout/main">
+<html metal:use-macro="context/@@layout/macros/main">
<div metal:fill-slot="slot">
GROK SLOT!
</div>
@@ -73,7 +73,7 @@
pass
dancing = grok.PageTemplate("""\
-<html metal:use-macro="context/@@dancinghall/something">
+<html metal:use-macro="context/@@dancinghall/macros/something">
</html>
""")
@@ -81,7 +81,7 @@
pass
grilldish = grok.PageTemplate("""
-<html metal:use-macro="context/@@grilled/spices">
+<html metal:use-macro="context/@@grilled/macros/spices">
</html>""")
class Grilled(grok.View):
More information about the Checkins
mailing list