Send Grok-dev mailing list submissions to
grok...@zope.org
To subscribe or unsubscribe via the World Wide Web, visit
https://mail.zope.org/mailman/listinfo/grok-dev
or, via email, send a message with subject or body 'help' to
grok-dev...@zope.org
You can reach the person managing the list at
grok-de...@zope.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Grok-dev digest..."
Today's Topics:
1. Grok.traverser Code Documentation Feedback and proposal.
(Christopher Lozinski)
---------- Forwarded message ----------
From: Christopher Lozinski <lozi...@freerecruiting.com>
To: grok...@zope.org
Cc:
Date: Tue, 12 Aug 2014 20:15:38 +0300
Subject: [Grok-dev] Grok.traverser Code Documentation Feedback and proposal.
I put up three web pages about grokcore.traverser.
Here is my page documenting the source code.
http://zopache.com/Grokcore.traverserCodeDocumentation
Here are my comments about the source code from a Human Factors point of view.
http://zopache.com/HumanFactors
And here is my proposal as to what should be done to improve the code.
http://zopache.com/GrokCoreTraverserProposal
Why am I writing this? Well I am just implementing parental acquisition for Zopache, and so I need
to modify the default traversal software.
I find that documenting software helps me to understand it better. Describing it, crystallizes my
concepts. And other people care, and so they read carefully, and correct any mistakes.
And finally these mailing lists are so quiet, I am sure that many people are happy that something
new, albeit controversial, is happening.
So I invite you to go ahead and read the documentation I wrote, and the comments.
But before you begin, let me say I am just amazed at the brilliance of the People who wrote Grok. I
could never have even imagined this framework, let alone written such high quality bug-free code.
Thank you enormously for those who did it.
And of course if anyone wants to talk to me about what I am doing for Parental Acquisition during
traversal, I am happy to chat privately off of this mailing list.
_______________________________________________
Grok-dev mailing list
Grok...@zope.org
https://mail.zope.org/mailman/listinfo/grok-dev
I think what you are completely missing is the power of marker interfaces; naturally since large site layouts are not really addressed properly in the tutorials.You definitely don't want to modify the framework to get what you want. I would typically implement each discrete model in it's own Python source file.In regard to your case for "Parental Acquisition", I think it's really a lot simpler to implement than you imagine.When I said "...it makes no sense to me..." this was in response to something I had written which in retrospect looked senseless. It tends to happen to me more often with age.Hi, Christopher,Thanks for the lengthy reply. Although I cannot yet say that I fully understand what you are trying to say, I think I understand enough for a response.
Let's see:
/index
/Content
/ContactInfo/Content
/SubmitResume/Content
/PostJob/Content
/Resumes/Content
/Jobs/Content
/Home
import grok
from zope.component import Interface
class IContent(Interface):
""" Marker Interface for Content """
class ContentIndex(grok.View):
""" Things that implement IContent will get this view """
grok.context(IContent)
grok.name('index')
def render(self):
""" Renders content from the current context, which we are assured
implements the model for an IContent.
"""
class ISite(Interface):
""" Marker Interface for main site index """
class Index(grok.View):
""" This view is available for all models which implement ISite """
grok.context(ISite)
def render(self):
""" Renders the site index with all the pretty common bits. Also
includes a <div content="context/Content/@@index" /> to render
the content for the appropriate section.
We could also build our site here using viewlets which is a great
way to go.
"""
class ContentModel(grok.Model):
""" Implements a content model """
grok.implements(IContent)
class ContactInfo(grok.Model):
grok.implements(ISite)
Content = ContentModel()
grok.traversable('Content')
class SubmitResume(grok.Model):
grok.implements(ISite)
Content = ContentModel()
grok.traversable('Content')
class PostJob(grok.Model):
grok.implements(ISite)
Content = ContentModel()
grok.traversable('Content')
class Resumes(grok.Model):
grok.implements(ISite)
Content = ContentModel()
grok.traversable('Content')
class Jobs(grok.Model):
grok.implements(ISite)
Content = ContentModel()
grok.traversable('Content')
class Home(grok.Model):
grok.implements(ISite)
class MainApp(grok.Container):
grok.implements(ISite)
def __init__(self):
super(MainApp, self).__init__()
self["Content"] = ContentModel()
self["ContactInfo"] = ContactInfo()
self["SubmitResume"] = SubmitResume()
self["PostJob"] = PostJob()
self["Resumes"] = Resumes()
self["Jobs"] = Jobs()
self["Home"] = Home()
Hope that helps,
Paul
I took the liberty of attaching your reply to the end of this email.
>I think what you are completely missing is the power of marker interfaces;
Oh I think marker interfaces are brilliant, just what is needed for larger projects, particularly for mult-developer projects. But they add way too much complexity for the simple projects. Much like page templates are brilliant if you are working with graphics designers, but again too much complexity for the stand alone developer.
<snip>... The Zopache computatinoal model is different from the Grok computational model. No marker interfaces. Very little python. Mostly a ZMI where you add objects and fill in some fields.<snip>...
<snip>... Did you see how much code you had to write for all those Content objects. And then adding them all to the application?
In Zopache, just use a GUI the ZMI, add a folder, add an HTML object, and type up the content. Or use some other kind of template for the content, like a mark up object.
<snip>... And so many projects start off small and then grow.
It is not just beginners. Even for the seasoned developer we have way too much complexity overload.
Whatever can be done to simplify our computational models of the world, helps the seasoned developer as much as the novice developer. Maybe more.
Thanks for the dialogue.