[Grok-dev] Grok API

Santiago Videla santiago.videla at gmail.com
Sun Sep 16 20:04:37 EDT 2007


Thanks luciano,

two questions:

1) How do you run the zope server in dev mode and how do you bind it to
other port ?? I installed grok with easy_install. I put write the line
"devmode on"
in parts/zopectl/zope.conf but nothing happend

2) I have a simple app to add, edit and delete some content (an example
found here http://wiki.zope.org/zope2/GrokExample). I want to add a button
in the forms to cancel the operation and redirect to other page without make
any changes

I don't understand how it works grok.AddForm and grok.EditForm. It seems
that it validate the form before the action take place, so i can leave that
page if there are errors in the form

Here is my add form

class AddInvoice(grok.AddForm):
    grok.context(InvoiceTracker)
    form_fields = grok.AutoFields(Invoice)

    @grok.action("Add invoice")
    def add(self, **data):
        invoice = Invoice()
        self.applyData(invoice, **data)
        name = str(data['date']) + '-' + data['ffrom']
        self.context[name] = invoice
        self.redirect(self.url(self.context))

    @grok.action("Cancel")
    def cancel(self, **data):
        self.redirect(self.url(self.context))

and the edit

class EditInvoice(grok.EditForm):
    grok.context(Invoice)
    grok.name ('edit')
    form_fields = grok.AutoFields(Invoice)

    @grok.action("Save")
    def save(self, **data):
        self.applyChanges(self,**data)
        self.redirect(self.url(self.context ))

    @grok.action("Cancel")
    def cancel(self, **data):
        self.redirect(self.url(self.context))

help please!!

On 9/16/07, Luciano Ramalho <luciano at ramalho.org> wrote:
>
> On 9/16/07, Santiago Videla <santiago.videla at gmail.com> wrote:
> > I'm trying grok these days.
> >
> > I'm wondering if there is an API somewhere, I couldn't find it yet
>
>
> Welcome, Santiago!
>
> If you have Grok version 0.10 (the latest), start you app and take a
> look at this URL in your machine:
>
> http://localhost:8080/docgrok/
>
> Also, I recommend that you browse everything with a .txt extension in
> the grok source tree. Most of them are doctest files trying out the
> Grok API in different ways.
>
> Soon you'll want to use the wider Zope 3 API also. The advice about
> looking into the .txt files also applies (even more in the case of
> Zope 3, actually). And if you run a Zope 3 server in dev mode you can
> read it's API docs locally at:
>
> http://localhost:8099/++apidoc++
>
> (the default port is 8080, but I got in the habit of running a Zope 3
> server just to read the docs, so I bind it to a different port).
>
> Some of us in the Grok community think the entire Grok and Zope 3 API
> docs should be online, where Google would find it and where we could
> contribute with comments and code snippets. This is one of the aims of
> the upcoming Neandertal Grok sprint.
>
> Cheers,
>
> Luciano
>
>
> On 9/16/07, Santiago Videla <santiago.videla at gmail.com> wrote:
> > Hi there,
> >
> > I'm trying grok these days.
> >
> > I'm wondering if there is an API somewhere, I couldn't find it yet
> >
> > thanks in advace
> >
> > --
> > Santiago Videla
> >  www.revolucionesweb.com.ar
> >
> > Sigue la mata dando de que hablar siempre abajo y a la izquierda donde
> el
> > pensamiento que se hace corazón resplandece con la palabra sencilla y
> > humilde que l at s tod at s somos.
> > _______________________________________________
> > Grok-dev mailing list
> > Grok-dev at zope.org
> > http://mail.zope.org/mailman/listinfo/grok-dev
> >
> >
>



-- 
Santiago Videla
www.revolucionesweb.com.ar

Sigue la mata dando de que hablar siempre abajo y a la izquierda donde el
pensamiento que se hace corazón resplandece con la palabra sencilla y
humilde que l at s tod at s somos.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20070916/b7bed421/attachment.htm


More information about the Grok-dev mailing list