extending PersistentList

Lars van Gemerden <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <[email protected]>
Hi,

I have been looking for a way to extend PersistentList in an elegant way. I 
tried overriding the abstract methods in MutableSequence but ofcourds that 
does not work, because UserList overrides all methods in MutableSequence 
(don't know why; speed reasons?).

I also tried this:

class ServerFieldList(PersistentList):

    def __init__(self, items, owner=None):
        super(ServerFieldList, self).__init__(items)
        self.owner = owner

    def _get_changed(self):
        return Persistent._get_changed(self)

    def _set_changed(self, value):
        Persistent._set_changed(self, value)
        self.owner.__dirty__ = True

    def _del_changed(self):
        Persistent._del_changed(self)
        self.owner.__dirty__ = True

    _p_changed = property(_get_changed, _set_changed, _del_changed)



but directly both calling the _get_changed etc methods in Persistent or using super(ServerFieldList, self) gives me an AttributeError, while i can clearly see these methods in Persistent. must have something to do with the @implementer decorator.


Is there anyway to access the _get_changed directly, or any way to get this to work, preferably without extending all methods in PersistentList or UserList?


Cheers, Lars  

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.