Re: [Zope] expiring dtml documents

2000-11-21 Thread wade naveja

this is great!  i'll give this - or something similar - a try in the near
future.

in know that zope has a reputation for less than cohesive documentation,
but can someone point me in the direction of some zope api documentation?

On Sun, 19 Nov 2000, Cees de Groot wrote:

 
 [EMAIL PROTECTED] said:
  any insight as to how one might code something like that? 
 
 Document traversal is a simple recursive Python function - with one call to 
 objectValues on a folder you can extract all documents (and iterate over them, 
 check their creation date, remove them if necessary); with a second call to 
 objectValues you get all subfolders and recurse into them.
 
 objectValues matches on meta type, which is 'Folder' for a folder, and 'DTML 
 Method' for a DTML method. So you'd get something like:
 
 def expire(folder):
   for i in self.objectItems('DTML Method'):
   id = i[0]; value = i[1]
   if value.bobobase_modification_time()  """now minus two weeks""":
   # remove i. Maybe tricky because you're iterating
   # and removing from a collection. check. 
   folder.manage_delObjects(id)
   for i in folder.objectValues('Folder'):
   expire(i)
 
 Add this as a Python method (or similar) to the top-level folder where you 
 want to expire, and kicking it off is as simple as a HTTP GET from a cron job 
 (I think there's a job scheduler for Zope as well, should make it even easier).
 
 Disclaimer: untested, untested, and I never tried this out.


___
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] expiring dtml documents

2000-11-21 Thread Dieter Maurer

wade naveja writes:
  this is great!  i'll give this - or something similar - a try in the near
  future.
  
  in know that zope has a reputation for less than cohesive documentation,
  but can someone point me in the direction of some zope api documentation?
The ZQR (Zope Quick Reference; search on zope.org or zdp.zope.org)
or press the help button in your Zope 2.2.2 management screens.


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] expiring dtml documents

2000-11-19 Thread Cees de Groot


[EMAIL PROTECTED] said:
 any insight as to how one might code something like that? 

Document traversal is a simple recursive Python function - with one call to 
objectValues on a folder you can extract all documents (and iterate over them, 
check their creation date, remove them if necessary); with a second call to 
objectValues you get all subfolders and recurse into them.

objectValues matches on meta type, which is 'Folder' for a folder, and 'DTML 
Method' for a DTML method. So you'd get something like:

def expire(folder):
for i in self.objectItems('DTML Method'):
id = i[0]; value = i[1]
if value.bobobase_modification_time()  """now minus two weeks""":
# remove i. Maybe tricky because you're iterating
# and removing from a collection. check. 
folder.manage_delObjects(id)
for i in folder.objectValues('Folder'):
expire(i)

Add this as a Python method (or similar) to the top-level folder where you 
want to expire, and kicking it off is as simple as a HTTP GET from a cron job 
(I think there's a job scheduler for Zope as well, should make it even easier).

Disclaimer: untested, untested, and I never tried this out.


-- 
Cees de Groot   http://www.cdegroot.com [EMAIL PROTECTED]
GnuPG 1024D/E0989E8B 0016 F679 F38D 5946 4ECD  1986 F303 937F E098 9E8B



___
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] expiring dtml documents

2000-11-19 Thread Dieter Maurer

wade naveja writes:
  i maintain a zope server that collects several hundred dtml documents per
  day.  there is a need to have dtml documents removed 2 weeks after they
  are created.  any suggestions on how to go about doing this?
You find them with "ZopeFind" (- built-in API documentation),
and delete them with "manage_delObjects" (- built-in API documentation)
(you may need nested "ZopeFind"s as "manage_delObjects" is a folder
method).

You can automate this be an external script (- HowTo on zope.org).


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] expiring dtml documents

2000-11-18 Thread Cees de Groot

wade naveja [EMAIL PROTECTED] said:
i maintain a zope server that collects several hundred dtml documents per
day.  there is a need to have dtml documents removed 2 weeks after they
are created.  any suggestions on how to go about doing this?

I'd make a cron job that kicks off a bit of code inside Zope every night; let
the code walk the tree and expire old documents. 

With ZEO you should be able to do this directly from a Python script.

-- 
Cees de Groot   http://www.cdegroot.com [EMAIL PROTECTED]
GnuPG 1024D/E0989E8B 0016 F679 F38D 5946 4ECD  1986 F303 937F E098 9E8B

___
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] expiring dtml documents

2000-11-18 Thread wade naveja

any insight as to how one might code something like that?

On 18 Nov 2000, Cees de Groot wrote:

 wade naveja [EMAIL PROTECTED] said:
 i maintain a zope server that collects several hundred dtml documents per
 day.  there is a need to have dtml documents removed 2 weeks after they
 are created.  any suggestions on how to go about doing this?
 
 I'd make a cron job that kicks off a bit of code inside Zope every night; let
 the code walk the tree and expire old documents. 
 
 With ZEO you should be able to do this directly from a Python script.
 
 -- 
 Cees de Groot   http://www.cdegroot.com [EMAIL PROTECTED]
 GnuPG 1024D/E0989E8B 0016 F679 F38D 5946 4ECD  1986 F303 937F E098 9E8B
 
 ___
 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 )