[Grok-dev] documentation issue wrt megrok.layout

Roger Erens roger.erens at e-s-c.biz
Tue Mar 30 10:06:23 EDT 2010


Thanks for explaining. Souheil.

While we're at it, could you also explain when to use megrok.layout
and when to use viewlets inside viewletmanagers that are placed in a
main template? Or is this documented somewhere? The pypi page of
megrok.layout is more about the 'how' and not so much about the
'why'...

Cheers,

Roger

On Tue, Mar 30, 2010 at 14:43, Souheil CHELFOUH <trollfot at gmail.com> wrote:
> Hello,
>
> The readme of megrok.layout is indeed very synthetic.
> The grok_component is declaring in the globals of the testing machinery.
> It comes from : grokcore.component.testing
>
> It's not detailed because this process is done at start time by Grok, normally.
>
> 2010/3/30 Roger Erens <roger.erens at e-s-c.biz>:
>> Hi,
>>
>> in a Grokv1.0 project I start up bin/python-console and execute the
>> commands as found on
>> http://pypi.python.org/pypi/megrok.layout:
>>
>>    >>> from megrok.layout import Layout
>>    >>> from zope.interface import Interface
>>    >>> import grokcore.component as grok
>>    >>> class MyLayout(Layout):
>>    ...     grok.name('mylayout')
>>    ...     grok.context(Interface)
>>    ...
>>    ...     def render(self):
>>    ...         return u"a simple layout"
>>
>> We grok our component:
>>
>>    >>> grok_component('MyLayout', MyLayout)
>>    True
>>
>> But I don't get True as a result but:
>>
>> Traceback (most recent call last):
>>  File "<console>", line 1, in <module>
>> NameError: name 'grok_component' is not defined
>>
>> I'm still too much of a newbie to know what 'grokking our component'
>> is supposed to do, therefore:
>>
>> what should be used instead of :func:`grok_component()`? Or do I need
>> to import something else, too?
>>
>> Cheers,
>>
>> Roger
>> _______________________________________________
>> Grok-dev mailing list
>> Grok-dev at zope.org
>> https://mail.zope.org/mailman/listinfo/grok-dev
>>
>
>


More information about the Grok-dev mailing list