[Grok-dev] Re: extended the grok evaluation section

Sebastian Ware sebastian at urbantalk.se
Fri Apr 18 03:19:19 EDT 2008


When you look at the HelloWorld you think "this code doesn't do  
anything except return som html" and then you look at Mamoth and it is  
a lot more complicated. The point in my example is that you can see  
what your application really might look like AND it is short and  
trivial to understand.

If we only want it to be trivial, we are better off doing this:

   import grok
   from zope.security.interfaces import IUnauthorized

   class Unauthorized(grok.View):
       grok.context(IUnauthorized)
       grok.name("index.html")

       def render(self):
           return "Hello World!"

Which is a lot more compact and doesn't even require registration of  
the application. Even shows off the component architecture.

Mvh Sebastian

18 apr 2008 kl. 01.23 skrev Martijn Faassen:

> Sebastian Ware wrote:
>> I was looking at the HelloWorld sample code and I don't think it  
>> teaches the casual observer anything about what their first Grok  
>> application might look like. It is simple to the point of almost  
>> being useless.
>
> I think we want it to be simple. The point is that it should look  
> trivial. If people want to see more involved examples they can click  
> on the next few links.
>
> "Hello world" in Zope 3, for instance, needs a bit more explanation,  
> as quite a bit of ZCML is required both to register the view as well  
> as to register the application in a menu.
>
> Regards,
>
> Martijn
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev



More information about the Grok-dev mailing list