[Grok-dev] Grok-dev Digest, Vol 86, Issue 1

Paul Sephton prsephton at gmail.com
Tue Aug 19 12:52:29 CEST 2014


Sorry, I just read what I wrote and it makes no sense to me- never mind
anyone else:

"*A grok.Component, and classes inheriting from it implement an IContainer,
and because of the ContainerTraverser implementing an ITraverser for an
IContainer, we "magically" get the ContainerTraverser implementation for
grok.Container instances.*"

That should be:

- A grok.Container, and derived classes, implement IContainer
- ContainerTraverser is an adapter which provides an ITraverser interface
for IContainer instances
- So when we need to traverse a container, we find the traverser by asking
the component architecture for an ITraverser(context) where the context is
a container instance.

To override the behaviour, we can create our own adapter:

class MyTraverser(grok.Adapter):
  grok.context(IContainer)
  grok.implements(ITraverser)
  ....

which effectively replaces the original traverser for containers.  Although
I query your need for doing so.

*Disclaimer*
Please note: I am not an expert here and it is entirely possible that I
have the wrong end of the stick.





On Tue, Aug 19, 2014 at 12:40 PM, Paul Sephton <prsephton at gmail.com> wrote:

> Hi, Christopher,
>
> I cannot claim to be certain of what you are getting at, but to the best
> of my understanding you are proposing two things:
> a) A change to the traverser method for the IContainer and IContext
> interfaces
> b) Some default javascript/jquery added which automates AJAX queries for
> URL's containing '#'.
>
> Did I get this part right?
>
> You mentioned that you are unsure as to why IContainer and IContext have
> ContainerTraverser and ContextTraverser as two separate classes.  Well, how
> I understand it, is that the component architecture is the big
> differentiator here.  A grok.Component, and classes inheriting from it
> implement an IContainer, and because of the ContainerTraverser implementing
> an ITraverser for an IContainer, we "magically" get the ContainerTraverser
> implementation for grok.Container instances.
>
> I do not believe you would need to change the grok source to override the
> traverser behaviour.  You can simply derive a new interface from IContainer
> or IContext and implement an adapter for it.  (*If I am wrong here, can
> someone correct me?*)
>
> Of course, you can also just implement a class inheriting grok.Traverser
> with a grok.context(your model or container), but you probably already know
> about this and it's not what you are after, right?
>
> My personal feeling about frameworks with "built-in" javascript is that it
> gets ugly pretty quickly.  I like the fact that if I need to use Javascript
> or AJAX the framework itself does not implement any of that.  For example,
> since JQueryMobile already uses '#' in URL's to handle AJAX pages, your use
> of '#' as well would clash.  It's actually a rather horrible approach to
> identifying AJAX views IMO.
>
> It's not actually all that hard to implement AJAX specific areas of your
> site, and I don't like being prescribed by a framework as to the method I
> must use to figure out which parts of the site are AJAX loadable.
> Personally, I add an 'AjaxLoad' class to divs which must be populated, and
> add a 'ref' attribute containing a view reference.  My JQuery runs through
> the page looking for div.classname and sets up event handlers for the AJAX
> areas.
>
> Have fun,
> Paul
>
>
> On Wed, Aug 13, 2014 at 12:00 PM, <grok-dev-request at zope.org> wrote:
>
>> Send Grok-dev mailing list submissions to
>>         grok-dev at 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-request at zope.org
>>
>> You can reach the person managing the list at
>>         grok-dev-owner at 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 <lozinski at freerecruiting.com>
>> To: grok-dev at 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 <http://zopache.com/HumanFactors#preview>
>>
>>
>>   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-dev at zope.org
>> https://mail.zope.org/mailman/listinfo/grok-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/grok-dev/attachments/20140819/b9d1ff8b/attachment-0001.html>


More information about the Grok-dev mailing list