[Grok-dev] Zopache

Christopher Lozinski lozinski at freerecruiting.com
Wed Aug 20 16:18:13 CEST 2014


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.

So you are right that my overly long response was a bit confusing. 
Thanks for the feedback, that is why I write.  So here is what I did not
say.  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.  And some python based templating
languages, right now mint. 
Later Jinja2 and Page Templates.  I may do the tree of objects
representing a person, on the file system in python.  Or maybe in
ZClasses.I will see.

I have already put up about 10 model classes in grok.  As well as custom
traverser and parental acquisition.  So I do understand it.  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. 
(Which I do not yet have, but guess will need to add soon).  Way way
easier for simple projects.  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.  It hugely helps me understand what I am
doing.  It is strange, here I am working by myself, but with so much
information up on the web for everyone to see.

Chris

.







On 8/20/14, 3:32 PM, Paul Sephton wrote:
> 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.
>
> 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.
>
> In regard to your case for "Parental Acquisition", I think it's really
> a lot simpler to implement than you imagine.
>
> 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.
>
> 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.
>
> 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 <http://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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/grok-dev/attachments/20140820/3d326973/attachment.html>


More information about the Grok-dev mailing list