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
Show 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):
...
@@ -385,24 +385,28 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
Note, the uid must be the same as when the object was
Note, the uid must be the same as when the object was
catalogued, otherwise it will not get removed from the catalog
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
:
data
=
self
.
data
rid
=
self
.
uids
[
uid
]
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
)
x
=
x
.
__of__
(
self
)
if
hasattr
(
x
,
'unindex_object'
):
if
hasattr
(
x
,
'unindex_object'
):
try
:
x
.
unindex_object
(
rid
)
x
.
unindex_object
(
rid
)
# this should never raise an exception
for
btree
in
(
data
,
paths
):
try
:
del
btree
[
rid
]
except
KeyError
:
except
KeyError
:
pass
#fugedaboudit
del
self
.
data
[
rid
]
del
self
.
uids
[
uid
]
del
self
.
paths
[
rid
]
except
:
pass
pass
del
uids
[
uid
]
def
clear
(
self
):
def
clear
(
self
):
""" clear catalog """
""" clear catalog """
...
...
lib/python/SearchIndex/UnIndex.py
View file @
4593245a
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
##############################################################################
##############################################################################
"""Simple column indices"""
"""Simple column indices"""
__version__
=
'$Revision: 1.1
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
2
$'
[
11
:
-
2
]
from
Globals
import
Persistent
from
Globals
import
Persistent
from
Acquisition
import
Implicit
from
Acquisition
import
Implicit
...
@@ -186,15 +186,18 @@ class UnIndex(Persistent, Implicit):
...
@@ -186,15 +186,18 @@ class UnIndex(Persistent, Implicit):
def
unindex_object
(
self
,
i
):
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
index
=
self
.
_index
unindex
=
self
.
_unindex
unindex
=
self
.
_unindex
k
=
unindex
[
i
]
k
=
unindex
.
get
(
i
,
None
)
if
k
is
None
:
if
k
is
None
:
return
None
return
None
set
=
index
.
get
(
k
)
set
=
index
.
get
(
k
,
None
)
if
set
is
not
None
:
set
.
remove
(
i
)
if
set
is
not
None
:
try
:
set
.
remove
(
i
)
except
:
pass
del
unindex
[
i
]
del
unindex
[
i
]
self
.
_index
=
index
self
.
_index
=
index
...
...
lib/python/SearchIndex/UnKeywordIndex.py
View file @
4593245a
...
@@ -43,16 +43,17 @@ class UnKeywordIndex(UnIndex):
...
@@ -43,16 +43,17 @@ class UnKeywordIndex(UnIndex):
def
unindex_object
(
self
,
i
):
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
index
=
self
.
_index
unindex
=
self
.
_unindex
unindex
=
self
.
_unindex
kws
=
unindex
[
i
]
kws
=
unindex
.
get
(
i
,
None
)
if
kws
is
None
:
if
kws
is
None
:
return
None
return
None
for
kw
in
kws
:
for
kw
in
kws
:
set
=
index
.
get
(
kw
)
set
=
index
.
get
(
kw
,
None
)
if
set
is
not
None
:
set
.
remove
(
i
)
if
set
is
not
None
:
set
.
remove
(
i
)
del
unindex
[
i
]
del
unindex
[
i
]
...
...
lib/python/SearchIndex/UnTextIndex.py
View file @
4593245a
...
@@ -92,7 +92,7 @@ is no longer known.
...
@@ -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
from
Globals
import
Persistent
import
BTree
,
IIBTree
,
IOBTree
,
OIBTree
import
BTree
,
IIBTree
,
IOBTree
,
OIBTree
...
@@ -316,17 +316,22 @@ class UnTextIndex(Persistent, Implicit):
...
@@ -316,17 +316,22 @@ class UnTextIndex(Persistent, Implicit):
def
unindex_object
(
self
,
i
,
tt
=
type
(())
):
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
index
=
self
.
_index
for
n
in
self
.
_unindex
[
i
]:
unindex
=
self
.
_unindex
v
=
index
[
n
]
val
=
unindex
.
get
(
i
,
None
)
if
val
is
not
None
:
for
n
in
val
:
v
=
index
.
get
(
n
,
None
)
if
type
(
v
)
is
tt
:
if
type
(
v
)
is
tt
:
del
index
[
n
]
del
index
[
n
]
else
:
elif
v
is
not
None
:
try
:
del
index
[
n
][
i
]
del
index
[
n
][
i
]
except
(
KeyError
,
IndexError
,
TypeError
):
del
self
.
_unindex
[
i
]
pass
del
unindex
[
i
]
self
.
_index
=
index
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