Commit b3819363 authored by Michel Pelletier's avatar Michel Pelletier

Closer

parent cf2486a5
...@@ -95,6 +95,7 @@ class Catalog(Persistent, Acquisition.Implicit): ...@@ -95,6 +95,7 @@ class Catalog(Persistent, Acquisition.Implicit):
for key, value in self.schema.items(): for key, value in self.schema.items():
scopy[key]=value scopy[key]=value
scopy['data_record_id_']=len(self.schema.keys()) scopy['data_record_id_']=len(self.schema.keys())
scopy['data_record_unique_id_'] = seLfy.paths[scopy['data_record_id_']]
mybrains.__theCircularGottaCoverUpABugRefOfJoy = mybrains mybrains.__theCircularGottaCoverUpABugRefOfJoy = mybrains
mybrains.__record_schema__ = scopy mybrains.__record_schema__ = scopy
......
...@@ -98,7 +98,7 @@ import Products ...@@ -98,7 +98,7 @@ import Products
from Acquisition import Implicit from Acquisition import Implicit
from Persistence import Persistent from Persistence import Persistent
from Catalog import Catalog, orify from Catalog import Catalog, orify
import pdb import pdb, traceback
manage_addZCatalogForm=HTMLFile('addZCatalog',globals()) manage_addZCatalogForm=HTMLFile('addZCatalog',globals())
...@@ -141,6 +141,7 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit): ...@@ -141,6 +141,7 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
manage_catalogView = HTMLFile('catalogView',globals()) manage_catalogView = HTMLFile('catalogView',globals())
manage_catalogFind = HTMLFile('catalogFind',globals()) manage_catalogFind = HTMLFile('catalogFind',globals())
manage_catalogFindResult = HTMLFile('catalogFindResult',globals()) manage_catalogFindResult = HTMLFile('catalogFindResult',globals())
manage_catalogSchema = HTMLFile('catalogSchema', globals())
manage_main = HTMLFile('catalogView',globals()) manage_main = HTMLFile('catalogView',globals())
...@@ -163,7 +164,17 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit): ...@@ -163,7 +164,17 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
""" 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:
try:
# if an error happens here, the catalog will be in
# an unstable state. If this happens, ignore the
# object.
obj = self.resolve_url(url, REQUEST) obj = self.resolve_url(url, REQUEST)
except:
## print 'resolve_url failed while cataloging'
## c, i, t = sys.exc_info()
## traceback.print_exc()
continue
self.catalog_object(obj, url) self.catalog_object(obj, url)
return MessageDialog(title="Bah!", return MessageDialog(title="Bah!",
...@@ -176,7 +187,14 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit): ...@@ -176,7 +187,14 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
if urls: if urls:
for url in urls: for url in urls:
try:
obj = self.resolve_url(url, REQUEST) obj = self.resolve_url(url, REQUEST)
except:
print 'resolve_url failed while uncataloging'
c, i, t = sys.exc_info()
traceback.print_exc()
continue
print 'uncataloging %s' % url
self.uncatalog_object(url) self.uncatalog_object(url)
return MessageDialog(title="Bah!", return MessageDialog(title="Bah!",
...@@ -189,6 +207,8 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit): ...@@ -189,6 +207,8 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
references and refreshing objects""" references and refreshing objects"""
items = tuple(self._catalog.uids.items()) items = tuple(self._catalog.uids.items())
self._catalog.clear()
for path, i in items: for path, i in items:
try: try:
obj = self.resolve_url(path, REQUEST) obj = self.resolve_url(path, REQUEST)
...@@ -340,12 +360,21 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit): ...@@ -340,12 +360,21 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
# waaa - traversal may return a "default object" # waaa - traversal may return a "default object"
# like an index_html document, though you really # like an index_html document, though you really
# wanted to get a Folder back :( # wanted to get a Folder back :(
## print path
## print `object`
## print (str(req.PARENTS))
if hasattr(object, 'id'):
if callable(object.id): if callable(object.id):
name=object.id() name=object.id()
else: name=object.id else: name=object.id
if name != os.path.split(path)[-1] and \ elif hasattr(object, '__name__'):
hasattr(object, 'aq_parent'): name=object.__name__
return object.aq_parent else: name=''
if name != os.path.split(path)[-1]:
return req.PARENTS[0]
return object return object
raise rsp.errmsg, sys.exc_value raise rsp.errmsg, sys.exc_value
......
...@@ -37,8 +37,8 @@ can also remove or update individual catalog records. ...@@ -37,8 +37,8 @@ can also remove or update individual catalog records.
<!--#/in--> <!--#/in-->
<form action="<!--#var URL1-->/"> <form action="<!--#var URL1-->/">
<input type="submit" value=" Remove " NAME="manage_catalogRemove:method"> <input type="submit" value=" Remove " NAME="manage_uncatalogObject:method">
<input type="submit" value=" Update " NAME="manage_catalogReindex:method"> <input type="submit" value=" Update " NAME="manage_catalogObject:method">
<!--#comment--> <!--#comment-->
<input type="submit" value=" VOODOO " <input type="submit" value=" VOODOO "
NAME="manage_enterDebuger:method"> NAME="manage_enterDebuger:method">
...@@ -50,8 +50,8 @@ NAME="manage_enterDebuger:method"> ...@@ -50,8 +50,8 @@ NAME="manage_enterDebuger:method">
<tr valign=top> <tr valign=top>
<td valign="middle" align="center"> <td valign="middle" align="center">
<INPUT TYPE="checkbox" NAME="ids:int:list" VALUE="<!--#var <INPUT TYPE="checkbox" NAME="urls:list" VALUE="<!--#var
data_record_id_-->"> data_record_unique_id_-->">
</TD> </TD>
<td valign="top"><!--#var meta_type--></td> <td valign="top"><!--#var meta_type--></td>
<td valign="top" align="left"> <td valign="top" align="left">
......
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