Commit 3b932eea authored by Andreas Jung's avatar Andreas Jung

- Fix for passing additional parameters

- minor code cleanup for handling wrong index names
parent 055612f3
......@@ -85,7 +85,7 @@
"""Simple column indices"""
__version__='$Revision: 1.2 $'[11:-2]
__version__='$Revision: 1.3 $'[11:-2]
from Globals import Persistent
from Acquisition import Implicit
......@@ -137,5 +137,6 @@ manage_addFieldIndexForm = DTMLFile('dtml/addFieldIndex', globals())
def manage_addFieldIndex(self, id, REQUEST=None, RESPONSE=None, URL3=None):
"""Add a field index"""
return self.manage_addIndex(id, 'FieldIndex', REQUEST, RESPONSE, URL3)
return self.manage_addIndex(id, 'FieldIndex', extra=None, \
REQUEST=REQUEST, RESPONSE=RESPONSE, URL1=URL3)
......@@ -194,5 +194,6 @@ manage_addKeywordIndexForm = DTMLFile('dtml/addKeywordIndex', globals())
def manage_addKeywordIndex(self, id, REQUEST=None, RESPONSE=None, URL3=None):
"""Add a keyword index"""
return self.manage_addIndex(id, 'KeywordIndex', REQUEST, RESPONSE, URL3)
return self.manage_addIndex(id, 'KeywordIndex', extra=None, \
REQUEST=REQUEST, RESPONSE=RESPONSE, URL1=URL3)
......@@ -83,7 +83,7 @@
#
##############################################################################
__version__ = '$Id: PathIndex.py,v 1.2 2001/05/30 15:57:32 andreas Exp $'
__version__ = '$Id: PathIndex.py,v 1.3 2001/05/31 12:22:52 andreas Exp $'
from Products.PluginIndexes import PluggableIndex
from Products.PluginIndexes.common.util import parseIndexRequest
......@@ -369,7 +369,8 @@ manage_addPathIndexForm = DTMLFile('dtml/addPathIndex', globals())
def manage_addPathIndex(self, id, REQUEST=None, RESPONSE=None, URL3=None):
"""Add a path index"""
return self.manage_addIndex(id, 'PathIndex', REQUEST, RESPONSE, URL3)
return self.manage_addIndex(id, 'PathIndex', extra=None, \
REQUEST=REQUEST, RESPONSE=RESPONSE, URL1=URL3)
......@@ -91,7 +91,7 @@ undo information so that objects can be unindexed when the old value
is no longer known.
"""
__version__ = '$Revision: 1.3 $'[11:-2]
__version__ = '$Revision: 1.4 $'[11:-2]
import string, re
......@@ -150,7 +150,7 @@ class TextIndex(PluggableIndex.PluggableIndex, Persistent,
'help': ('TextIndex','TextIndex_Settings.stx')},
)
def __init__(self, id, ignore_ex=None, call_methods=None, lexicon=None):
def __init__(self, id, ignore_ex=None, call_methods=None, lexicon=None,extra=None):
"""Create an index
The arguments are:
......@@ -168,9 +168,9 @@ class TextIndex(PluggableIndex.PluggableIndex, Persistent,
index will use a private lexicon."""
self.id = id
self.ignore_ex = ignore_ex
self.call_methods = call_methods
self.id = id
self.ignore_ex = ignore_ex
self.call_methods = call_methods
# Default text index operator (should be visible to ZMI)
......@@ -180,7 +180,9 @@ class TextIndex(PluggableIndex.PluggableIndex, Persistent,
self.clear()
self.vocabulary_id = "Vocabulary"
if extra: self.vocabulary_id = extra.vocabulary
else: self.vocabulary_id = "Vocabulary"
self._lexicon = None
if lexicon is not None:
......@@ -795,7 +797,7 @@ def quotes(s, ws=(string.whitespace,)):
manage_addTextIndexForm = DTMLFile('dtml/addTextIndex', globals())
def manage_addTextIndex(self, id, REQUEST=None, RESPONSE=None, URL3=None):
def manage_addTextIndex(self, id, extra=None, REQUEST=None, RESPONSE=None, URL3=None):
"""Add a text index"""
return self.manage_addIndex(id, 'TextIndex', REQUEST, RESPONSE, URL3)
return self.manage_addIndex(id, 'TextIndex', extra, REQUEST, RESPONSE, URL3)
......@@ -26,7 +26,6 @@ from the most relevant to the lest relevant.
</td>
</tr>
<dtml-comment>
<tr>
<td align="left" valign="top">
<div class="form-label">
......@@ -35,7 +34,7 @@ from the most relevant to the lest relevant.
</td>
<td>
<select name="vocabulary">
<select name="extra.vocabulary:record">
<dtml-in "this().aq_parent.objectItems('Vocabulary')">
<option value="&dtml-sequence-key;">&dtml-sequence-key; (<dtml-var "_['sequence-item'].title">)
</dtml-in>
......@@ -43,7 +42,6 @@ from the most relevant to the lest relevant.
</td>
</tr>
</dtml-comment>
<tr>
......
......@@ -333,8 +333,11 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
if self.indexes.has_key(name):
raise 'Index Exists', 'The index specified already exists'
if name[0] == '_':
if name.startswith('_'):
raise 'Invalid Index Name', 'Cannot index fields beginning with "_"'
if not name:
raise 'Invalid Index Name', 'Name of index is empty'
# this is currently a succesion of hacks. Indexes should be
# pluggable and managable
......
......@@ -405,9 +405,9 @@ class ZCatalog(Folder, Persistent, Implicit):
if REQUEST and RESPONSE:
RESPONSE.redirect(URL1 + '/manage_catalogSchema?manage_tabs_message=Column%20Deleted')
def manage_addIndex(self, name, type, REQUEST=None, RESPONSE=None, URL1=None):
def manage_addIndex(self, name, type, extra=None,REQUEST=None, RESPONSE=None, URL1=None):
""" add an index """
self.addIndex(name, type)
self.addIndex(name, type,extra)
if REQUEST and RESPONSE:
RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Index%20Added')
......@@ -791,7 +791,7 @@ class ZCatalog(Folder, Persistent, Implicit):
# Indexing methods
#
def addIndex(self, name, type):
def addIndex(self, name, type,extra=None):
# Convert the type by finding an appropriate product which supports
# this interface by that name. Bleah
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment