Skip to content

Commit

Permalink
Un-checked in a partial searching file when I meant to check in a bug
Browse files Browse the repository at this point in the history
fix.

sigh.
  • Loading branch information
Michel Pelletier committed Jan 20, 2000
1 parent c9f3427 commit a9a0581
Showing 1 changed file with 9 additions and 56 deletions.
65 changes: 9 additions & 56 deletions ZCatalog.py
Expand Up @@ -99,46 +99,17 @@
from AccessControl.Permission import name_trans
from Catalog import Catalog, orify
from SearchIndex import UnIndex, UnTextIndex
from Vocabulary import Vocabulary
import IOBTree

manage_addZCatalogForm=HTMLFile('addZCatalog',globals())

def manage_addZCatalog(self, id, title, vocab='', vocab_id='', REQUEST=None):
def manage_addZCatalog(self,id,title,REQUEST=None):
"""Add a ZCatalog object
"""
c=ZCatalog(id, title, vocab, vocab_id, self)
self._setObject(id, c)
c=ZCatalog(id,title)
self._setObject(id,c)
if REQUEST is not None:
return self.manage_main(self, REQUEST)


def VocabularyIDs(self):
""" returns a list of acquireable vocabularies. Stole this from
ZSQLMethods """

ids={}
have_id=ids.has_key
StringType=type('')

while self is not None:
if hasattr(self, 'objectValues'):
for o in self.objectValues():
if (hasattr(o,'_isAVocabulary') and o._isAVocabulary
and hasattr(o,'id')):
id=o.id
if type(id) is not StringType: id=id()
if not have_id(id):
if hasattr(o,'title_and_id'): o=o.title_and_id()
else: o=id
ids[id]=id
if hasattr(self, 'aq_parent'): self=self.aq_parent
else: self=None

ids=map(lambda item: (item[1], item[0]), ids.items())
ids.sort()
return ids

return self.manage_main(self,REQUEST)


class ZCatalog(Folder, Persistent, Implicit):
Expand Down Expand Up @@ -219,24 +190,14 @@ class is that it is not Zope specific. You can use it in any

threshold=10000
_v_total=0
_v_vocabulary = None

def __init__(self, id, title='', vocab=0, vocab_id='', container=None):

def __init__(self,id,title=''):
self.id=id
self.title=title
self.vocab_id = vocab_id

self.threshold = 10000
self._v_total = 0

if not vocab:
v = Vocabulary('Vocabulary', 'Vocabulary', globbing=1)
self._setObject('Vocabulary', v)
v = 'Vocabulary'
else:
v = vocab_id

self._catalog = Catalog(vocabulary=v)
self._catalog = Catalog()

self._catalog.addColumn('id')
self._catalog.addIndex('id', 'FieldIndex')
Expand All @@ -252,15 +213,7 @@ def __init__(self, id, title='', vocab=0, vocab_id='', container=None):

self._catalog.addColumn('summary')
self._catalog.addIndex('PrincipiaSearchSource', 'TextIndex')

self._catalog.addColumn('absolute_url')
self._catalog.addIndex('absolute_url', 'FieldIndex')


def getVocabulary(self):
""" more ack! """
return getattr(self, self.vocab_id)



def manage_edit(self, RESPONSE, URL1, threshold=1000, REQUEST=None):
""" edit the catalog """
Expand Down Expand Up @@ -406,7 +359,7 @@ def catalog_object(self, obj, uid):
if self._v_total > self.threshold:
# commit a subtransaction
get_transaction().commit(1)
# kick the chache, this may be overkill but ya never know
# kick the chache
self._p_jar.cacheFullSweep(1)
self._v_total = 0

Expand Down

0 comments on commit a9a0581

Please sign in to comment.