[Zope] modifying objectValues from an external method?

2000-11-15 Thread Bowyer, Alex

You may remember I have posted a couple of times about problems I have had
with manage_delObjects to delete a news article object from a news page
which contains several child news article objects.

I thought I would try and avoid the problem and make a Python method to
remove the item. This method takes the list of articles (i.e. objectValues)
and does the deletion on the parameter passed in.

The problem I have is, objectValues doesn't seem to exist at Python level,
only at DTML level. So instead of:

dtml-call "my_delete_function(objectValues)"

which is not valid, I have to use:

dtml-let my_list=objectValues
  dtml-call "my_delete_function(my_list)"
/dtml-let

The problem with this is that even though the parameter is passed by
reference, the changes are only being done to my_list and not passed back to
objectValues. So I lose them once my_list is out of scope.

Can anyone suggest an alternative or a workaround? I thought about returning
the modified list from the function, but DTML provides no functionality to
set objectValues equal to this result.

Any help would be appreciated!

Thanks

Alex

==
Alex Bowyer
IT Contractor, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==

___
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] modifying objectValues from an external method?

2000-11-15 Thread Randall Kern

dtml-call expr="manage_delObjects(ids=objectIds())"

Place this in a DTML method, and it will remove all the sub-objects in the
folder you call it on.

Example:

Create a folder "Test".  In that folder, create a DTML method called
remove_all, and put the DTML from above in it.  Then create another Folder
inside Test called "Lossy".  Create some random stuff you don't mind losing
into this new folder.

Open your browser, and goto http://yourserverhere/Test/Lossy/remove_all

Go back to the manage interface, and notice that all that stuff you didn't
mind losing is gone.

-Randy
- Original Message -
From: "Bowyer, Alex" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 15, 2000 9:53 PM
Subject: [Zope] modifying objectValues from an external method?


 You may remember I have posted a couple of times about problems I have had
 with manage_delObjects to delete a news article object from a news page
 which contains several child news article objects.

 I thought I would try and avoid the problem and make a Python method to
 remove the item. This method takes the list of articles (i.e.
objectValues)
 and does the deletion on the parameter passed in.

 The problem I have is, objectValues doesn't seem to exist at Python level,
 only at DTML level. So instead of:

 dtml-call "my_delete_function(objectValues)"

 which is not valid, I have to use:

 dtml-let my_list=objectValues
   dtml-call "my_delete_function(my_list)"
 /dtml-let

 The problem with this is that even though the parameter is passed by
 reference, the changes are only being done to my_list and not passed back
to
 objectValues. So I lose them once my_list is out of scope.

 Can anyone suggest an alternative or a workaround? I thought about
returning
 the modified list from the function, but DTML provides no functionality to
 set objectValues equal to this result.

 Any help would be appreciated!

 Thanks

 Alex

 ==
 Alex Bowyer
 IT Contractor, Logica Australasia
 Tel: +61 2 9202 8130
 Fax: +61 2 9922 7466
 E-mail : [EMAIL PROTECTED]
 WWW: http://www.logica.com.au/
 ==

 ___
 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 )