Re: [ZODB-Dev] How can I append Persistent mechanism to OrderedDict class ?
Le 30/01/2011 12:12, Vincent Pelletier a écrit : Le dimanche 30 janvier 2011 09:52:32, Stéphane Klein a écrit : How can I append Persistent mechanism to this OrderedDict class ? You should probably read the code for PersistentMapping[1] and adapt it to OrderedDict's API. [1] http://svn.zope.org/ZODB/trunk/src/persistent/mapping.py?rev=113734view=markup Hi, I'll try that : from collections import OrderedDict from persistent import Persistent class PersistentOrderedDict(OrderedDict, Persistent): pass but I've this error : TypeError: Error when calling the metaclass bases multiple bases have instance lay-out conflict Then, I can't do like persistent.mapping.PersistentMapping class PersistentMapping(UserDict.IterableUserDict, persistent.Persistent) I need to create PersistentOrderedDict that need to be a proxy class over OrderedDict, and a child on Persistent ? Regards, Stephane -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev
Re: [ZODB-Dev] How can I append Persistent mechanism to OrderedDict class ?
Le 16/09/2011 10:07, Stéphane Klein a écrit : Le 30/01/2011 12:12, Vincent Pelletier a écrit : Le dimanche 30 janvier 2011 09:52:32, Stéphane Klein a écrit : How can I append Persistent mechanism to this OrderedDict class ? You should probably read the code for PersistentMapping[1] and adapt it to OrderedDict's API. [1] http://svn.zope.org/ZODB/trunk/src/persistent/mapping.py?rev=113734view=markup Hi, I'll try that : from collections import OrderedDict from persistent import Persistent class PersistentOrderedDict(OrderedDict, Persistent): pass but I've this error : TypeError: Error when calling the metaclass bases multiple bases have instance lay-out conflict Then, I can't do like persistent.mapping.PersistentMapping class PersistentMapping(UserDict.IterableUserDict, persistent.Persistent) I need to create PersistentOrderedDict that need to be a proxy class over OrderedDict, and a child on Persistent ? I've just created this class, what do you about ? from collections import OrderedDict from persistent import Persistent class PersistentOrderedDict(Persistent): def __init__(self, *args, **kwds): self.__data = OrderedDict(*args, **kwds) def __setitem__(self, key, value, PREV=0, NEXT=1, dict_setitem=dict.__setitem__): res = self.__data.__setitem__(key, value, PREV=0, NEXT=1, dict_setitem=dict.__setitem__) self._p_changed = 1 return res def __delitem__(self, key, PREV=0, NEXT=1, dict_delitem=dict.__delitem__): res = self.__data.__delitem__(key, PREV=0, NEXT=1, dict_delitem=dict.__delitem__) self._p_changed = 1 return res def __iter__(self, NEXT=1, KEY=2): return self.__data.__iter__(NEXT=1, KEY=2) def __reversed__(self, PREV=0, KEY=2): return self.__data.__reversed__(PREV=0, KEY=2) def __reduce__(self): return self.__data.__reduce__() def clear(self): return self.__data.clear() def setdefault(self, key, default=None): if key in self.__data: return self.__data[key] self.__data[key] = default self._p_changed = 1 return default def update(self, other): res = self.__data.update(other) self._p_changed = 1 return res def pop(self, key, default=None): res = self.__data.pop(key, default) self._p_changed = 1 return res def keys(self): return self.__data.keys() def values(self): return self.__data.values() def items(self): return self.__data.items() def iterkeys(self): return self.__data.iterkeys() def itervalues(self): return self.__data.itervalues() def iteritems(self): return self.__data.iteritems() def __ne__(self, other): return self.__ne__(other) def viewkeys(self): return self.__data.viewkeys() def viewvalues(self): return self.__data.viewvalues() def viewitems(self): return self.__data.viewitems() def popitem(self, last=True): return self.__data.popitem(last=last) def __repr__(self): return self.__data.__repr__() def copy(self): return self.__data.copy() @classmethod def fromkeys(cls, iterable, value=None): return OrderedDict.fromkeys(iterable, value) def __eq__(self, other): return self.__data.__eq__(other) -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev
Re: [ZODB-Dev] I would like to know if api exists nowadays to get list of all objects which where modified in a transaction ?
Le 26/07/2011 09:55, Stéphane Klein a écrit : Hi, some time ago, someone ask how to get list of all objects which where modified in a transaction : http://article.gmane.org/gmane.comp.web.zope.zodb/5734 Jim Fulton said « there isn't a public API for this ». I would like to know if this api exists nowadays ? No idea ? -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev
[ZODB-Dev] I would like to know if api exists nowadays to get list of all objects which where modified in a transaction ?
Hi, some time ago, someone ask how to get list of all objects which where modified in a transaction : http://article.gmane.org/gmane.comp.web.zope.zodb/5734 Jim Fulton said « there isn't a public API for this ». I would like to know if this api exists nowadays ? Regards, Stephane -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev
[ZODB-Dev] TypeError: unbound method beforeCompletion() must be called with Synchronizer instance as first argument (got Transaction instance instead)
Hi, I've this in my source code : from zope.interface import implements from transaction.interfaces import ISynchronizer class Synchronizer(object): implements(ISynchronizer) def beforeCompletion(self, transaction): print(beforeCompletion) def afterCompletion(self, transaction): print(afterCompletion, transaction) def newTransaction(self, transaction): print(newTransaction, transaction) ... transaction.manager.registerSynch(Synchronizer) ... transaction.commit() and I've this error message : TypeError: unbound method beforeCompletion() must be called with Synchronizer instance as first argument (got Transaction instance instead) I don't understand, my Synchronizer class match API. Thanks for your help. Regards, Stephane -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev
Re: [ZODB-Dev] TypeError: unbound method beforeCompletion() must be called with Synchronizer instance as first argument (got Transaction instance instead)
Le 26/07/2011 13:58, Alexandru Plugaru a écrit : Hi Stéphane, I think you create an issue here: https://github.com/cguardia/ZODB-Documentation (or maybe even fix the example) Ok, I've fixed the code and executed an pull request on github. https://github.com/harobed/ZODB-Documentation/commit/2895e66b7195cd888122b83184258fc01328890f Regards, Stephane -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev
[ZODB-Dev] What is ConflictError: database conflict error (oid 0x01, class core.content_resource.ContentRootFolder) ?
Hi, I've this error message with ZODB : ConflictError: database conflict error (oid 0x01, class core.content_resource.ContentRootFolder) How can I fix it ? Regards, Stephane -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev
[ZODB-Dev] I would like append an indexer with uuid key at root of my ZODB, how can I append an function to commit event to update this uuid catalog ?
Hi, I use ZODB to record some Resources. All my Resources have an uuid field. All work well but I would like append a BTree to ZODB root object to index uuid of all my resources. I would like record to this BTree index only Resources commited to ZODB database. How can I connect a function to commit event ? In this function, how can I found all object modified ? How can I found all object removed to the database ? Other question : are there already a package to perform this task ? Thanks for your help, Stephane -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev
Re: [ZODB-Dev] I would like append an indexer with uuid key at root of my ZODB, how can I append an function to commit event to update this uuid catalog ?
Le 28/06/2011 10:21, Thierry Florac a écrit : I use ZODB to record some Resources. All my Resources have an uuid field. All work well but I would like append a BTree to ZODB root object to index uuid of all my resources. I would like record to this BTree index only Resources commited to ZODB database. How can I connect a function to commit event ? In this function, how can I found all object modified ? How can I found all object removed to the database ? Other question : are there already a package to perform this task ? The matching package is zope.catalog. It provides all you need (catalog and indexes) to handle your task. Objects creations and modifications are followed automatically by several subscribers as soon as this package is correctly registered. z3c.catalog and hurry.query packages can be good extensions packages to look at... In repoze.catalog documentation, I read : Note that when you call index_doc, you pass in a docid as the first argument, and the object you want to index as the second argument. When we index the peach object above we index it with the docid 1. Each docid must be unique within a catalog; when you query a repoze.catalog catalog, you’ll get back a sequence of document ids that match the query you supplied, which you’ll presumably need to map back to the content object in order to make sense of the response; you’re responsible for keeping track of which objects map to which document id yourself. Url : http://docs.repoze.org/catalog/overview.html#indexing you’re responsible for keeping track of which objects map to which document id yourself. = it is this part I would like to implement. Regards, Stephane -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev
Re: [ZODB-Dev] I would like append an indexer with uuid key at root of my ZODB, how can I append an function to commit event to update this uuid catalog ?
Le 28/06/2011 11:25, Pedro Ferreira a écrit : you’re responsible for keeping track of which objects map to which document id yourself. = it is this part I would like to implement. Maybe this will help: http://static.repoze.org/catalogdocs/overview.html#indexing It's the same doc that I send in my previous mail. -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev
Re: [ZODB-Dev] I would like append an indexer with uuid key at root of my ZODB, how can I append an function to commit event to update this uuid catalog ?
Le 28/06/2011 13:13, Thierry Florac a écrit : In repoze.catalog documentation, I read : Note that when you call index_doc, you pass in a docid as the first argument, and the object you want to index as the second argument. When we index the peach object above we index it with the docid 1. Each docid must be unique within a catalog; when you query a repoze.catalog catalog, you’ll get back a sequence of document ids that match the query you supplied, which you’ll presumably need to map back to the content object in order to make sense of the response; you’re responsible for keeping track of which objects map to which document id yourself. Url : http://docs.repoze.org/catalog/overview.html#indexing you’re responsible for keeping track of which objects map to which document id yourself. = it is this part I would like to implement. This last part is handled by zope.intid package, which is used internally by zope.catalog. When a persistent IntId utility has been created and registered, you can do what you need : - get a unique ID (an integer) for a given object (when persisted !) - get an object for a given ID I'm not in zope environment, I use Pyramid + ZODB. Can I use easily this tools in my context ? Regards, Stephane -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev
[ZODB-Dev] How can I append Persistent mechanism to OrderedDict class ?
Hi, I would like to use a Persistent Ordered dict. I use OrderedDict (http://pypi.python.org/pypi/ordereddict). How can I append Persistent mechanism to this OrderedDict class ? Thanks for your help. Regards, Stephane -- Stéphane Klein steph...@harobed.org blog: http://stephane-klein.info Twitter: http://twitter.com/klein_stephane pro: http://www.is-webdesign.com ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev