[Zope3-dev] Heads up: bugs in zope.app.catalog?
Hello, I found that z.a.catalog, AttributeIndex fails to remove the previous value/object from the index IF the new value is None. The next thing is if the index contains the object, but the value somehow dropped out of the forward index, the unindex breaks. Anybody noticed these already? I have the fixes that work in my project. If nobody argues, I'll commit them. -- Best regards, Adam mailto:[EMAIL PROTECTED] -- Quote of the day: Humility is strong, not bold; quiet, not speechless; sure, not arrogant. - Estelle Smith ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Heads up: bugs in zope.app.catalog?
Hi, Adam Groszer wrote: Hello, I found that z.a.catalog, AttributeIndex fails to remove the previous value/object from the index IF the new value is None. The next thing is if the index contains the object, but the value somehow dropped out of the forward index, the unindex breaks. Anybody noticed these already? I have the fixes that work in my project. If nobody argues, I'll commit them. Got any tests? -- gocept gmbh co. kg - forsterstraße 29 - 06112 halle/saale - germany www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 - fax +49 345 122 9889 1 - zope and plone consulting and development signature.asc Description: OpenPGP digital signature ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re[2]: [Zope3-dev] Heads up: bugs in zope.app.catalog?
Hello Christian, Working on them. Friday, November 17, 2006, 12:39:37 PM, you wrote: Got any tests? -- Best regards, Adammailto:[EMAIL PROTECTED] -- Quote of the day: He became what we are that He might make us what He is. - Athanasius (speaking of Jesus of Nazareth) ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Heads up: bugs in zope.app.catalog?
Hi Adam, Adam Groszer wrote: Working on them. That's great! I'd be happy to see your checkins then. It would be good if you took the time to backport this to 3.3 and 3.2 branches. Christian -- gocept gmbh co. kg - forsterstraße 29 - 06112 halle/saale - germany www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 - fax +49 345 122 9889 1 - zope and plone consulting and development signature.asc Description: OpenPGP digital signature ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re[2]: [Zope3-dev] Heads up: bugs in zope.app.catalog?
Hello Christian, Yep, but... What is the `good` behaviour regarding None values? Do we need to catalog them or skip them? Example: If the object is (user.title == None) Shall it be kept in the catalog or not? In case it is not in the catalog I won't be able to search for users with no title. Suggestions? At the moment the AttributeIndex works like this. Friday, November 17, 2006, 12:46:29 PM, you wrote: CT Hi Adam, CT Adam Groszer wrote: Working on them. CT That's great! I'd be happy to see your checkins then. It would be good CT if you took the time to backport this to 3.3 and 3.2 branches. CT Christian -- Best regards, Groszer Adam -- Quote of the day: Faith is not a stained-glass word reserved only for religious use, though it is essential to life. It is not something we can see on every streetcorner, but we dare not cross the street without it. - V. Carney Hargroves ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Heads up: bugs in zope.app.catalog?
Hi, Adam Groszer wrote: Hello Christian, Yep, but... What is the `good` behaviour regarding None values? Do we need to catalog them or skip them? Example: If the object is (user.title == None) Shall it be kept in the catalog or not? In case it is not in the catalog I won't be able to search for users with no title. Suggestions? At the moment the AttributeIndex works like this. Ah, I didn't see that question in your original mail, so you said: I found that z.a.catalog, AttributeIndex fails to remove the previous value/object from the index IF the new value is None. From this I derived that removing the value would be the right thing to do. I didn't see the question about whether to index None or not. IIRC the FieldIndex in Zope 2 uses None as a valid value to index and to search for. If I read the source and tests correctly, it's just an implementation accident, because someone used None as a getattr() marker instead of using a unique marker like object(). At least there is no test and no interface description that says that None should not be indexed. Christian -- gocept gmbh co. kg - forsterstraße 29 - 06112 halle/saale - germany www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 - fax +49 345 122 9889 1 - zope and plone consulting and development signature.asc Description: OpenPGP digital signature ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re[2]: [Zope3-dev] Heads up: bugs in zope.app.catalog?
Hello Christian, Yep, I also vote for indexing None. Seems like somebody wanted to avoid the `None object is not callable` exception. Friday, November 17, 2006, 1:22:42 PM, you wrote: Hi, Adam Groszer wrote: Hello Christian, Yep, but... What is the `good` behaviour regarding None values? Do we need to catalog them or skip them? Example: If the object is (user.title == None) Shall it be kept in the catalog or not? In case it is not in the catalog I won't be able to search for users with no title. Suggestions? At the moment the AttributeIndex works like this. Ah, I didn't see that question in your original mail, so you said: I found that z.a.catalog, AttributeIndex fails to remove the previous value/object from the index IF the new value is None. From this I derived that removing the value would be the right thing to do. I didn't see the question about whether to index None or not. IIRC the FieldIndex in Zope 2 uses None as a valid value to index and to search for. If I read the source and tests correctly, it's just an implementation accident, because someone used None as a getattr() marker instead of using a unique marker like object(). At least there is no test and no interface description that says that None should not be indexed. Christian -- Best regards, Adammailto:[EMAIL PROTECTED] -- Quote of the day: Shared joy is double joy and shared sorrow is half-sorrow. - Swedish Proverb ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Heads up: bugs in zope.app.catalog?
On Nov 17, 2006, at 7:22 AM, Christian Theune wrote: Hi, Adam Groszer wrote: Hello Christian, Yep, but... What is the `good` behaviour regarding None values? Do we need to catalog them or skip them? Example: If the object is (user.title == None) Shall it be kept in the catalog or not? In case it is not in the catalog I won't be able to search for users with no title. Suggestions? At the moment the AttributeIndex works like this. Ah, I didn't see that question in your original mail, so you said: I found that z.a.catalog, AttributeIndex fails to remove the previous value/object from the index IF the new value is None. From this I derived that removing the value would be the right thing to do. I didn't see the question about whether to index None or not. IIRC the FieldIndex in Zope 2 uses None as a valid value to index and to search for. If I read the source and tests correctly, it's just an implementation accident, because someone used None as a getattr() marker instead of using a unique marker like object(). At least there is no test and no interface description that says that None should not be indexed. First, None is classically Python's no value. Second, as a practical matter, indexes use BTrees to index their values, and need both a docid - value structure *and* a value - docid structure. BTrees must have homogenous key types to work reliably across Python versions. None has sorted low for a long time, I think, so it is easy to forget this, but from both a purity and (arguably) a practicality perspective it is a bad idea to rely on this. None is not a string, None is not an integer, etc. Keep your BTree keys homogenous. Therefore, it is just fine, and even a good idea from the perspective of welcoming new Python programmers to the fold, to have None be used as the no value, unindex me value. If you want to be able to ask the question you describe, I suggest you explore zc.catalog. If you use an extent catalog, you can still ask the question that Adam poses of the index--see the 'none' query type. Gary ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: Re[2]: [Zope3-dev] Heads up: bugs in zope.app.catalog?
Adam Groszer wrote at 2006-11-17 13:13 +0100: What is the `good` behaviour regarding None values? Do we need to catalog them or skip them? If you index them, you rely on a non garanteed implementation artefact: Python explicitly does not garanteed that comparisons between objects of different type are persistent across restarts. The BTree variants used in the implementation of indexes require that the keys are persistenty compared. Failing to do so, will break the index. The current Python implementation ensures persistent comparison results. Thus, you are on the good side. However, earlier Python implementations did not and maybe future implementations may not, too It is safer, to have just a single key type in your indexes... -- Dieter ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com