[Checkins] SVN: grok/trunk/src/grok/ Added a test for the
deprecation warning.
Lennart Regebro
regebro at gmail.com
Thu Nov 8 08:28:00 EST 2007
Log message for revision 81603:
Added a test for the deprecation warning.
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 13:07:09 UTC (rev 81602)
+++ grok/trunk/src/grok/components.py 2007-11-08 13:28:00 UTC (rev 81603)
@@ -154,7 +154,7 @@
warnings.warn("Calling macros directly on the view is deprecated. "
"Please use context/@@viewname/macros/macroname\n"
"View %r, macro %s" % (self, key),
- DeprecationWarning)
+ DeprecationWarning, 1)
return value
Modified: grok/trunk/src/grok/ftests/view/macros.py
===================================================================
--- grok/trunk/src/grok/ftests/view/macros.py 2007-11-08 13:07:09 UTC (rev 81602)
+++ grok/trunk/src/grok/ftests/view/macros.py 2007-11-08 13:28:00 UTC (rev 81603)
@@ -29,7 +29,21 @@
<html>
Curry
</html>
+
+You can skip the "macro" part of the macro call, but this is deprecated:
+ >>> from zope.deprecation.tests import warn
+ >>> import warnings
+ >>> saved_warn = warnings.warn
+ >>> warnings.warn = warn
+
+ >>> browser.open("http://localhost/manfred/@@burnt")
+ From tests.py's showwarning():
+ ... DeprecationWarning: Calling macros directly on the view is deprecated. Please use context/@@viewname/macros/macroname
+ ...
+
+ >>> warnings.warn = saved_warn
+
"""
import grok
@@ -84,6 +98,13 @@
<html metal:use-macro="context/@@grilled/macros/spices">
</html>""")
+class Burnt(grok.View):
+ pass
+
+burnt = grok.PageTemplate("""\
+<html metal:use-macro="context/@@grilled/spices">
+</html>""")
+
class Grilled(grok.View):
pass
@@ -91,3 +112,4 @@
<html metal:define-macro="spices">
Curry
</html>""")
+
More information about the Checkins
mailing list