[Grok-dev] Multiple Model Issue

Sebastian Ware sebastian at urbantalk.se
Mon Nov 3 08:18:57 EST 2008


Just for the record, I sent Tim an answer which straightened out a  
couple of things for him. He intends to post a short summary in case  
somebody else has the same problem.

Mvh Sebastian

2 nov 2008 kl. 10.46 skrev Tim Cook:

> 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*
> **************************************************************
> _______________________________________________
> 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