Hello, i'm writing web-based photo gallery using pylons have the following question: Each photo in gallery have one row in 'photos' table and files on disk (original file and preview).
I have Photo class, mapped to photos table: class Photo(Base): __tablename__ = "photos" id = Column(Integer, primary_key=True) name = Column(Unicode(256)) # relative path to image on the filesystem display_name = Column(Unicode(256)) album_id = Column(Integer, ForeignKey('albums.id')) created = Column(DateTime) width = Column(Integer) height = Column(Integer) hidden = Column(Boolean) I want to put all code for creating and destroying photos to model. So I've to add constructor, for example def __init__(self, path_to_file, display_name, album_id): self.display_name = display_name self.album_id = album_id # analyze file, create preview and fill remaining fields It seems to be working, but should I call Base constructor ? And which argument must be given to it ? The second question is how can i implement destructor, which will be called, when i issue session.delete(photo) ? __del__ will not work, because it called each time the object is destroyed by garbage collector. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.