Commit b21ef5c5 authored by Michel Pelletier's avatar Michel Pelletier

Fixed URL redirection problems, catalogs in relative folders, and

other strangosities.
parent caab3639
...@@ -318,7 +318,6 @@ class Catalog(Persistent, Acquisition.Implicit): ...@@ -318,7 +318,6 @@ class Catalog(Persistent, Acquisition.Implicit):
""" """
if uid not in self.uids.keys(): if uid not in self.uids.keys():
'no object with uid %s' % uid
return return
rid = self.uids[uid] rid = self.uids[uid]
......
...@@ -201,15 +201,15 @@ class ZCatalog(Folder, FindSupport, Persistent, Implicit): ...@@ -201,15 +201,15 @@ class ZCatalog(Folder, FindSupport, Persistent, Implicit):
self._catalog.addColumn('summary') self._catalog.addColumn('summary')
self._catalog.addIndex('PrincipiaSearchSource', 'TextIndex') self._catalog.addIndex('PrincipiaSearchSource', 'TextIndex')
def manage_edit(self, threshold=1000, REQUEST=None):
def manage_edit(self, RESPONSE, URL1, threshold=1000, REQUEST=None):
""" edit the catalog """ """ edit the catalog """
self.threshold = threshold self.threshold = thresholdb
RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Catalog%20Changed')
message = "Object changed"
return self.manage_main(self, REQUEST,
manage_tabs_message=message)
def manage_catalogObject(self, REQUEST, urls=None): def manage_catalogObject(self, REQUEST, RESPONSE, URL1, urls=None):
""" index all Zope objects that 'urls' point to """ """ index all Zope objects that 'urls' point to """
if urls: if urls:
for url in urls: for url in urls:
...@@ -217,49 +217,41 @@ class ZCatalog(Folder, FindSupport, Persistent, Implicit): ...@@ -217,49 +217,41 @@ class ZCatalog(Folder, FindSupport, Persistent, Implicit):
if obj is not None: if obj is not None:
self.catalog_object(obj, url) self.catalog_object(obj, url)
message = "Objects Cataloged" RESPONSE.redirect(URL1 + '/manage_catalogView?manage_tabs_message=Object%20Cataloged')
return self.manage_main(self, REQUEST,
manage_tabs_message=message)
def manage_uncatalogObject(self, REQUEST, urls=None): def manage_uncatalogObject(self, REQUEST, RESPONSE, URL1, urls=None):
""" removes Zope object 'urls' from catalog """ """ removes Zope object 'urls' from catalog """
if urls: if urls:
for url in urls: for url in urls:
obj = self.resolve_url(url, REQUEST) self.uncatalog_object(url)
if obj is not None:
self.uncatalog_object(url) RESPONSE.redirect(URL1 + '/manage_catalogView?manage_tabs_message=Object%20Uncataloged')
message = "Object UnCataloged"
return self.manage_main(self, REQUEST,
manage_tabs_message=message)
def manage_catalogReindex(self, REQUEST): def manage_catalogReindex(self, REQUEST, RESPONSE, URL1):
""" clear the catalog, then re-index everything """ """ clear the catalog, then re-index everything """
#import pdb
#pdb.set_trace()
paths = tuple(self._catalog.paths.values()) paths = tuple(self._catalog.paths.values())
self.manage_catalogClear(REQUEST) self._catalog.clear()
for p in paths: for p in paths:
obj = self.resolve_url(p, REQUEST) obj = self.resolve_url(p, REQUEST)
if obj is not None: if obj is not None:
self.catalog_object(obj, p) self.catalog_object(obj, p)
message = "Catalog Reindexed" RESPONSE.redirect(URL1 + '/manage_catalogView?manage_tabs_message=Catalog%20Updated')
return self.manage_catalogView(self, REQUEST,
manage_tabs_message=message)
def manage_catalogClear(self, REQUEST): def manage_catalogClear(self, REQUEST, RESPONSE, URL1):
""" clears the whole enchelada """ """ clears the whole enchelada """
self._catalog.clear() self._catalog.clear()
message = "Catalog Cleared" RESPONSE.redirect(URL1 + '/manage_catalogView?manage_tabs_message=Catalog%20Cleared')
return self.manage_main(self, REQUEST,
manage_tabs_message=message)
def manage_catalogFoundItems(self, REQUEST, URL1, obj_metatypes=None, def manage_catalogFoundItems(self, REQUEST, RESPONSE, URL2, URL1,
obj_metatypes=None,
obj_ids=None, obj_searchterm=None, obj_ids=None, obj_searchterm=None,
obj_expr=None, obj_mtime=None, obj_expr=None, obj_mtime=None,
obj_mspec=None, obj_roles=None, obj_mspec=None, obj_roles=None,
...@@ -280,45 +272,40 @@ class ZCatalog(Folder, FindSupport, Persistent, Implicit): ...@@ -280,45 +272,40 @@ class ZCatalog(Folder, FindSupport, Persistent, Implicit):
REQUEST=REQUEST) REQUEST=REQUEST)
for n in results: for n in results:
self.catalog_object(n[1], n[0]) if REQUEST.script != "":
abs_path = string.split((URL2 +'/'+n[0]),
REQUEST.script)[1][1:]
self.catalog_object(n[1], abs_path)
message = "Objects Cataloged" RESPONSE.redirect(URL1 + '/manage_catalogView?manage_tabs_message=Catalog%20Updated')
return self.manage_catalogView(self, REQUEST,
manage_tabs_message=message)
def manage_addColumn(self, name, REQUEST):
def manage_addColumn(self, name, REQUEST, RESPONSE, URL1):
""" add a column """ """ add a column """
self._catalog.addColumn(name) self._catalog.addColumn(name)
message = "Column added" RESPONSE.redirect(URL1 + '/manage_catalogSchema?manage_tabs_message=Column%20Added')
return self.manage_catalogSchema(self, REQUEST,
manage_tabs_message=message)
def manage_delColumns(self, names, REQUEST): def manage_delColumns(self, names, REQUEST, RESPONSE, URL1):
""" del a column """ """ del a column """
for name in names: for name in names:
self._catalog.delColumn(name) self._catalog.delColumn(name)
message = "Columns deleted"
return self.manage_catalogSchema(self, REQUEST,
manage_tabs_message=message)
def manage_addIndex(self, name, type, REQUEST): RESPONSE.redirect(URL1 + '/manage_catalogSchema?manage_tabs_message=Column%20Deleted')
def manage_addIndex(self, name, type, REQUEST, RESPONSE, URL1):
""" add an index """ """ add an index """
self._catalog.addIndex(name, type) self._catalog.addIndex(name, type)
message = "Index added" RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Index%20Added')
return self.manage_catalogIndexes(self, REQUEST,
manage_tabs_message=message) def manage_delIndexes(self, names, REQUEST, RESPONSE, URL1):
def manage_delIndexes(self, names, REQUEST):
""" del an index """ """ del an index """
for name in names: for name in names:
self._catalog.delIndex(name) self._catalog.delIndex(name)
RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Index%20Deleted')
message = "Indexes deleted"
return self.manage_catalogIndexes(self, REQUEST,
manage_tabs_message=message)
def catalog_object(self, obj, uid): def catalog_object(self, obj, uid):
""" wrapper around catalog """ """ wrapper around catalog """
...@@ -444,7 +431,6 @@ class ZCatalog(Folder, FindSupport, Persistent, Implicit): ...@@ -444,7 +431,6 @@ class ZCatalog(Folder, FindSupport, Persistent, Implicit):
except: return None except: return None
Globals.default__class_init__(ZCatalog) Globals.default__class_init__(ZCatalog)
......
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