[Grok-dev] Multiple Model Issue

Tim Cook timothywayne.cook at gmail.com
Sun Nov 2 04:46:04 EST 2008


Brandon & Leo,

Thanks for your replies.   

Leo - no I do not have any instances inside the application.  I haven't
gotten a View to work yet much less an addForm :-)

Brandon - your suggestion http://localhost:8080/b/bindex makes sense
because I am trying to create an in memory instance from the class
definition and that is what the context is set to.  However, I get the
same page not found error.    

The containers section of the tutorial seems as though I should get a
clue from it.  But, like most tutorials it is based on a pretty simple
example and I just can't make the connection to what I am trying to do.
This section of the tutorial has the user adding an instance directly
from the main application index.pt  

I will (eventually) need to render a page that creates in memory
instances of several classes so they can be added to the application in
the ZODB.  

Are there any examples like this?  

The best place to find more help on traversal as it seems to be where my
trouble is coming from?

Thanks,
Tim





On Fri, 2008-10-31 at 18:09 -0200, Leonardo Rochael Almeida wrote:
> Or possibly
> 
> On Fri, Oct 31, 2008 at 17:58, Brandon Craig Rhodes
> <brandon at rhodesmill.org> wrote:
> > Tim Cook <timothywayne.cook at gmail.com> writes:
> >
> >> ---------------------------------------------
> >> import grok
> >>
> >> from q.w.e import B  # class B inherits from grok.Model
> >>
> >> class A(grok.Application,grok.Container):
> >>    pass
> >>
> >> class Index(grok.View):
> >>    pass
> >>
> >>
> >> class BIndex(grok.View):
> >>    grok.context(B)
> >>    grok.template('bindex')  # though this should be automatic?
> >> ---------------------------------------------
> >>
> >> In the app_templates folder I have:
> >>
> >> index.pt and bindex.pt
> >>
> >> the url http://localhost:8080/a  works as expected.
> >>
> >> the url http://localhost:8080/a/bindex gives me a Zope error:
> >> The page that you are trying to access is not available
> >
> > Umm... that's because a bindex wraps b's, not a's, right?  The URL that
> > should work would be:
> >
> > http://localhost:8080/b/bindex
> 
> Or possibly
> 
> http://localhost:8080/a/b/bindex
> 
> Assuming you have a "B" instance called "b" contained inside "a",
> which we assume is an instance of "A".
> 
> Cheers, Leo
-- 
Timothy Cook, MSc
Health Informatics Research & Development Services
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook 
Skype ID == timothy.cook 
**************************************************************
*You may get my Public GPG key from  popular keyservers or   *
*from this link http://timothywayne.cook.googlepages.com/home*
**************************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20081102/b9cf193e/attachment.bin 


More information about the Grok-dev mailing list