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
e22ce2fb
Commit
e22ce2fb
authored
Jan 30, 2005
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed __len__ as persistent attribute
parent
c6a56330
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
19 deletions
+5
-19
lib/python/Products/PluginIndexes/common/UnIndex.py
lib/python/Products/PluginIndexes/common/UnIndex.py
+5
-19
No files found.
lib/python/Products/PluginIndexes/common/UnIndex.py
View file @
e22ce2fb
...
@@ -88,30 +88,16 @@ class UnIndex(SimpleItem):
...
@@ -88,30 +88,16 @@ class UnIndex(SimpleItem):
except
:
except
:
self
.
indexed_attrs
=
[
self
.
id
]
self
.
indexed_attrs
=
[
self
.
id
]
# It was a mistake to use a __len__ attribute here, but it's not
self
.
_length
=
BTrees
.
Length
.
Length
()
# worth changing at this point, as there is old data with this
# attribute name. :( See __len__ method docstring
self
.
__len__
=
BTrees
.
Length
.
Length
()
self
.
clear
()
self
.
clear
()
def
__len__
(
self
):
def
__len__
(
self
):
"""Return the number of objects indexed."""
return
self
.
_length
()
# The instance __len__ attr isn't effective because
# Python cached this method in a slot,
__len__
=
self
.
__dict__
.
get
(
'__len__'
)
if
__len__
is
not
None
:
return
__len__
()
return
len
(
self
.
_unindex
)
def
getId
(
self
):
def
getId
(
self
):
return
self
.
id
return
self
.
id
def
clear
(
self
):
def
clear
(
self
):
# inplace opportunistic conversion from old-style to new style BTrees
try
:
self
.
__len__
.
set
(
0
)
except
AttributeError
:
self
.
__len__
=
BTrees
.
Length
.
Length
()
self
.
_index
=
OOBTree
()
self
.
_index
=
OOBTree
()
self
.
_unindex
=
IOBTree
()
self
.
_unindex
=
IOBTree
()
...
@@ -158,12 +144,12 @@ class UnIndex(SimpleItem):
...
@@ -158,12 +144,12 @@ class UnIndex(SimpleItem):
indexRow
.
remove
(
documentId
)
indexRow
.
remove
(
documentId
)
if
not
indexRow
:
if
not
indexRow
:
del
self
.
_index
[
entry
]
del
self
.
_index
[
entry
]
try
:
self
.
_
_len__
.
change
(
-
1
)
try
:
self
.
_
length
.
change
(
-
1
)
except
AttributeError
:
pass
# pre-BTrees-module instance
except
AttributeError
:
pass
# pre-BTrees-module instance
except
AttributeError
:
except
AttributeError
:
# index row is an int
# index row is an int
del
self
.
_index
[
entry
]
del
self
.
_index
[
entry
]
try
:
self
.
_
_len__
.
change
(
-
1
)
try
:
self
.
_
length
.
change
(
-
1
)
except
AttributeError
:
pass
# pre-BTrees-module instance
except
AttributeError
:
pass
# pre-BTrees-module instance
except
:
except
:
LOG
.
error
(
'%s: unindex_object could not remove '
LOG
.
error
(
'%s: unindex_object could not remove '
...
@@ -190,7 +176,7 @@ class UnIndex(SimpleItem):
...
@@ -190,7 +176,7 @@ class UnIndex(SimpleItem):
# an IntSet and stuff it in first.
# an IntSet and stuff it in first.
if
indexRow
is
_marker
:
if
indexRow
is
_marker
:
self
.
_index
[
entry
]
=
documentId
self
.
_index
[
entry
]
=
documentId
try
:
self
.
_
_len__
.
change
(
1
)
try
:
self
.
_
length
.
change
(
1
)
except
AttributeError
:
pass
# pre-BTrees-module instance
except
AttributeError
:
pass
# pre-BTrees-module instance
else
:
else
:
try
:
indexRow
.
insert
(
documentId
)
try
:
indexRow
.
insert
(
documentId
)
...
...
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