[Grok-dev] Using z3c.template in Grok
trollfot at gmail.com
Fri Jan 8 05:56:16 EST 2010
Your usecase sounds like a common use case I solved using a simple megrok.menu
What's so limited about it, in your case ?
For the folders listing, I can advise you to use a simple viewlet with
some logic to retrieve the objects.
The home link can be solved with megrok.menu by doing a redirection view
The link to the admin page would be a simple menuitem protected with a
permission on the admin has.
For examples, you can have a look at dolmen.app.layout and
dolmen.app.authentication (this one is on the git)
dolmen.menu is still under construction, I'm not sure where I want it to go
Since it sparkled few if no interest at all, i'm left on my own for
making a spec up :)
2010/1/8 Jeroen Michiel <jmichiel at yahoo.com>:
> Thanks for the reply!
> The only reason I'd need z3c.template to work in grok is because I use
> However, if there is a dolmen.menu that works with megrok.pagetemplate, I'm
> very interested to try that one out!
> My general use case is this:
> First of all, I see as a 'menu' everything that concerns site navigation,
> going from page to page from a central place, except from breadcrumbs.
> My app has a few containers containing different objects I would like to be
> easily accessible.
> What I would like is a top bar menu that is that is visible on all pages
> - a menuitem with a link to the site's home
> - a menuitem for each (or most) container which folds out and shows links
> to (the index view of) each item in those containers.
> - a menuitem with a link to the admin page(s), which is only visible if you
> log in as admin
> Then I would like a context-sensitive menu on the left showing the different
> things you can do on the current context (like the megrok.menu package can
> I believe this is a fairly typical use case.
> dolmen.menu is not yet on the PyPI, so I'd have to get it from Git, right?
> Is it already usable, or still under heavy construction?
> Thanks again, you took away a great deal of my confusion!
> Souheil CHELFOUH wrote:
>> Hello there,
>> As i'm the author or megrok.layout and megrok.pagetemplate and a
>> maintainer of megrok.menu, i'll respond to your interrogations, as I
>> got them myself, before coding it.
>> I took the deliberate choice, with Sylvain Viollon, to move away from
>> pagelets because I think they are limited and complex, while
>> megrok.layout is simplier and as a real "Layout" component to work
>> As we did this, I tried to keep the pluggability idea behind
>> z3c.layout and z3c.templates, by introduction megrok.pagetemplates.
>> I chose also not to depend on z3c.templates and all this, because they
>> are unneeded dependencies and they are too tightly linked to take only
>> the interesting bit out of it.
>> Stephan Richter and I already had a discussion on the mailing list
>> concerning this matter and my point of view didn't change.
>> megrok.layout and megrok.pagetemplate are independant bits that can
>> work together. They are simple and based directly on grokcore
>> components and/or zope packages
>> It is my will to keep these sane, small, and independant.
>> Extending megrok.pagetemplate with your own package is probably the saner
>> However, we already have a menu initiative in the Dolmen project, and
>> we try to build a new package that would resolve grok people's usecase
>> about menus.
>> If you feel like you can share your usecase, we can maybe work out
>> something together. In a wider approach, if you can share your global
>> usecase, maybe we can find solutions.
>> I started a new package called "dolmen.menu", to experiment things.
>> - Souheil
>> 2010/1/8 Jeroen Michiel <jmichiel at yahoo.com>:
>>> I'm wondering if there is a grok-version of z3c.template around
>>> I rummaged around on PyPI, but I'm a bit confused.
>>> Let me first tell you what I'm actually trying to do:
>>> I tried to refactor my current site layout from a macro-based thing to
>>> pagelet based, and I wanted to use z3c.menu.ready2go instead of
>>> as the latter seems too restricted for my purposes.
>>> For the layout part, I found megrok.layout and megrok.pagelet. Both seem
>>> basically do the same. But as megrok.pagelet is only at version 0.1, and
>>> megrok.layout at 0.9 (and more recent) I figured megrok.layout is the way
>>> Does megrok.pagelet have any advantage/different use case over
>>> megrok.layout? If not, shouldn't it be better to mark it deprecated? It
>>> states to be 'z3c.template / z3c.layout support for Grok', but that seems
>>> incorrect, because I don't find anything like z3c.template in there.
>>> For the menu's, I started to use z3c.menu.ready2go, and got it working.
>>> However, it uses z3c.template to register it's templates. It works out of
>>> the box, but now I want to override the template used for the menu items
>>> (item.pt) with my own (because I want to use a YUI menu), and that's
>>> where I
>>> would need an easy way to register a template in grok, the z3c.template
>>> I noticed a package called megrok.pagetemplate (based on
>>> that already does the basics, but it only knows an IPageTemplate, while
>>> z3c.template has derived IContentTemplate and ILayoutTemplate from that,
>>> z3c.menu.ready2go looks up an IContentTemplate for the item template.
>>> So what are my options here? Extend megrok.pagetemplate to support
>>> IContentTemplate and ILayoutTemplate (or is there someone who would want
>>> do this for me ;-) )? Do some dirty adapter registrations myself?
>>> I'm a bit clueless, here, so any advice is welcome!
>>> View this message in context:
>>> Sent from the Grok mailing list archive at Nabble.com.
>>> Grok-dev mailing list
>>> Grok-dev at zope.org
>> Grok-dev mailing list
>> Grok-dev at zope.org
> View this message in context: http://old.nabble.com/Using-z3c.template-in-Grok-tp27072769p27074086.html
> Sent from the Grok mailing list archive at Nabble.com.
> Grok-dev mailing list
> Grok-dev at zope.org
More information about the Grok-dev