> BTW: Adam, how do I search with the tag mixins for the objects that > are tagged with "A", "B", "C" and "D"? // just curious because I > implemented some tagging to my app the other day and didn't use the > solution you used.
I didn't have this use case accoutned for directly in taggable-mixin, but it really ought to be there. It could be accounted for simply in the get_tag_by_value method. The method should check to see if the incoming parameter is a list, and if it is, query for all of the elements in the list. I'll make sure that gets in to the next release. BTW, a new release, with many improvements is already on its way. On Nov 19, 9:48 am, "Moritz Angermann" <[EMAIL PROTECTED]> wrote: > Sorry for adding confustion to this buy why does Chained inheritance not work? > > class Commentable(db.Model): > def put(...): ... # if some create/modify logic is needed > def delete(...): ... # if some delete magic is needed (trash comments?) > comments_counter = db.IntegerProperty(required=True, defualt=0) > > class Post(Commentable): > title = db.StringProperty(required=True) > body = db.TextProperty(required=True) > added = db.DateProperty(auto_add_now=True) > > this is perfectly readable and sould do pretty much what was asked for. > > Am I missing something? > > BTW: Adam, how do I search with the tag mixins for the objects that > are tagged with "A", "B", "C" and "D"? // just curious because I > implemented some tagging to my app the other day and didn't use the > solution you used. > > regards, > Moritz > > On Wed, Nov 19, 2008 at 10:07 PM, Adam <[EMAIL PROTECTED]> wrote: > > > Not that anyone cares, but the metaclass approach did not work, as > > Python doesn't want to have two non-identical metaclasses in an > > inheritance chain. Or something. > > > On Nov 18, 10:42 am, Adam <[EMAIL PROTECTED]> wrote: > >> It just occurred to me that this solution could be made much easier by > >> using a simple, small metaclass (which, it is worth noting, I totally > >> copped from GAE's PropertiedClass metaclass): > > >> class ModelMixin(type): > >> def __init__(cls, name, bases, dct): > >> super(PropertiedClass, cls).__init__(name, bases, dct) > > >> for attr_name in dct.keys(): > >> attr = dct[attr_name] > >> if isinstance(attr, Property): > >> cls._properties[attr_name] = attr > > >> class Commentable(): > >> __metaclass__ = ModelMixin > > >> comments_counter = db.IntegerProperty(required=True, default=0) > > >> Bada-bing. Now, the ugly nonsense of creating the _properties dict > >> and assigning to it is gone. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---