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
4593245a
Commit
4593245a
authored
Jul 29, 2000
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Committing zcatatalog keyerror fixes to trunk.
parent
9033fe63
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
34 deletions
+47
-34
lib/python/Products/ZCatalog/Catalog.py
lib/python/Products/ZCatalog/Catalog.py
+18
-14
lib/python/SearchIndex/UnIndex.py
lib/python/SearchIndex/UnIndex.py
+8
-5
lib/python/SearchIndex/UnKeywordIndex.py
lib/python/SearchIndex/UnKeywordIndex.py
+4
-3
lib/python/SearchIndex/UnTextIndex.py
lib/python/SearchIndex/UnTextIndex.py
+17
-12
No files found.
lib/python/Products/ZCatalog/Catalog.py
View file @
4593245a
...
...
@@ -385,24 +385,28 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
Note, the uid must be the same as when the object was
catalogued, otherwise it will not get removed from the catalog
This method should not raise an exception if the uid cannot
be found in the catalog.
"""
try
:
rid
=
self
.
uids
[
uid
]
data
=
self
.
data
uids
=
self
.
uids
paths
=
self
.
paths
indexes
=
self
.
indexes
rid
=
uids
.
get
(
uid
,
None
)
for
x
in
self
.
indexes
.
values
():
if
rid
is
not
None
:
for
x
in
indexes
.
values
():
x
=
x
.
__of__
(
self
)
if
hasattr
(
x
,
'unindex_object'
):
try
:
x
.
unindex_object
(
rid
)
except
KeyError
:
pass
#fugedaboudit
del
self
.
data
[
rid
]
del
self
.
uids
[
uid
]
del
self
.
paths
[
rid
]
except
:
pass
x
.
unindex_object
(
rid
)
# this should never raise an exception
for
btree
in
(
data
,
paths
):
try
:
del
btree
[
rid
]
except
KeyError
:
pass
del
uids
[
uid
]
def
clear
(
self
):
""" clear catalog """
...
...
lib/python/SearchIndex/UnIndex.py
View file @
4593245a
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Simple column indices"""
__version__
=
'$Revision: 1.1
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
2
$'
[
11
:
-
2
]
from
Globals
import
Persistent
from
Acquisition
import
Implicit
...
...
@@ -186,15 +186,18 @@ class UnIndex(Persistent, Implicit):
def
unindex_object
(
self
,
i
):
""" Unindex the object with integer id 'i' """
""" Unindex the object with integer id 'i' and don't
raise an exception if we fail """
index
=
self
.
_index
unindex
=
self
.
_unindex
k
=
unindex
[
i
]
k
=
unindex
.
get
(
i
,
None
)
if
k
is
None
:
return
None
set
=
index
.
get
(
k
)
if
set
is
not
None
:
set
.
remove
(
i
)
set
=
index
.
get
(
k
,
None
)
if
set
is
not
None
:
try
:
set
.
remove
(
i
)
except
:
pass
del
unindex
[
i
]
self
.
_index
=
index
...
...
lib/python/SearchIndex/UnKeywordIndex.py
View file @
4593245a
...
...
@@ -43,16 +43,17 @@ class UnKeywordIndex(UnIndex):
def
unindex_object
(
self
,
i
):
""" Unindex the object with integer id 'i' """
""" carefully unindex the object with integer id 'i' and do not
fail if it does not exist """
index
=
self
.
_index
unindex
=
self
.
_unindex
kws
=
unindex
[
i
]
kws
=
unindex
.
get
(
i
,
None
)
if
kws
is
None
:
return
None
for
kw
in
kws
:
set
=
index
.
get
(
kw
)
set
=
index
.
get
(
kw
,
None
)
if
set
is
not
None
:
set
.
remove
(
i
)
del
unindex
[
i
]
...
...
lib/python/SearchIndex/UnTextIndex.py
View file @
4593245a
...
...
@@ -92,7 +92,7 @@ is no longer known.
"""
__version__
=
'$Revision: 1.2
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
4
$'
[
11
:
-
2
]
from
Globals
import
Persistent
import
BTree
,
IIBTree
,
IOBTree
,
OIBTree
...
...
@@ -316,18 +316,23 @@ class UnTextIndex(Persistent, Implicit):
def
unindex_object
(
self
,
i
,
tt
=
type
(())
):
""" unindex object 'obj' with iteger id 'i' from the text index """
""" carefully unindex document with integer id 'i' from the text
index and do not fail if it does not exist """
index
=
self
.
_index
for
n
in
self
.
_unindex
[
i
]:
v
=
index
[
n
]
if
type
(
v
)
is
tt
:
del
index
[
n
]
else
:
del
index
[
n
][
i
]
del
self
.
_unindex
[
i
]
self
.
_index
=
index
unindex
=
self
.
_unindex
val
=
unindex
.
get
(
i
,
None
)
if
val
is
not
None
:
for
n
in
val
:
v
=
index
.
get
(
n
,
None
)
if
type
(
v
)
is
tt
:
del
index
[
n
]
elif
v
is
not
None
:
try
:
del
index
[
n
][
i
]
except
(
KeyError
,
IndexError
,
TypeError
):
pass
del
unindex
[
i
]
self
.
_index
=
index
...
...
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