Re: [Zope-dev] Getting the parent of a container in a Python Script

2001-02-15 Thread Cyril Elkaim

   
   Erik,
 
>What do you need the reference for?  How are you going to use it?  And
>when you're talking about «inside ZODB», does that mean that you're
>not using Zope to access it?

 I'm using Zope but I made up my application by components. So I want
to access an object anywhere in the database even if it's not in the URL path.
Anyway, it's not a big problem for now.


>Shouldn't be a problem.  Also have a look at objectValues(),
>objectIds() and objectItems() in lib/python/OFS/ObjectManager.py;
>around line 320.  They could save you some time.

I'll take a look at it.

Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Getting the parent of a container in a Python Script

2001-02-15 Thread Erik Enge

[Cyril Elkaim]

| I want to give the id (eventually qualified) of an object and get a
| reference to it. I'm talking about persistent objects inside the
| ZODB.

What do you need the reference for?  How are you going to use it?  And
when you're talking about «inside ZODB», does that mean that you're
not using Zope to access it?
 
| For example it should be interesting to walk through the database
| using only DOM methods. Is that the case?

Shouldn't be a problem.  Also have a look at objectValues(),
objectIds() and objectItems() in lib/python/OFS/ObjectManager.py;
around line 320.  They could save you some time.

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Getting the parent of a container in a Python Script

2001-02-15 Thread Cyril Elkaim

   
   Eric,

   Thanks that works :-) And you know what I've tried that before posting
but inside the test tab of my zclass. I should tried it inside the client Folder.

Anyway that's OK.

>I'm not quite sure what you mean, could you elaborate please?  Do you
>mean like you want to search for any object and get a reference
>(kewords: ZCatalog, getobject and searchResults) or just to have a
>HTML link (keywords: relative_url and absolute_url) or what?  :)

  I want to give the id (eventually qualified) of an object and get
a reference to it. I'm talking about persistent objects inside the ZODB.

  A question is the ZODB using the DOM? Because getparentNode() is a DOM method.

  For example it should be interesting to walk through the database using only
DOM methods. Is that the case ? with them I can anywhere I want. I'm using
Mozilla exclusivley and all my Javascript code use the DOM so I will be
'at home'.

Maybe all that questions already answered, sorry if that's the case.

Thanks,
Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Getting the parent of a container in a Python Script

2001-02-15 Thread Tom Jenkins

Do you mean the aq_parent?  I believe that is the property that you want.

Cyril Elkaim wrote:

>Hi all,
> 
> My question is in the title. I think I'm stupid because I have really searched
>  anywhere, and found nothing. The answer is certainly trivial but too many hours
> you know... :-)
> 
> I'm able to get all the children of the current container or context but unable
> to get its parent. Maybe it's silly but a 'parent' property for all the 
> objects seems to me a good idea. Of such a property may already exist but what is
> its name ?
> 
> Of course I have tried REQUEST.PARENTS[0] but this is the parent inside the
> URL, I'm searching the PARENT inside the object system.
> 
> Another question how can I get a reference of any object in OBJECT system,
> I've tried unrestrictedTraverse but it seems very 'restrictive' :-)
> 
> Aside from my problems Zope rocks really.
> 
> Thanks in advance
> Cyril
> 
> ___
> Zope-Dev maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Getting the parent of a container in a Python Script

2001-02-15 Thread Erik Enge

[Cyril Elkaim]

| Of course I have tried REQUEST.PARENTS[0] but this is the parent
| inside the URL, I'm searching the PARENT inside the object system.

yourobject.getParentNode() should do the trick.

Have a read at lib/python/OFS/ZDOM.py
 
| Another question how can I get a reference of any object in OBJECT
| system,

I'm not quite sure what you mean, could you elaborate please?  Do you
mean like you want to search for any object and get a reference
(kewords: ZCatalog, getobject and searchResults) or just to have a
HTML link (keywords: relative_url and absolute_url) or what?  :)

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Getting the parent of a container in a Python Script

2001-02-15 Thread Morten W. Petersen

[Cyril Elkaim]

|Hi all,

Hia Cyril,

[snip]

| Aside from my problems Zope rocks really.

Yes it does.  And you can find usable information in
$ZOPE_INSTANCE/lib/python/OFS/ZDOM.py .

Hope this helps,

Morten

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] Getting the parent of a container in a Python Script

2001-02-15 Thread Cyril Elkaim


   Hi all,

My question is in the title. I think I'm stupid because I have really searched
 anywhere, and found nothing. The answer is certainly trivial but too many hours
you know... :-)

I'm able to get all the children of the current container or context but unable
to get its parent. Maybe it's silly but a 'parent' property for all the 
objects seems to me a good idea. Of such a property may already exist but what is
its name ?

Of course I have tried REQUEST.PARENTS[0] but this is the parent inside the
URL, I'm searching the PARENT inside the object system.

Another question how can I get a reference of any object in OBJECT system,
I've tried unrestrictedTraverse but it seems very 'restrictive' :-)

Aside from my problems Zope rocks really.

Thanks in advance
Cyril

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )