[Zope-Checkins] SVN: Zope/trunk/doc/CHANGES.txt no plans to include EPI
Log message for revision 29917: no plans to include EPI Changed: U Zope/trunk/doc/CHANGES.txt -=- Modified: Zope/trunk/doc/CHANGES.txt === --- Zope/trunk/doc/CHANGES.txt 2005-04-08 16:45:42 UTC (rev 29916) +++ Zope/trunk/doc/CHANGES.txt 2005-04-08 16:47:44 UTC (rev 29917) @@ -22,9 +22,7 @@ - Port ZOPE_CONFIG patch from Zope 2.7 to Zope 2.8 - - check if ExtendedPathIndex might be a reasonable replacement for PathIndex - after Zope 2.8a2 Features added ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-epi-integration/ removed
Log message for revision 29916: removed Changed: D Zope/branches/ajung-epi-integration/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex2.py bsd -> zpl
Log message for revision 29915: bsd -> zpl Changed: U Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex2.py -=- Modified: Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex2.py === --- Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex2.py 2005-04-08 15:24:55 UTC (rev 29914) +++ Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex2.py 2005-04-08 15:39:13 UTC (rev 29915) @@ -1,5 +1,5 @@ # Copyright (c) 2004 Zope Corporation and Plone Solutions -# BSD license +# ZPL V 2.1 license import os, sys if __name__ == '__main__': @@ -8,7 +8,7 @@ from Products.PluginIndexes.PathIndex.tests import epitc class TestPathIndex(epitc.PathIndexTestCase): -""" Test ExtendedPathIndex objects """ +""" Test PathIndex objects """ def testEmpty(self): self.assertEqual(self._index.numObjects() ,0) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py fixed __init__()
Log message for revision 29913: fixed __init__() Changed: U Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py -=- Modified: Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py === --- Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2005-04-08 14:15:25 UTC (rev 29912) +++ Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2005-04-08 14:38:37 UTC (rev 29913) @@ -57,12 +57,31 @@ query_options = ("query", "level", "operator", "depth", "navtree") -def ___init__(self,id,caller=None): +def __init__(self, id, extra=None, caller=None): +""" PathIndex supports indexed_attrs """ + +def get(o, k, default): +if isinstance(o, dict): +return o.get(k, default) +else: +return getattr(o, k, default) + self.id = id self.operators = ('or','and') self.useOperator = 'or' self.clear() +attrs = get(extra, 'indexed_attrs', None) +if attrs is None: +return +if isinstance(attrs, str): +attrs = attrs.split(',') +attrs = filter(None, [a.strip() for a in attrs]) + +if attrs: +# We only index the first attribute so snip off the rest +self.indexed_attrs = tuple(attrs[:1]) + def clear(self): self._depth = 0 self._index = OOBTree() @@ -122,27 +141,7 @@ -def __init__(self, id, extra=None, caller=None): -""" ExtendedPathIndex supports indexed_attrs """ -self.___init__( id, caller) -def get(o, k, default): -if isinstance(o, dict): -return o.get(k, default) -else: -return getattr(o, k, default) - -attrs = get(extra, 'indexed_attrs', None) -if attrs is None: -return -if isinstance(attrs, str): -attrs = attrs.split(',') -attrs = filter(None, [a.strip() for a in attrs]) - -if attrs: -# We only index the first attribute so snip off the rest -self.indexed_attrs = tuple(attrs[:1]) - def index_object(self, docid, obj ,threshold=100): """ hook for (Z)Catalog """ ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/ integrated ExtendedPathIndex functionality
Log message for revision 29912: integrated ExtendedPathIndex functionality Changed: U Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py A Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/README.txt A Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/tests/epitc.py A Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/tests/testIndexedAttrs.py A Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex2.py -=- Modified: Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py === --- Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2005-04-08 14:07:42 UTC (rev 29911) +++ Zope/branches/ajung-epi-integration/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2005-04-08 14:15:25 UTC (rev 29912) @@ -55,9 +55,9 @@ 'help': ('PathIndex','PathIndex_Settings.stx')}, ) -query_options = ("query", "level", "operator") +query_options = ("query", "level", "operator", "depth", "navtree") -def __init__(self,id,caller=None): +def ___init__(self,id,caller=None): self.id = id self.operators = ('or','and') self.useOperator = 'or' @@ -87,10 +87,77 @@ if level > self._depth: self._depth = level + +def numObjects(self): +""" return the number distinct values """ +return len(self._unindex) + +def indexSize(self): +""" return the number of indexed objects""" +return len(self) + +def __len__(self): +return self._length() + +def hasUniqueValuesFor(self, name): +"""has unique values for column name""" +return name == self.id + +def uniqueValues(self, name=None, withLength=0): +""" needed to be consistent with the interface """ +return self._index.keys() + +def getEntryForObject(self, docid, default=_marker): +""" Takes a document ID and returns all the information +we have on that specific object. +""" +try: +return self._unindex[docid] +except KeyError: +# XXX Why is default ignored? +return None + + + + + + +def __init__(self, id, extra=None, caller=None): +""" ExtendedPathIndex supports indexed_attrs """ +self.___init__( id, caller) + +def get(o, k, default): +if isinstance(o, dict): +return o.get(k, default) +else: +return getattr(o, k, default) + +attrs = get(extra, 'indexed_attrs', None) +if attrs is None: +return +if isinstance(attrs, str): +attrs = attrs.split(',') +attrs = filter(None, [a.strip() for a in attrs]) + +if attrs: +# We only index the first attribute so snip off the rest +self.indexed_attrs = tuple(attrs[:1]) + def index_object(self, docid, obj ,threshold=100): """ hook for (Z)Catalog """ -f = getattr(obj, self.id, None) +# PathIndex first checks for an attribute matching its id and +# falls back to getPhysicalPath only when failing to get one. +# The presence of 'indexed_attrs' overrides this behavior and +# causes indexing of the custom attribute. + +attrs = getattr(self, 'indexed_attrs', None) +if attrs: +index = attrs[0] +else: +index = self.id + +f = getattr(obj, index, None) if f is not None: if safe_callable(f): try: @@ -100,7 +167,7 @@ else: path = f -if not isinstance(path, (StringType, TupleType)): +if not isinstance(path, (str, tuple)): raise TypeError('path value must be string or tuple of strings') else: try: @@ -108,15 +175,25 @@ except AttributeError: return 0 -if isinstance(path, (ListType, TupleType)): +if isinstance(path, (list, tuple)): path = '/'+ '/'.join(path[1:]) comps = filter(None, path.split('/')) - + +# Make sure we reindex properly when path change +if self._unindex.has_key(docid) and self._unindex.get(docid) != path: +self.unindex_object(docid) + if not self._unindex.has_key(docid): +if hasattr(self, '_migrate_length'): +self._migrate_length() self._length.change(1) for i in range(len(comps)): self.insertEntry(comps[i], docid, i) + +# Add terminator +self.insertEntry(None, docid, len(comps)-1) + self._unindex[docid] = path return 1 @@ -1
[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/ reverting old state - latest EPI integration should have gone a
Log message for revision 29911: reverting old state - latest EPI integration should have gone a branch but no to the trunk Changed: U Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py D Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/README.txt D Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/epitc.py D Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/testIndexedAttrs.py D Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex2.py -=- Modified: Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py === --- Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2005-04-08 13:55:31 UTC (rev 29910) +++ Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2005-04-08 14:07:42 UTC (rev 29911) @@ -55,9 +55,9 @@ 'help': ('PathIndex','PathIndex_Settings.stx')}, ) -query_options = ("query", "level", "operator", "depth", "navtree") +query_options = ("query", "level", "operator") -def ___init__(self,id,caller=None): +def __init__(self,id,caller=None): self.id = id self.operators = ('or','and') self.useOperator = 'or' @@ -87,77 +87,10 @@ if level > self._depth: self._depth = level - -def numObjects(self): -""" return the number distinct values """ -return len(self._unindex) - -def indexSize(self): -""" return the number of indexed objects""" -return len(self) - -def __len__(self): -return self._length() - -def hasUniqueValuesFor(self, name): -"""has unique values for column name""" -return name == self.id - -def uniqueValues(self, name=None, withLength=0): -""" needed to be consistent with the interface """ -return self._index.keys() - -def getEntryForObject(self, docid, default=_marker): -""" Takes a document ID and returns all the information -we have on that specific object. -""" -try: -return self._unindex[docid] -except KeyError: -# XXX Why is default ignored? -return None - - - - - - -def __init__(self, id, extra=None, caller=None): -""" ExtendedPathIndex supports indexed_attrs """ -self.___init__( id, caller) - -def get(o, k, default): -if isinstance(o, dict): -return o.get(k, default) -else: -return getattr(o, k, default) - -attrs = get(extra, 'indexed_attrs', None) -if attrs is None: -return -if isinstance(attrs, str): -attrs = attrs.split(',') -attrs = filter(None, [a.strip() for a in attrs]) - -if attrs: -# We only index the first attribute so snip off the rest -self.indexed_attrs = tuple(attrs[:1]) - def index_object(self, docid, obj ,threshold=100): """ hook for (Z)Catalog """ -# PathIndex first checks for an attribute matching its id and -# falls back to getPhysicalPath only when failing to get one. -# The presence of 'indexed_attrs' overrides this behavior and -# causes indexing of the custom attribute. - -attrs = getattr(self, 'indexed_attrs', None) -if attrs: -index = attrs[0] -else: -index = self.id - -f = getattr(obj, index, None) +f = getattr(obj, self.id, None) if f is not None: if safe_callable(f): try: @@ -167,7 +100,7 @@ else: path = f -if not isinstance(path, (str, tuple)): +if not isinstance(path, (StringType, TupleType)): raise TypeError('path value must be string or tuple of strings') else: try: @@ -175,25 +108,15 @@ except AttributeError: return 0 -if isinstance(path, (list, tuple)): +if isinstance(path, (ListType, TupleType)): path = '/'+ '/'.join(path[1:]) comps = filter(None, path.split('/')) - -# Make sure we reindex properly when path change -if self._unindex.has_key(docid) and self._unindex.get(docid) != path: -self.unindex_object(docid) - + if not self._unindex.has_key(docid): -if hasattr(self, '_migrate_length'): -self._migrate_length() self._length.change(1) for i in range(len(comps)): self.insertEntry(comps[i], docid, i) - -# Add terminator -self.insertEntry(None, docid, len(comps)-1) - self._unindex[docid] = path return 1 @@ -201,17 +124,15 @@ """ hook for (Z)Catalog """ if not self._unindex.has_key(docid): -LOG.error('Attempt to unindex nonexistent document' -
[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/ integrated ExtendedPathIndex functionality without
Log message for revision 29909: integrated ExtendedPathIndex functionality without changing the existing behaviour (at least the original unittests pass). Changed: U Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py A Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/README.txt A Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/epitc.py A Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/testIndexedAttrs.py U Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py A Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex2.py -=- Modified: Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py === --- Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2005-04-08 13:05:35 UTC (rev 29908) +++ Zope/trunk/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 2005-04-08 13:51:58 UTC (rev 29909) @@ -55,9 +55,9 @@ 'help': ('PathIndex','PathIndex_Settings.stx')}, ) -query_options = ("query", "level", "operator") +query_options = ("query", "level", "operator", "depth", "navtree") -def __init__(self,id,caller=None): +def ___init__(self,id,caller=None): self.id = id self.operators = ('or','and') self.useOperator = 'or' @@ -87,10 +87,77 @@ if level > self._depth: self._depth = level + +def numObjects(self): +""" return the number distinct values """ +return len(self._unindex) + +def indexSize(self): +""" return the number of indexed objects""" +return len(self) + +def __len__(self): +return self._length() + +def hasUniqueValuesFor(self, name): +"""has unique values for column name""" +return name == self.id + +def uniqueValues(self, name=None, withLength=0): +""" needed to be consistent with the interface """ +return self._index.keys() + +def getEntryForObject(self, docid, default=_marker): +""" Takes a document ID and returns all the information +we have on that specific object. +""" +try: +return self._unindex[docid] +except KeyError: +# XXX Why is default ignored? +return None + + + + + + +def __init__(self, id, extra=None, caller=None): +""" ExtendedPathIndex supports indexed_attrs """ +self.___init__( id, caller) + +def get(o, k, default): +if isinstance(o, dict): +return o.get(k, default) +else: +return getattr(o, k, default) + +attrs = get(extra, 'indexed_attrs', None) +if attrs is None: +return +if isinstance(attrs, str): +attrs = attrs.split(',') +attrs = filter(None, [a.strip() for a in attrs]) + +if attrs: +# We only index the first attribute so snip off the rest +self.indexed_attrs = tuple(attrs[:1]) + def index_object(self, docid, obj ,threshold=100): """ hook for (Z)Catalog """ -f = getattr(obj, self.id, None) +# PathIndex first checks for an attribute matching its id and +# falls back to getPhysicalPath only when failing to get one. +# The presence of 'indexed_attrs' overrides this behavior and +# causes indexing of the custom attribute. + +attrs = getattr(self, 'indexed_attrs', None) +if attrs: +index = attrs[0] +else: +index = self.id + +f = getattr(obj, index, None) if f is not None: if safe_callable(f): try: @@ -100,7 +167,7 @@ else: path = f -if not isinstance(path, (StringType, TupleType)): +if not isinstance(path, (str, tuple)): raise TypeError('path value must be string or tuple of strings') else: try: @@ -108,15 +175,25 @@ except AttributeError: return 0 -if isinstance(path, (ListType, TupleType)): +if isinstance(path, (list, tuple)): path = '/'+ '/'.join(path[1:]) comps = filter(None, path.split('/')) - + +# Make sure we reindex properly when path change +if self._unindex.has_key(docid) and self._unindex.get(docid) != path: +self.unindex_object(docid) + if not self._unindex.has_key(docid): +if hasattr(self, '_migrate_length'): +self._migrate_length() self._length.change(1) for i in range(len(comps)): self.insertEntry(comps[i], docid, i) + +# Add terminator +self.insertEntry(None, docid, len(comps)-1) + self._unindex[docid] = path return 1 @@ -124,15 +201,17 @@ """ hook for (Z)Catalog "
[Zope-Checkins] SVN: Zope/branches/ajung-epi-integration/ Trying to marry PathIndex with ExtendedPathindex
Log message for revision 29908: Trying to marry PathIndex with ExtendedPathindex Changed: A Zope/branches/ajung-epi-integration/ -=- Copied: Zope/branches/ajung-epi-integration (from rev 29907, Zope/trunk) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/ZClasses/_pmc.txt Synced up up with persistentclass.txt from ZODB, which was
Log message for revision 29904: Synced up up with persistentclass.txt from ZODB, which was originally derived from this test. Changed: U Zope/trunk/lib/python/ZClasses/_pmc.txt -=- Modified: Zope/trunk/lib/python/ZClasses/_pmc.txt === --- Zope/trunk/lib/python/ZClasses/_pmc.txt 2005-04-07 23:48:40 UTC (rev 29903) +++ Zope/trunk/lib/python/ZClasses/_pmc.txt 2005-04-08 10:08:26 UTC (rev 29904) @@ -10,6 +10,8 @@ - They can only contain picklable subobjects +- They don't live in regular file-system modules + Let's look at an example: >>> def __init__(self, name): @@ -22,6 +24,7 @@ >>> class C: ... __metaclass__ = ZClasses._pmc.ZClassPersistentMetaClass ... __init__ = __init__ +... __module__ = '__zodb__' ... foo = foo ... kind = 'sample' @@ -30,6 +33,12 @@ persistent class must be picklable. We defined the methods as global functions to make them picklable. +Also note that we explictly set the module. Persistent classes don't +live in normal Python modules. Rather, they live in the database. We +use information in __module__ to record where in the database. When +we want to use a database, we will need to supply a custom class +factory to load instances of the class. + The class we created works a lot like other persistent objects. It has standard standard persistent attributes: @@ -63,17 +72,15 @@ >>> C._p_changed False -Now, we can store the class in a database. We have to be careful, -however, to use the ZClass-aware class factory so that we can find -ZClasses, which are stored in the database, rather than in modules: +Now, we can store the class in a database. We're going to use an +explicit transaction manager so that we can show parallel transactions +without having to use threads. ->>> import Zope2.App.ClassFactory ->>> some_database.classFactory = Zope2.App.ClassFactory.ClassFactory - ->>> connection = some_database.open() +>>> import transaction +>>> tm = transaction.TransactionManager() +>>> connection = some_database.open(txn_mgr=tm) >>> connection.root()['C'] = C ->>> import transaction ->>> transaction.commit() +>>> tm.commit() Now, if we look at the persistence variables, we'll see that they have values: @@ -102,7 +109,7 @@ If we abort the transaction: ->>> transaction.abort() +>>> tm.abort() Then the class will return to it's prior state: @@ -114,23 +121,15 @@ >>> c.bar() bar first -We can open another connection and access the class there. Let's do -that in another thread: ->>> import threading ->>> def run(func): -... thread = threading.Thread(target=func) -... thread.start() -... thread.join() +We can open another connection and access the class there. ->>> def read_class(): -... connection = some_database.open() -... C = connection.root()['C'] -... c = C('other') -... c.bar() -... connection.close() +>>> tm2 = transaction.TransactionManager() +>>> connection2 = some_database.open(txn_mgr=tm2) ->>> run(read_class) +>>> C2 = connection2.root()['C'] +>>> c2 = C2('other') +>>> c2.bar() bar other If we make changes without commiting them: @@ -139,28 +138,27 @@ >>> c.bar() baz first -Other connections/threads are unaffected: +>>> C is C2 +False ->>> run(read_class) +Other connections are unaffected: + +>>> connection2.sync() +>>> c2.bar() bar other Until we commit: ->>> transaction.commit() ->>> run(read_class) +>>> tm.commit() +>>> connection2.sync() +>>> c2.bar() baz other -Similarly, we don't see changes made in other connextions: +Similarly, we don't see changes made in other connections: ->>> def write_class(): -... connection = some_database.open() -... C = connection.root()['C'] -... C.color = 'red' -... transaction.commit() -... connection.close() +>>> C2.color = 'red' +>>> tm2.commit() ->>> run(write_class) - >>> c.color Traceback (most recent call last): ... @@ -172,3 +170,114 @@ >>> c.color 'red' +Instances of Persistent Classes +--- + +We can, of course, store instances of perstent classes in the +database: + +>>> c.color = 'blue' +>>> connection.root()['c'] = c +>>> tm.commit() + +>>> connection2.sync() +>>> connection2.root()['c'].color +'blue' + +NOTE: If a non-persistent instance of a persistent class is copied, + the class may be copied as well. This is usually not the desired + result. + + +Persistent instances of persistent classes +-- + +Persistent instances of persistent classes are handled differently +than normal instances. When we copy a persistent instanc
[Zope-Checkins] CVS: Zope/doc - CHANGES.txt:1.625.2.319
Update of /cvs-repository/Zope/doc In directory cvs.zope.org:/tmp/cvs-serv18371/doc Modified Files: Tag: Zope-2_7-branch CHANGES.txt Log Message: Set a more sane default for event log level. === Zope/doc/CHANGES.txt 1.625.2.318 => 1.625.2.319 === --- Zope/doc/CHANGES.txt:1.625.2.318Tue Apr 5 17:17:44 2005 +++ Zope/doc/CHANGES.txtFri Apr 8 06:06:36 2005 @@ -8,6 +8,8 @@ Bugs fixed + - Default log level for the event log set to INFO rather that ALL + - Hotfix_20050405: classes defined in untrusted code could shadow the roles of methods defined as protected by their bases. ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] CVS: Zope/skel/etc - zope.conf.in:1.6.2.27
Update of /cvs-repository/Zope/skel/etc In directory cvs.zope.org:/tmp/cvs-serv18371/skel/etc Modified Files: Tag: Zope-2_7-branch zope.conf.in Log Message: Set a more sane default for event log level. === Zope/skel/etc/zope.conf.in 1.6.2.26 => 1.6.2.27 === --- Zope/skel/etc/zope.conf.in:1.6.2.26 Sun Dec 12 13:39:47 2004 +++ Zope/skel/etc/zope.conf.in Fri Apr 8 06:06:37 2005 @@ -709,7 +709,7 @@ # will not be written anywhere. - level all + level INFO path $INSTANCE/log/event.log level info ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins