The src directory is where all necessary files and templates will be. Initially, there is only app.py (the main class, our application) and the templates.

Here's my try in mapping grok's stuff to zope2's products et all.

In grok the app.py, is our application. In grok, app.py is it. We can add more grok.Model (the content type), or grok.Container (Folderish object) and make use of grok.View to set the Views or presentation.

In zope2, we can have many products that we tie with Script (Python), External Methods, ZSQL Methods, etc to make an application. And we have to create site (application) TTW by making use of Products and other objects.

The site I'm trying to replace has a list of simple contents with a these attributes:

nama
hint
jawab
soalan

Now, to my first basic grok app.py:

import grok
class tekateki(grok.Application, grok.Container):
pass
#this is our app. everything else hangs of this. it's an Application and Container
class ttEntry(grok.Model):
def __init__(self, soalan, jawab, hint, nama):
self.nama = nama
self.hint = hint
self.jawab = jawab
self.soalan = soalan
#here's my content type. in zope2, i have a productwith these attribs. in grok, we still have it, subclassed of grok.Model
class SampleIndex(grok.View):
grok.context(tekateki)
grok.name('index')
#here's our main view, the site's default index_html (it ties to the tekateki app). we can call it anything we want (grok.name('index.html'))
def update(self, name=None, soalan=None, jawab=None, hint=None, nama=None):
if name is None or nama is None or soalan is None or jawab is None:
return
print nama
self.context[name] = ttEntry(soalan, jawab, hint, nama)
#update will be like our constructor/method in zope2 product. XXX correct me here
class DelIndex(grok.View):
grok.context(tekateki)
grok.name('delete')
def update(self, name=None):
if name is None:
return
del self.context[name]
#update will be like our constructor/method in zope2 product. XXX correct me here. a form will have its action tied to delete, and update will do the necessary. for views to work, we need to have the PT in app_templates with the same name as the class, but lowercase
#def render(self):
# self.redirect(self.url(self.context))
class EntryIndex(grok.View):
grok.context(ttEntry)
grok.name('index')
#this is our model's default index (tied to ttEntry - our model). we can call it anything (grok.name('index.html')). if we don't tie this calss to anything, the default will be the calssname, lowercased

This is the first step for me in the journey grokking grok. Next, I will look at using formlib and schema.

There's a great grok primer and seeing it, I see my journey will take some time :P