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

Leonardo Rochael Almeida leorochael at gmail.com
Thu Mar 27 11:43:39 EDT 2008


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.jolicoeur 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-objects-tutorial/tutorial-all-pages
>  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-dev at zope.org
>  http://mail.zope.org/mailman/listinfo/grok-dev
>


More information about the Grok-dev mailing list