[Zope-dev] zc.relationship 1.0.2 typo bug
Rudá Porto Filgueiras
rudazz at gmail.com
Sun Nov 2 23:22:09 EST 2008
I found a typo bug in zc.relationship 1.0.2 (pypi and svn tag 1.02).
It's fixed in trunk but not backported and plone.app.relations-1.0b2
unittest found this bug.
patch:
Index: src/zc/relationship/shared.py
===================================================================
--- src/zc/relationship/shared.py (revisão 92754)
+++ src/zc/relationship/shared.py (cópia de trabalho)
@@ -190,7 +190,7 @@
return None
if not isinstance(depth, (int, long)) or depth < 1:
raise ValueError('invalid minDepth', depth)
- return lambda relchain, query, index, cache: len(relchain) >= minDepth
+ return lambda relchain, query, index, cache: len(relchain) >= depth
class AbstractContainer(persistent.Persistent):
def __init__(self,
unittest exception:
----------------------------------------------------------------------
File "/home/ruda/baquara-virtual/eggs/plone.app.relations-1.0b2-py2.4.egg/plone/app/relations/README.txt",
line 186, in README.txt
Failed example:
sorted([repr(r) for r in chains])
Exception raised:
Traceback (most recent call last):
File "/home/ruda/baquara-virtual/parts/zope2/lib/python/zope/testing/doctest.py",
line 1348, in __run
compileflags, 1) in test.globs
File "<doctest README.txt[51]>", line 1, in ?
sorted([repr(r) for r in chains])
File "/home/ruda/baquara-virtual/eggs/zc.relationship-1.0.2-py2.4.egg/zc/relationship/shared.py",
line 317, in _resolveRelationshipChains
for i in iterable:
File "/home/ruda/baquara-virtual/eggs/zc.relationship-1.0.2-py2.4.egg/zc/relationship/shared.py",
line 284, in _forward
for i in iterable:
File "/home/ruda/baquara-virtual/eggs/zc.relationship-1.0.2-py2.4.egg/zc/relationship/index.py",
line 619, in _yieldRelationshipTokenChains
if (checkTargetFilter is None or
File "/home/ruda/baquara-virtual/eggs/zc.relationship-1.0.2-py2.4.egg/zc/relationship/index.py",
line 468, in checkTargetFilter
return targetFilter(relchain, query, self, targetCache)
File "/home/ruda/baquara-virtual/eggs/zc.relationship-1.0.2-py2.4.egg/zc/relationship/shared.py",
line 193, in <lambda>
return lambda relchain, query, index, cache: len(relchain) >= minDepth
NameError: global name 'minDepth' is not defined
----------------------------------------------------------------------
File "/home/ruda/baquara-virtual/eggs/plone.app.relations-1.0b2-py2.4.egg/plone/app/relations/README.txt",
line 353, in README.txt
Failed example:
list(target.getSources(relation=u'relation 1', maxDepth=2, minDepth=2))
Exception raised:
Traceback (most recent call last):
File "/home/ruda/baquara-virtual/parts/zope2/lib/python/zope/testing/doctest.py",
line 1348, in __run
compileflags, 1) in test.globs
File "<doctest README.txt[97]>", line 1, in ?
list(target.getSources(relation=u'relation 1', maxDepth=2, minDepth=2))
File "/home/ruda/baquara-virtual/eggs/plone.relations-1.0b5-py2.4.egg/plone/relations/lazylist.py",
line 315, in __len__
return len(self._data)
File "/home/ruda/baquara-virtual/eggs/plone.relations-1.0b5-py2.4.egg/plone/relations/lazylist.py",
line 189, in __len__
return len(self._extract_to(-1))
File "/home/ruda/baquara-virtual/eggs/plone.relations-1.0b5-py2.4.egg/plone/relations/lazylist.py",
line 170, in _extract_to
thelist = [i for i in self] # invokes __iter__ which sets _list
File "/home/ruda/baquara-virtual/eggs/plone.relations-1.0b5-py2.4.egg/plone/relations/lazylist.py",
line 158, in __iter__
for item in self._iter:
File "/home/ruda/baquara-virtual/eggs/zc.relationship-1.0.2-py2.4.egg/zc/relationship/index.py",
line 525, in _yieldValueTokens
getQueries, findCycles=False):
File "/home/ruda/baquara-virtual/eggs/zc.relationship-1.0.2-py2.4.egg/zc/relationship/index.py",
line 619, in _yieldRelationshipTokenChains
if (checkTargetFilter is None or
File "/home/ruda/baquara-virtual/eggs/zc.relationship-1.0.2-py2.4.egg/zc/relationship/index.py",
line 468, in checkTargetFilter
return targetFilter(relchain, query, self, targetCache)
File "/home/ruda/baquara-virtual/eggs/zc.relationship-1.0.2-py2.4.egg/zc/relationship/shared.py",
line 193, in <lambda>
return lambda relchain, query, index, cache: len(relchain) >= minDepth
NameError: global name 'minDepth' is not defined
--
=====================================
Rudá Porto Filgueiras
Weimar Consultoria
http://python-blog.blogspot.com
Hospedagem Plone, Django, Zope 3, Grok...
http://www.pytown.com
=====================================
More information about the Zope-Dev
mailing list