I am using zope 2.8.1. and am using the following dtml method to reindex the catalog: <dtml-let URL1=HTTP_REFERER> <dtml-call "Catalog.manage_catalogReindex(REQUEST, RESPONSE, URL1)"> <dtml-call expr="RESPONSE.redirect(URL1)"> </dtml-let> However, midway through the reindex, I am receiving the following error message: Traceback (innermost last): Module ZPublisher.Publish, line 113, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.DTMLMethod, line 153, in __call__ - <DTMLMethod at /somepath/somedtmlmethod> - Physical Path: //somepath/somedtmlmethod KeyError: 'validate' I checked the zope source file here: Zope-2.8.1-final\lib\python\OFS\DTMLMethod.py and found the reference to the "validate" method in line 128: if self.__dict__.has_key('validate'): first_time_through = 0 else: self.__dict__['validate'] = security.DTMLValidate first_time_through = 1 try: My questions are these: a) what changes could I to the catalog to avoid this error in the future? (I have already cleared and rebuilt our catalog using the manage_catalogFind tab within the catalog). Are there certain object types that I should keep out of the catalog? Is the catalog getting too large, and maybe the reindex is taking too long to complete? b) are there any changes to the script \lib\python\OFS\DTMLMethod.py that I could make which would eliminate, or at least render this error message harmless? When this key error occurs, the catalog does not index fully, and so objects are left out of the catalog. Thanks for your advice. John T.
Why --On 22. Januar 2007 09:53:51 -0700 KJZZ Webmaster <kjzz.webmaster@riomail.maricopa.edu> wrote:
I am using zope 2.8.1. and am using the following dtml method to reindex the catalog:
<dtml-let URL1=HTTP_REFERER> <dtml-call "Catalog.manage_catalogReindex(REQUEST, RESPONSE, URL1)"> <dtml-call expr="RESPONSE.redirect(URL1)"> </dtml-let>
Rewrite the code using a PythonScript and check again for errors. -aj
KJZZ Webmaster wrote at 2007-1-22 09:53 -0700:
I am using zope 2.8.1. and am using the following dtml method to reindex the catalog:
<dtml-let URL1=HTTP_REFERER> <dtml-call "Catalog.manage_catalogReindex(REQUEST, RESPONSE, URL1)"> <dtml-call expr="RESPONSE.redirect(URL1)"> </dtml-let>
However, midway through the reindex, I am receiving the following error message:
Traceback (innermost last): Module ZPublisher.Publish, line 113, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.DTMLMethod, line 153, in __call__ - <DTMLMethod at /somepath/somedtmlmethod> - Physical Path: //somepath/somedtmlmethod KeyError: 'validate'
I checked the zope source file here:
Zope-2.8.1-final\lib\python\OFS\DTMLMethod.py
and found the reference to the "validate" method in line 128:
if self.__dict__.has_key('validate'): first_time_through = 0 else: self.__dict__['validate'] = security.DTMLValidate first_time_through = 1 try:
My questions are these:
a) what changes could I to the catalog to avoid this error in the future?
Your problem is not in the catalog. If the "KeyError: 'validate'" really comes from the code snippet above, then you have a "DTMLMethod" with a very strange "__dict__". A normal dict would not raise a "KeyError: 'validate'", even when 'validate' indeed does not exist. If fear, this problem is big enough that debugging is necessary.
... Is the catalog getting too large, and maybe the reindex is taking too long to complete?
No (there is no limit on the catalog size. It may just get a bit slower).
b) are there any changes to the script \lib\python\OFS\DTMLMethod.py that I could make which would eliminate, or at least render this error message harmless?
Unlikely. The code (as least the quoted one) should work... -- Dieter
Dieter, I restarted zope in debug mode last night and recorded the following error: 2007-01-23T06:56:18 ERROR Zope.SiteErrorLog http://someurl/someobject/somedtmlmethod Traceback (most recent call last): File "X:\SomePath\Zope-2.8.1-final\lib\python\ZPublisher\Publish.py", line 113, in publish request, bind=1) File "X:\SomePath\Zope-2.8.1-final\lib\python\ZPublisher\mapply.py", line 88, in mapply if debug is not None: return debug(object,args,context) File "X:\SomePath\Zope-2.8.1-final\lib\python\ZPublisher\Publish.py", line 40, in call_object result=apply(object,args) # Type s<cr> to step into published object. File "X:\SomePath\Zope-2.8.1-final\lib\python\OFS\DTMLMethod.py", line 153, in __call__ del self.__dict__['validate'] KeyError: 'validate' Does this get us any closer to understanding the problem, or should we take another approach? I know Andreas suggested re-writing the dtml method: <dtml-let URL1=HTTP_REFERER> <dtml-call "Catalog.manage_catalogReindex(REQUEST, RESPONSE, URL1)"> <dtml-call expr="RESPONSE.redirect(URL1)"> </dtml-let> as a python script, then checking for errors. I will look into rewriting this code today. Do you have any additional suggestions?
If fear, this problem is big enough that debugging is necessary.
-- Dieter
KJZZ Webmaster wrote at 2007-1-23 10:13 -0700:
File "X:\SomePath\Zope-2.8.1-final\lib\python\OFS\DTMLMethod.py", line 153, in __call__ del self.__dict__['validate'] KeyError: 'validate'
Does this get us any closer to understanding the problem, or should we take another approach?
Yes. At least, this line can cause a "KeyError", even without assuming that we have a very strange "__dict__". On the other hand, when you look at the code in "DTMLMethod", you will see that deleting 'validate' is controlled by the local variable 'first_time_through". And "first_time_through" is set to "1", if 'validated' was defined by this call and to "0", when 'validated' was already there. Thus, locally, this looks quite safe. This implies that what you see indicates that something non-local is tempering with the "DTMLMethod"'s 'validate'. I cannot tell you what this "non-local" is but I have a workaround for you (you must modify the code, however). You can prepend an "if 'validate' in self.__dict__:" before the "del self.__dict__['validate']". -- Dieter
participants (3)
-
Andreas Jung -
Dieter Maurer -
KJZZ Webmaster