Re: [Zope] Choose where to create a ZClass instance with EM

2000-08-17 Thread Dieter Maurer

Francois-Regis CHALAOUX writes:
 > Hi,
 > 
 > When I create a ZClass instance from an external Method I create by default
 > the instance in the same place where is located my external method (see the
 > code below).
 > 
 > How to select a different place in my script where will be create the ZClass ?
 > 
 > 
 > Code
 > 
 > 
 > def addZClass(self,id,data):
 >newob=self.Control.Panel.Products.MyProduct.MyClass(id)
 >newob.id=id
 >newob.propertysheets.Properties.manage_changeProperties(data)
 >self._setObject(id,newob)
Here, you decide that the new object is placed into "self".

Use "self.whereever._setObject(id,newob)"
to place it in "whereever".
Of cause, "whereever" must be acquired by "self" for this to work.

You would use "getattr(self,wherever)", if "whereever" is not
a constant name but an expression, e.g. passed in via a parameter.



Dieter

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




Re: [Zope] Choose where to create a ZClass instance with EM

2000-08-17 Thread R. David Murray

On Thu, 17 Aug 2000, Andy McKay wrote:
> Get a handle to the object where you wish to create the object then create
> the object.
> 
> For example: newobj = getattr(self, 'folderA')
> 
> will give you folderA in self. The new object will be created in folderA.

Isn't it actually that he wants to do the _setObject call on object where
he wants the thing to go?:

newob=self.Control.Panel.Products.MyProduct.MyClass(id)
newob.id=id
newob.propertysheets.Properties.manage_changeProperties(data)
getattr(self,'folderA')._setObject(id,newob)
newob.reindex_object()

--RDM


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




Re: [Zope] Choose where to create a ZClass instance with EM

2000-08-17 Thread Andy McKay

Get a handle to the object where you wish to create the object then create
the object.

For example: newobj = getattr(self, 'folderA')

will give you folderA in self. The new object will be created in folderA.
--
 Andy McKay, Developer, ActiveState
 http://www.ActiveState.com
 Programming for the People


- Original Message -
From: "Francois-Regis CHALAOUX"
<[EMAIL PROTECTED]>
To: "Receipt Notification Requested" <[EMAIL PROTECTED]>
Sent: Thursday, August 17, 2000 6:36 AM
Subject: [Zope] Choose where to create a ZClass instance with EM


> Hi,
>
> When I create a ZClass instance from an external Method I create by
default
> the instance in the same place where is located my external method (see
the
> code below).
>
> How to select a different place in my script where will be create the
ZClass ?
>
> 
> Code
> 
>
> def addZClass(self,id,data):
>newob=self.Control.Panel.Products.MyProduct.MyClass(id)
>newob.id=id
>newob.propertysheets.Properties.manage_changeProperties(data)
>self._setObject(id,newob)
>newob.reindex_object()
>
>
> Bye, FR.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ___
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>


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




[Zope] Choose where to create a ZClass instance with EM

2000-08-17 Thread Francois-Regis CHALAOUX

Hi,

When I create a ZClass instance from an external Method I create by default
the instance in the same place where is located my external method (see the
code below).

How to select a different place in my script where will be create the ZClass ?


Code


def addZClass(self,id,data):
   newob=self.Control.Panel.Products.MyProduct.MyClass(id)
   newob.id=id
   newob.propertysheets.Properties.manage_changeProperties(data)
   self._setObject(id,newob)
   newob.reindex_object()


Bye, FR.
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  


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