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):
except
:
self
.
indexed_attrs
=
[
self
.
id
]
# It was a mistake to use a __len__ attribute here, but it's not
# worth changing at this point, as there is old data with this
# attribute name. :( See __len__ method docstring
self
.
__len__
=
BTrees
.
Length
.
Length
()
self
.
_length
=
BTrees
.
Length
.
Length
()
self
.
clear
()
def
__len__
(
self
):
"""Return the number of objects indexed."""
# 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
)
return
self
.
_length
()
def
getId
(
self
):
return
self
.
id
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
.
_unindex
=
IOBTree
()
...
...
@@ -158,12 +144,12 @@ class UnIndex(SimpleItem):
indexRow
.
remove
(
documentId
)
if
not
indexRow
:
del
self
.
_index
[
entry
]
try
:
self
.
_
_len__
.
change
(
-
1
)
try
:
self
.
_
length
.
change
(
-
1
)
except
AttributeError
:
pass
# pre-BTrees-module instance
except
AttributeError
:
# index row is an int
del
self
.
_index
[
entry
]
try
:
self
.
_
_len__
.
change
(
-
1
)
try
:
self
.
_
length
.
change
(
-
1
)
except
AttributeError
:
pass
# pre-BTrees-module instance
except
:
LOG
.
error
(
'%s: unindex_object could not remove '
...
...
@@ -190,7 +176,7 @@ class UnIndex(SimpleItem):
# an IntSet and stuff it in first.
if
indexRow
is
_marker
:
self
.
_index
[
entry
]
=
documentId
try
:
self
.
_
_len__
.
change
(
1
)
try
:
self
.
_
length
.
change
(
1
)
except
AttributeError
:
pass
# pre-BTrees-module instance
else
:
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