Hi Rein, One of my apps has a similar type of process, in my case scheduling. Entities start life as a 'service request', then become a 'service order', and finally a 'service ticket'. Originally I looked at using PolyModels too; as soon as I noticed the type 'could not' be changed it was clear PolyModel was of extremely limited use. But if you look at the implementation, it is basically just adding a type attribute to the entities, then queries use that type to filter the results.
I found that using an Expando I could implement similar functionality and gain the benefits of an expando. I have experimented with two techniques for doing this. Originally I actually setup classes for each state, similar to a PolyModel except that it could transition from one type to another. In the other I use one common class 'ServiceOrder' that knows its type and how each type should "behave." For my use-case I found the second method is easier to work with. http://code.google.com/appengine/docs/python/datastore/expandoclass.html Just some thoughts. Robert On Sun, Nov 28, 2010 at 11:47, Rein Petersen <[email protected]> wrote: > Hi all, looking for some guidance here... > > I often find myself using inheritance in such a way that it also indicates > state. For example, we might have a PlacedOrder class that will go through > an approval process before it becomes the more specialized ApprovedOrder > class. The ApprovedOrder class is still a PlacedOrder and maintains all the > same attributes while adding a few. > > The problem comes when classes are immutable - you have to create the new > class, copy all the attributes, then destroy the old - thats a drag. I would > much prefer to just change the class type then fill in the outstanding > attributes. Polymodel, to me, seems to be mutable in that way and I just > wanted to get some advice and opinions about it before I charge ahead... > > Thanks in advance, Rein > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
