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
c5e35d7a
Commit
c5e35d7a
authored
Aug 12, 2004
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added test to verify the interface
- synced interface and help file with implementation
parent
41e836ec
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
40 deletions
+82
-40
lib/python/Products/ZCatalog/IZCatalog.py
lib/python/Products/ZCatalog/IZCatalog.py
+10
-10
lib/python/Products/ZCatalog/help/ZCatalog.py
lib/python/Products/ZCatalog/help/ZCatalog.py
+18
-2
lib/python/Products/ZCatalog/tests/testCatalog.py
lib/python/Products/ZCatalog/tests/testCatalog.py
+54
-28
No files found.
lib/python/Products/ZCatalog/IZCatalog.py
View file @
c5e35d7a
...
@@ -228,23 +228,23 @@ class IZCatalog(Interface):
...
@@ -228,23 +228,23 @@ class IZCatalog(Interface):
queries (even across catalogs) and merge and sort the combined results.
queries (even across catalogs) and merge and sort the combined results.
"""
"""
def
refreshCatalog
(
clear
=
0
,
REQUEST
=
None
,
pghandler
=
None
):
def
refreshCatalog
(
clear
=
0
,
pghandler
=
None
):
"""Reindex every object we can find, removing the unreachable
"""Reindex every object we can find, removing the unreachable
ones from the index.
ones from the index.
clear -- values: 1|0 clear the catalog before reindexing
clear -- values: 1|0 clear the catalog before reindexing
REQUEST -- optional REQUEST object
pghandler -- optional Progresshandler as defined in ProgressHandler.py
pghandler -- optional Progresshandler as defined in ProgressHandler.py
(see also README.txt)
(see also README.txt)
"""
"""
def
reindexIndex
(
name
,
pghandler
=
None
):
def
reindexIndex
(
name
,
REQUEST
,
pghandler
=
None
):
"""Reindex a single index.
"""Reindex a single index.
name -- id of index
name -- id of index
REQUEST -- REQUEST object
pghandler -- optional Progresshandler as defined in ProgressHandler.py
pghandler -- optional Progresshandler as defined in ProgressHandler.py
(see also README.txt)
(see also README.txt)
"""
"""
...
...
lib/python/Products/ZCatalog/help/ZCatalog.py
View file @
c5e35d7a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
.
#
#
##############################################################################
##############################################################################
...
@@ -229,7 +229,23 @@ class ZCatalog:
...
@@ -229,7 +229,23 @@ class ZCatalog:
queries (even across catalogs) and merge and sort the combined results.
queries (even across catalogs) and merge and sort the combined results.
"""
"""
def
refreshCatalog
():
def
refreshCatalog
(
clear
=
0
,
pghandler
=
None
):
"""Reindex every object we can find, removing the unreachable
"""Reindex every object we can find, removing the unreachable
ones from the index.
ones from the index.
clear -- values: 1|0 clear the catalog before reindexing
pghandler -- optional Progresshandler as defined in ProgressHandler.py
(see also README.txt)
"""
def
reindexIndex
(
name
,
REQUEST
,
pghandler
=
None
):
"""Reindex a single index.
name -- id of index
REQUEST -- REQUEST object
pghandler -- optional Progresshandler as defined in ProgressHandler.py
(see also README.txt)
"""
"""
lib/python/Products/ZCatalog/tests/testCatalog.py
View file @
c5e35d7a
#!/usr/bin/env python, unittest
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
""" Unittests for Catalog.
$Id:$
"""
# Unittests for Catalog
import
os
import
random
import
unittest
import
unittest
import
Testing
import
Zope
Zope
.
startup
()
from
Interface.Verify
import
verifyClass
from
itertools
import
chain
from
itertools
import
chain
import
random
import
ZODB
,
OFS
.
Application
from
ZODB.DemoStorage
import
DemoStorage
from
ZODB.DB
import
DB
from
Products
import
ZCatalog
from
Products.ZCatalog
import
ZCatalog
,
Vocabulary
from
Products.ZCatalog.Catalog
import
Catalog
,
CatalogError
import
ExtensionClass
import
ExtensionClass
import
OFS.Application
from
Products.ZCatalog
import
Vocabulary
from
Products.ZCatalog.Catalog
import
Catalog
from
Products.ZCatalog.Catalog
import
CatalogError
from
ZODB.DB
import
DB
from
ZODB.DemoStorage
import
DemoStorage
from
Products.PluginIndexes.FieldIndex.FieldIndex
import
FieldIndex
from
Products.PluginIndexes.FieldIndex.FieldIndex
import
FieldIndex
from
Products.PluginIndexes.TextIndex.TextIndex
import
TextIndex
from
Products.PluginIndexes.TextIndex.Lexicon
import
Lexicon
from
Products.PluginIndexes.KeywordIndex.KeywordIndex
import
KeywordIndex
from
Products.PluginIndexes.KeywordIndex.KeywordIndex
import
KeywordIndex
from
Products.PluginIndexes.TextIndex.Lexicon
import
Lexicon
from
Products.PluginIndexes.TextIndex.TextIndex
import
TextIndex
def
createDatabase
():
def
createDatabase
():
...
@@ -129,7 +146,8 @@ class zdummy(ExtensionClass.Base):
...
@@ -129,7 +146,8 @@ class zdummy(ExtensionClass.Base):
class
TestZCatalog
(
unittest
.
TestCase
):
class
TestZCatalog
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
_catalog
=
ZCatalog
.
ZCatalog
(
'Catalog'
)
from
Products.ZCatalog.ZCatalog
import
ZCatalog
self
.
_catalog
=
ZCatalog
(
'Catalog'
)
self
.
_catalog
.
resolve_path
=
self
.
_resolve_num
self
.
_catalog
.
resolve_path
=
self
.
_resolve_num
self
.
_catalog
.
addIndex
(
'title'
,
'KeywordIndex'
)
self
.
_catalog
.
addIndex
(
'title'
,
'KeywordIndex'
)
self
.
_catalog
.
addColumn
(
'title'
)
self
.
_catalog
.
addColumn
(
'title'
)
...
@@ -184,6 +202,13 @@ class TestZCatalog(unittest.TestCase):
...
@@ -184,6 +202,13 @@ class TestZCatalog(unittest.TestCase):
data
=
self
.
_catalog
.
getMetadataForUID
(
'0'
)
data
=
self
.
_catalog
.
getMetadataForUID
(
'0'
)
self
.
assertEqual
(
data
[
'title'
],
'0'
)
self
.
assertEqual
(
data
[
'title'
],
'0'
)
def
test_interface
(
self
):
from
Products.ZCatalog.IZCatalog
import
IZCatalog
from
Products.ZCatalog.ZCatalog
import
ZCatalog
verifyClass
(
IZCatalog
,
ZCatalog
)
class
dummy
(
ExtensionClass
.
Base
):
class
dummy
(
ExtensionClass
.
Base
):
att1
=
'att1'
att1
=
'att1'
att2
=
'att2'
att2
=
'att2'
...
@@ -539,6 +564,7 @@ class TestMerge(unittest.TestCase):
...
@@ -539,6 +564,7 @@ class TestMerge(unittest.TestCase):
expected
=
[
rid
for
sortkey
,
rid
,
getitem
in
expected
]
expected
=
[
rid
for
sortkey
,
rid
,
getitem
in
expected
]
self
.
assertEqual
(
merged_rids
,
expected
)
self
.
assertEqual
(
merged_rids
,
expected
)
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelColumn
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelColumn
)
)
...
...
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