[Grok-dev] extended the grok evaluation section

Sebastian Ware sebastian at urbantalk.se
Thu Apr 17 18:42:44 EDT 2008


Excellent update!

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 would suggest a slightly more elaborate version that allows  
for some (although admittedly limited) experimentation at least:

import grok
class HelloWorld(grok.Application, grok.Model):
   msg = "GROK HELLO WORLD!"

class Index(grok.View):
   def update(self):
     self.randomThoughts = "I can do some stuff in the update method  
before the view is rendered."

# The PageTemplate could also be moved to a separate file such as
# app_templates/index.pt
index = grok.PageTemplate(
"""
<html>
   <body>
     <p tal:content="context/msg">Hello world message goes here...</p>
     <p tal:content="view/randomThoughts">Random thoughts go here...</p>
   </body>
</html>
""")

Mvh Sebastian

17 apr 2008 kl. 21.20 skrev Martijn Faassen:

> Hi there,
>
> As several people requested (and Peter Bengtsson even blogged about: http://www.peterbe.com/plog/what-i-like-and-dislike-about-grok) 
> , I've integrated my reply to Jonathan Ellis into the grok.zope.org  
> website.
> Editing this text so it's ready for the web took quite a bit of time  
> as I have different standards for text on the website than I have  
> for email here, but it's there now.
>
> You can find the new bits in the evaluation section, here:
>
> http://grok.zope.org/about/hard-earned-wisdom-and-a-lot-of-building-blocks
>
> http://grok.zope.org/about/components
>
> http://grok.zope.org/about/component-architecture
>
> http://grok.zope.org/about/competition
>
> Volunteers can help! Especially the 'components' article could be  
> updated with a lot of hyperlinks to the components in question.  
> Either link to the cheeseshop page if that offers documentation, or  
> lacking that, for now directly link to the best doctests in  
> svn.zope.org.
>
> If you find problems with the text, please fix the typos and bad  
> grammar right away. If you have ideas on how to improve the content,  
> let's discuss it here.
>
> Hopefully now Peter has nothing to dislike about Grok anymore. :)
>
> 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