[Grok-dev] Re: Trying to wrap my head around GROK

want_to_grok_grok s.jolicoeur at gmail.com
Sat Mar 29 23:01:07 EDT 2008


Found the information I was looking for, it leeds to more questions
but I want to leave a written trace of this, so here's my
understanding of things :
When grokproject creates the skeleton for the app It build one
container to which we can attach any other container by a dict-like
structure : "self['contacts'] = Contacts()" ( I was trying the
self.contacts form and it wasn't yielding proper results). Now to have
the container behave like a "folder" one has to create an index view
for it and it's associated template file, while setting the
"grok.context(Contact)" and "grok.name('index')".

Now this works, but I hope it's the proper grok way.

Thank you for the helpful hand :).

Stephane

NB:  comming from Rails and Django I can say  that tutorials
facilitated the adoption of those frameworks for me, I hope to see
more from Grok other than the simple ones.



On Mar 29, 6:47 pm, want_to_grok_grok <s.jolico... at gmail.com> wrote:
> Where can I find example code of an actual multi-container grok app ?
> (searching for grok example doesn't yield the most precise
> results :P )
>
> Sould Contact(grok.Conatiner): implement grok.context('Sample') ?
>
> On Mar 27, 11:43 am, "Leonardo Rochael Almeida" <leoroch... at gmail.com>
> wrote:
>
> > The first thing you need to understand about URLs in Grok (and in Zope
> > in general), is that URLs map to content, with the last segment of the
> > URL either mapping to the content itself, or to a view that has the
> > content as its "context".
>
> > So, if your simple app stored contents directly within it, and now you
> > want to store your contacts under a URL called ".../contacts", then
> > the simplest way to accomplish this is to have Container subclass
> > (let's call it ContactContainer), store it on your Application with
> > the name "contacts", and putting your contacts inside it. Your view
> > for adding contacts then needs to have ContactContainer as its context
> > instead of having your Application subclass.
>
> > Does the above make sense to you?
>
> > On Thu, Mar 27, 2008 at 1:13 AM, want_to_grok_grok
>
> > <s.jolico... at gmail.com> wrote:
> > > Hi,
>
> > >  I am trying to figure out how GROK works and how it can fit in my
> > >  toolbox of webframeworks. Now I followed the tutorial and it was all
> > >  good and dandy, well almost I hit two walls  : the automated forms for
> > >  the  models ( how can I add css or other decorations to them ? and is
> > >  it possible to have them partially rendered inside another view or am
> > >  I stuck in doing some javascript iframes ? ) and then it was when I
> > >  wanted to complexify the urls as to not have them  start from the app
> > >  such as "/app/<entry name>" but as  "/app/contacts/<entry name >". Now
> > >  I've found information on Traverse, but I don't seem to be able to get
> > >  it to work. Can I create a container that will be inside the main
> > >  application container ?  I tried the tutorial at :
> > >  http://grok.zope.org/documentation/tutorial/navigating-to-transient-o...
> > >  but for some reason I get traversal errors and no means to get to the
> > >  root app : "- __traceback_info__: (<natural.app.Index object at
> > >  0x37a5370>, 'badnum', [])
> > >  TraversalError: (<natural.app.Index object at 0x37a5370>, 'badnum') "
>
> > >  Is there a simple way to define URLs ? (I am thinking Django url.py or
> > >  Pylons routes)
> > >  are there other tutorials like of how to make a blog or something with
> > >  deep urls ?
> > >  also how does one have grok answer to / and not /app ?
>
> > >  Thank in advance for any help,
>
> > >  Stephane
> > >  _______________________________________________
> > >  Grok-dev mailing list
> > >  Grok-... at zope.org
> > >  http://mail.zope.org/mailman/listinfo/grok-dev
>
> > _______________________________________________
> > Grok-dev mailing list
> > Grok-... at zope.orghttp://mail.zope.org/mailman/listinfo/grok-dev
>
> _______________________________________________
> Grok-dev mailing list
> Grok-... at zope.orghttp://mail.zope.org/mailman/listinfo/grok-dev


More information about the Grok-dev mailing list