[Checkins]
SVN: grok/branches/ksmith_mcweekly-layers/src/grok/meta.py
viewlets behave more like views, in-class templates work
Kevin Smith
kevin at mcweekly.com
Fri Apr 27 20:17:48 EDT 2007
Log message for revision 74873:
viewlets behave more like views, in-class templates work
Changed:
U grok/branches/ksmith_mcweekly-layers/src/grok/meta.py
-=-
Modified: grok/branches/ksmith_mcweekly-layers/src/grok/meta.py
===================================================================
--- grok/branches/ksmith_mcweekly-layers/src/grok/meta.py 2007-04-27 21:13:57 UTC (rev 74872)
+++ grok/branches/ksmith_mcweekly-layers/src/grok/meta.py 2007-04-28 00:17:45 UTC (rev 74873)
@@ -151,6 +151,8 @@
% (factory, template_name, factory_name),
factory)
+ factory_template = getattr(factory, 'template', None)
+
if template:
if (getattr(factory, 'render', None) and not
util.check_subclass(factory, components.GrokForm)):
@@ -163,6 +165,8 @@
templates.markAssociated(template_name)
factory.template = template
+ elif factory_template and isinstance(factory_template, (components.PageTemplate, components.PageTemplateFile)):
+ pass
else:
if not getattr(factory, 'render', None):
# we do not accept a view without any way to render it
@@ -652,13 +656,15 @@
% (factory, template_name, factory_name),
factory)
+ factory_template = getattr(factory,'template', None)
+
if template:
- # FIXME: this logic needs to be changed
if (getattr(factory, 'render', None) and not
util.check_subclass(factory, components.GrokForm) and not
util.check_subclass(factory, components.Viewlet)):
# we do not accept render and template both for a view
- # (unless it's a form, they happen to have render.
+ # (unless it's a form, they happen to have render.)
+ # Forms currently not implemented in viewlets.
raise GrokError(
"Multiple possible ways to render view %r. "
"It has both a 'render' method as well as "
@@ -666,6 +672,8 @@
templates.markAssociated(template_name)
factory.template = template
+ elif factory_template and isinstance(factory_template, (components.PageTemplate, components.PageTemplateFile)):
+ pass
else:
if not getattr(factory, 'render', None):
# we do not accept a view without any way to render it
More information about the Checkins
mailing list