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
61bd94e9
Commit
61bd94e9
authored
Aug 24, 2005
by
Zachery Bir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
carried forward from Zope-2_8-branch
parent
257ac8fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
lib/python/Products/PluginIndexes/DateIndex/DateIndex.py
lib/python/Products/PluginIndexes/DateIndex/DateIndex.py
+12
-0
lib/python/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py
.../Products/PluginIndexes/DateIndex/tests/test_DateIndex.py
+14
-0
No files found.
lib/python/Products/PluginIndexes/DateIndex/DateIndex.py
View file @
61bd94e9
...
@@ -26,6 +26,8 @@ from BTrees.OIBTree import OIBTree
...
@@ -26,6 +26,8 @@ from BTrees.OIBTree import OIBTree
from
DateTime.DateTime
import
DateTime
from
DateTime.DateTime
import
DateTime
from
Globals
import
DTMLFile
from
Globals
import
DTMLFile
from
OFS.PropertyManager
import
PropertyManager
from
OFS.PropertyManager
import
PropertyManager
from
ZODB.POSException
import
ConflictError
from
zLOG
import
LOG
,
ERROR
from
zope.interface
import
implements
from
zope.interface
import
implements
from
Products.PluginIndexes.common
import
safe_callable
from
Products.PluginIndexes.common
import
safe_callable
...
@@ -135,6 +137,16 @@ class DateIndex(UnIndex, PropertyManager):
...
@@ -135,6 +137,16 @@ class DateIndex(UnIndex, PropertyManager):
if
ConvertedDate
!=
oldConvertedDate
:
if
ConvertedDate
!=
oldConvertedDate
:
if
oldConvertedDate
is
not
_marker
:
if
oldConvertedDate
is
not
_marker
:
self
.
removeForwardIndexEntry
(
oldConvertedDate
,
documentId
)
self
.
removeForwardIndexEntry
(
oldConvertedDate
,
documentId
)
if
ConvertedDate
is
_marker
:
try
:
del
self
.
_unindex
[
documentId
]
except
ConflictError
:
raise
except
:
LOG
(
'UnIndex'
,
ERROR
,
(
"Should not happen: ConvertedDate was there,"
" now it's not, for document with id %s"
%
documentId
))
if
ConvertedDate
is
not
_marker
:
if
ConvertedDate
is
not
_marker
:
self
.
insertForwardIndexEntry
(
ConvertedDate
,
documentId
)
self
.
insertForwardIndexEntry
(
ConvertedDate
,
documentId
)
...
...
lib/python/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py
View file @
61bd94e9
...
@@ -239,6 +239,20 @@ class DI_Tests(unittest.TestCase):
...
@@ -239,6 +239,20 @@ class DI_Tests(unittest.TestCase):
val
=
(((
yr
*
12
+
mo
)
*
31
+
dy
)
*
24
+
hr
)
*
60
+
mn
val
=
(((
yr
*
12
+
mo
)
*
31
+
dy
)
*
24
+
hr
)
*
60
+
mn
self
.
failUnlessEqual
(
self
.
_index
.
getEntryForObject
(
k
),
val
)
self
.
failUnlessEqual
(
self
.
_index
.
getEntryForObject
(
k
),
val
)
def
test_removal
(
self
):
""" DateIndex would hand back spurious entries when used as a
sort_index, because it previously was not removing entries
from the _unindex when indexing an object with a value of
None. The catalog consults a sort_index's
documentToKeyMap() to build the brains.
"""
values
=
self
.
_values
index
=
self
.
_index
self
.
_populateIndex
()
self
.
_checkApply
(
self
.
_int_req
,
[
values
[
7
]])
index
.
index_object
(
7
,
None
)
self
.
failIf
(
7
in
index
.
documentToKeyMap
().
keys
())
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
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