[Grok-dev] Lying user warnings with shared template dirs

Uli Fouquet uli at gnufix.de
Sat Jan 30 06:41:56 EST 2010


Hi there,

When one defines a template dir on module level that is shared (or not
shared) with another module, grokcore.views template registry easily
emits a user warning:

 ...UserWarning: Found the following unassociated template(s) when 
 grokking 'cave': food.  Define view classes inheriting from
 grok.View to enable the template(s)

If, for better orientation, you decide to put all templates for all
modules in, say, a `template/` dir, by::

  grok.templatedir('templates')

you easily get tons of false alerts of the above type. And there is no
way to go around these warnings (at least none that I know).

This is confusing and even a lie, when a certain template was associated
with a class from another module than the one currently grokked.

The real solution would, of course, be to grok all modules first, and
then decide, which templates have really no associated view. This,
however, would require a complete different 'grokking-workflow'.

A quick workaround would, however, be to disable the above messages for
modules that explicitly set the template dir. Templates in a shared
template dir that have no associate wouldn't emit a warning then, but
warnings for other templates would be surpressed.

I'd love to implement the latter in grokcore.view, but would like to get
your opinions first.

Best regards,

-- 
Uli

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20100130/0197a90d/attachment.bin 


More information about the Grok-dev mailing list