[Zope] Re: Writing a python script
azazel
azazel at lizard.homelinux.net
Fri May 14 16:20:34 EDT 2004
Il ven, 2004-05-14 alle 17:27, Joseph Kocherhans ha scritto:
> http://docs.python.org/modindex.html
yes, you have 2 ways to resolve your problem,
1) you can use cron (unix system service) and a python script to
schedule and selectively delete your files directly from the filesystem.
In this case you should start as Joseph told you, by looking into the
standard os and os.path python modules;
2) you can use a Zope Python Script; in this case, you should loop over
the files of a given folder and check the that of every file in the
folder, delting them appropriately:
##parameters= folder, date
# i suppose that date is a DateTime object if not, uncomment next line
#date = DateTime(date)
# obtain a list containing only PloneExternalFiles
files = folder.objectItems('Plone External File')
# loop over the file list
for id, file in files:
mod_date = DateTime (file.getFileModDate())
if mod_date < Date:
# delete it
folder.manage_delObjects(id)
You should however have a look at the DateTime module into zope's help,
as i don't know how the date coming from the PloneExternalFile is
formatted and maybe it needs some adjustements ;-)
azazel
More information about the Zope
mailing list