All pastes #249010 Raw Edit

Cody Brocious

public python v1 · immutable
#249010 ·published 2006-11-15 08:16 UTC
rendered paste body
#!/usr/bin/env python# encoding: utf-8"""queryableModel.pyCreated by  on 2006-11-14.Copyleft (c) 2006 Cody Brocious All rights reversed."""from interface import interfacefrom model import modelclass queryableModel(model):    @interface.public    def query(self, rule):        # Create object of the same type as self for result        result = self.__class__()                for child in self.children:            if rule(child):                result.childAdd(child)                return result        @interface.public    def __repr__(self):        return `self.children`