[Grok-dev] Re: understanding martian

Martin Aspeli optilude at gmx.net
Thu Jul 3 14:56:53 EDT 2008


Santiago Videla wrote:
> Hi there,
> 
> I'm trying to understand the martian and grokkers idea. I want to find a 
> way to build some components that could be useful to build custom web 
> apps, using ExtJS for the client side
> 
> The user (developer) should be able to do something like this:
> 
> class ClientsWorkspace(ExtJSONView):
>     context(my_application)
>     listing('clients') #the id of the container
>     
>     listing_fields(['name','email',]) #columns for the ExtJSGrid
> 
>     #Configuration for the main panel
>     default_view('addform') #a view that return a ExtForm in JSON format
>     bind_url('editclient') #the view that will return the JSON to show 
> on click event
>  
> 
> Writing that, I want to auto generate an extJS grid, that list all the 
> contents on the container, and on click over each record, you can edit 
> that record in a form, or add a new record to the container. I already 
> did this just usign grok.JSON and grok.View, but I was thinking on 
> something more generic and reusable.
> 
> Finally, is martian and grokkers what I'm looking for? maybe it's not 
> enough information, and besides that, my english is very short... sorry

I think you could use a grokker for some of that - certainly if you need 
to generate some data structures or view registrations. I'd probably 
look to push some of it into a base class, though, and I'd look to write 
a reasonably generic client side view.

One thing that strikes me in your example is that not everything needs 
to be a directive - variables will do. For example, I'd do

  listing_fields = ['name', 'email']

rather than

  listing_fields(['name', 'email'])

you don't need to be too clever. :)

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Grok-dev mailing list