Aubin Paul wrote: > On Mon, Dec 22, 2003 at 10:43:51AM +0100, Dirk Meyer wrote: >> I was thinking of adding move/delete/copy functions to the item >> itself, based in self.files. If someone (like the gphoto plugin) needs >> different functions to do this, the functions can be >> overwritten. Maybe also bool functions to check if moving is possible >> (e.g. if self.media: copy == true, move, delete == false. > > Sounds logical enough... no objections here...
After some thinking, what about not adding it to the Item, but adding a new object with the fileops. This seems to be a cleaner way. class FileOps: def __init__(self): self.files = [] # the _media_ files itself self.image = '' # the image self.fxdfile = '' # fxd files from which created the item self.movable = True def copy(self, destdir) def move(self, destdir) def delete(self, metadata_only=False) And than class MediaItem(Item): def __init__(self, ...): Item.__init__(...) self.fielops = FileOps() IMHO this is cleaner because it seperates the file operations from the item itself (item already has a fuction copy). The image and fxdfile attricbutes in FileOps are _not_ the same as in the item itself. E.g. when you have an image for a specific file, it's in the FileOps because it needs to be copied, too. If it's only an image inherited from the parent (e.g. folder.fxd), fileops.image is None. Than we have a clean way to delete all metadata (image and fxdfile) and everything needed (files, image and fxdfile). The only thing I don't like is the name FileOps. Other suggestions are shutils (based on shutils.py), or files, or mediafiles. But I don't like that very much. Better ideas? RFC Dischi -- Smash forehead on keyboard to continue..... ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ Freevo-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-cvslog