Thanks for the reply. I am using the iTools python library from http://hforge.org (http://git.hforge.org/) and the data is stored as XML files.
On Sat, Jun 6, 2009 at 1:02 PM, Kent Johnson<[email protected]> wrote: > On Sat, Jun 6, 2009 at 5:04 AM, Norman Khine<[email protected]> wrote: >> Hello, >> I would like help to design the following: >> http://paste.lisp.org/display/81448 > > Product.get_days() may have a bug, it only returns the first container it > finds. It was an error when I simplified the code for posting on the list. > > You probably don't want the view code in the same class with the data. > It's generally a good idea to separate the model - the representation > of data - from the view - the display of the data. In iTools, each class has a view, edit, state etc... functions depending on the class. > > The get_images() methods are all very similar. If each class had a > get_children() method then you could combine the get_images(). For > example Here is what I wanted to improve on, I will try to combine this as suggested. > > class Product(Folder): > ... > def get_children(self): > children = [ self ] > children.extend(self.get_itinerary()) > children.extend(self.get_days()) > > class Folder(object): > def get_images(self): > images = [] > for child in self.get_children(): > images.extend(child.search_handlers(handler_class=File)) > return images > > You might be able to do something similar with get_days(). > > I wonder why you are not using a database to store all this? I can't > help wondering what the code would look like in Django. > > Kent > Thank you for your feedback Norman _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
