Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
da8f819a
Commit
da8f819a
authored
Oct 03, 2002
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collector #449: PathIndex did not index last part of path
parent
a53e7d3f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
24 deletions
+34
-24
doc/CHANGES.txt
doc/CHANGES.txt
+2
-0
lib/python/Products/PluginIndexes/PathIndex/PathIndex.py
lib/python/Products/PluginIndexes/PathIndex/PathIndex.py
+9
-12
lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
...n/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
+23
-12
No files found.
doc/CHANGES.txt
View file @
da8f819a
...
...
@@ -6,6 +6,8 @@ Zope Changes
Bugs Fixed
- Collector #449: PathIndex did not index the last part of path.
- Collector #539: Fixed rendering of TAL namespace tags with an
'on-error' statement.
...
...
lib/python/Products/PluginIndexes/PathIndex/PathIndex.py
View file @
da8f819a
...
...
@@ -11,7 +11,7 @@
#
##############################################################################
__version__
=
'$Id: PathIndex.py,v 1.2
6 2002/09/24 11:03:24
andreasjung Exp $'
__version__
=
'$Id: PathIndex.py,v 1.2
7 2002/10/03 13:10:49
andreasjung Exp $'
from
Products.PluginIndexes
import
PluggableIndex
from
Products.PluginIndexes.common.util
import
parseIndexRequest
...
...
@@ -126,8 +126,8 @@ class PathIndex(Persistent, Implicit, SimpleItem):
comps
=
self
.
splitPath
(
path
,
obj
)
if
obj
.
meta_type
!=
'Folder'
:
comps
=
comps
[:
-
1
]
#
if obj.meta_type != 'Folder':
#
comps = comps[:-1]
for
i
in
range
(
len
(
comps
)):
self
.
insertEntry
(
comps
[
i
],
documentId
,
i
)
...
...
@@ -146,7 +146,7 @@ class PathIndex(Persistent, Implicit, SimpleItem):
path
=
self
.
_unindex
[
documentId
]
comps
=
path
.
split
(
'/'
)
for
level
in
range
(
len
(
comps
[
1
:])
-
1
):
for
level
in
range
(
len
(
comps
[
1
:])):
comp
=
comps
[
level
+
1
]
self
.
_index
[
comp
][
level
].
remove
(
documentId
)
...
...
@@ -190,8 +190,8 @@ class PathIndex(Persistent, Implicit, SimpleItem):
relative URL or a part of a relative URL or
a tuple (path,level).
level
>=
0 starts searching at the given level
level
< 0
not implemented yet
level
>=
0 starts searching at the given level
level
<0
not implemented yet
"""
if
isinstance
(
path
,
StringType
):
...
...
@@ -202,10 +202,7 @@ class PathIndex(Persistent, Implicit, SimpleItem):
comps
=
self
.
splitPath
(
path
)
if
len
(
comps
)
==
0
:
return
IISet
(
self
.
_unindex
.
keys
())
if
level
>=
0
:
if
level
>=
0
:
results
=
[]
for
i
in
range
(
len
(
comps
)):
...
...
@@ -228,7 +225,7 @@ class PathIndex(Persistent, Implicit, SimpleItem):
results
=
IISet
()
for
level
in
range
(
0
,
self
.
_depth
):
for
level
in
range
(
0
,
self
.
_depth
+
1
):
ids
=
None
error
=
0
...
...
@@ -238,7 +235,7 @@ class PathIndex(Persistent, Implicit, SimpleItem):
try
:
ids
=
intersection
(
ids
,
self
.
_index
[
comp
][
level
+
cn
])
except
:
except
KeyError
:
error
=
1
if
error
==
0
:
...
...
lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py
View file @
da8f819a
...
...
@@ -53,8 +53,8 @@ class TestCase( unittest.TestCase ):
14
:
Dummy
(
"/bb/bb/bb/14.html"
),
15
:
Dummy
(
"/bb/bb/cc/15.html"
),
16
:
Dummy
(
"/bb/cc/aa/16.html"
),
17
:
Dummy
(
"/bb/cc/bb/17html"
),
18
:
Dummy
(
"/bb/cc/cc/18html"
)
17
:
Dummy
(
"/bb/cc/bb/17
.
html"
),
18
:
Dummy
(
"/bb/cc/cc/18
.
html"
)
}
def
_populateIndex
(
self
):
...
...
@@ -84,16 +84,21 @@ class TestCase( unittest.TestCase ):
self
.
_populateIndex
()
tests
=
[
(
"aa"
,
0
,
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]),
(
"aa"
,
1
,
[
1
,
2
,
3
,
10
,
11
,
12
]
),
(
"bb"
,
0
,
[
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
]),
(
"bb"
,
1
,
[
4
,
5
,
6
,
13
,
14
,
15
]
),
(
"bb/cc"
,
0
,
[
16
,
17
,
18
]
),
(
"bb/cc"
,
1
,
[
6
,
15
]
),
(
"bb/aa"
,
0
,
[
10
,
11
,
12
]
),
(
"bb/aa"
,
1
,
[
4
,
13
]
),
(
"aa/cc"
,
-
1
,
[
3
,
7
,
8
,
9
,
12
]
),
(
"bb/bb"
,
-
1
,
[
5
,
13
,
14
,
15
]
)
(
"aa"
,
0
,
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]),
(
"aa"
,
1
,
[
1
,
2
,
3
,
10
,
11
,
12
]
),
(
"bb"
,
0
,
[
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
]),
(
"bb"
,
1
,
[
4
,
5
,
6
,
13
,
14
,
15
]
),
(
"bb/cc"
,
0
,
[
16
,
17
,
18
]
),
(
"bb/cc"
,
1
,
[
6
,
15
]
),
(
"bb/aa"
,
0
,
[
10
,
11
,
12
]
),
(
"bb/aa"
,
1
,
[
4
,
13
]
),
(
"aa/cc"
,
-
1
,
[
3
,
7
,
8
,
9
,
12
]
),
(
"bb/bb"
,
-
1
,
[
5
,
13
,
14
,
15
]
),
(
"18.html"
,
3
,
[
18
]
),
(
"18.html"
,
-
1
,
[
18
]
),
(
"cc/18.html"
,
-
1
,
[
18
]
),
(
"cc/18.html"
,
2
,
[
18
]
),
]
for
comp
,
level
,
results
in
tests
:
...
...
@@ -146,3 +151,9 @@ class TestCase( unittest.TestCase ):
def
test_suite
():
return
unittest
.
makeSuite
(
TestCase
)
def
main
():
unittest
.
TextTestRunner
().
run
(
test_suite
())
if
__name__
==
'__main__'
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment