Re: [Zope] Key Error in Catalog Reindex

2007-01-25 Thread KJZZ Webmaster
Dieter, thank you for the suggestion on how to change 
\lib\python\OFS\DTMLMethod.py
to avoid the key error.

Before I went ahead and altered zope's the underlying code, I thought I would
try Andres' suggestion first, by rewriting the dtml method as a python script:

REQUEST = container.REQUEST
RESPONSE =  REQUEST.RESPONSE
REFERER = REQUEST.get_header('HTTP_REFERER')
catalog = context.Catalog

catalog.manage_catalogReindex(REQUEST, RESPONSE, REFERER)

RESPONSE.redirect(REFERER)

This seems to have fixed the issue.  I'll let you know if I notice anything
further.

Thanks kindly,

John T.


-- Original Message --
Date: Mon, 22 Jan 2007 18:01:30 +0100
From: Andreas Jung [EMAIL PROTECTED]

Rewrite the code using a PythonScript and check again for errors.



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Key Error in Catalog Reindex

2007-01-23 Thread KJZZ Webmaster
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 scr 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


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Key Error in Catalog Reindex

2007-01-22 Thread KJZZ Webmaster
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.



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Path Level in Catalog

2007-01-13 Thread KJZZ Webmaster
I recently had to rebuild our catalog using the manage_catalogFind form in
the ZMI.  In this case, I simply selected the object types that I wanted
recataloged, then clicked the find and catalog button.

However, I now notice that almost every object that was found is entered
into the catalog twice, once with the relative path from the top of the site,
and second with a path that begins above the folder in which the site is
contained, such as:

1) /myobject/

2) /mysite/myojbect

Tell me, does anyone have any suggestions for an expression to find and catalog
only objects with the first path and omit all objects starting with the second
path.

Any advice is appreciated.

John T.


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Mark Pilgrim's Feed Parser in Zope

2006-07-26 Thread KJZZ Webmaster
Dieter,

Appreciate your help.

I found a way to test if the ExternalMethod really returned a dict here:

http://infrae.com/mailman_/pipermail/silva-dev/2004q2/001091.html

And you were right! This is not seen as as a valid dictionary (nor is it
seen as a string):

stuff = container.externalmethod(feedurl=feedurl)
test = same_type(stuff, {})
print test
return printed

returns 0

However, interestingly enough, if I copy and paste the all the text that
is returned by the external method into the script, I am able to confirm
that it is a dictionary:

stuff= {'lastbuilddate': u'Mon, 24 Jul 2006 12:06:18 EDT', u'subtitle': 'U.S.',
u'generator': 'NPR/RSS Generator 2.0 etc...'}

test = same_type(stuff, {})
print test
return printed

returns 1

Also, I tried to render the copied text from the external method using the
page template, and received a different error message:

TypeError: string indices must be integers (see the attached traceback).

I don't know if this last test will be useful, but I thought I'd give it
a try.

Do you know if there is a way of changing the data type of an object?

Do you know if there is a listing of data types that I could test for?

Thanks kindly,

John T.


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 Shared.DC.Scripts.Bindings, line 311, in __call__
  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
  Module Products.PageTemplates.ZopePageTemplate, line 256, in _exec
  Module Products.PageTemplates.PageTemplate, line 102, in pt_render
   - ZopePageTemplate at /mypath/pagetemplate
  Module TAL.TALInterpreter, line 206, in __call__
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 649, in do_loop_tal
  Module Products.PageTemplates.TALES, line 206, in setRepeat
  Module Products.PageTemplates.TALES, line 221, in evaluate
   - URL: /mypath/pagetemplate
   - Line 2, Column 2
   - Expression: PythonExpr news['entries'][0:25]
   - Names:
  {'container': Folder at /mypath,
   'context': Folder at /mypath,
   'default': Products.PageTemplates.TALES.Default instance at 0x011205D0,
   'here': Folder at /mypath,
   'loop': Products.PageTemplates.TALES.SafeMapping object at 0x034A6BE8,
   'modules': Products.PageTemplates.ZRPythonExpr._SecureModuleImporter 
instance at 0x01103760,
   'nothing': None,
   'options': {'args': ()},
   'repeat': Products.PageTemplates.TALES.SafeMapping object at 
0x034A6BE8,
   'request': HTTPRequest, URL=http://localhost:/mypath/pagetemplate,
   'root': Application at ,
   'template': ZopePageTemplate at /mypath/pagetemplate,
   'traverse_subpath': [],
   'user': admin}
  Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
   - __traceback_info__: news['entries'][0:25]
  Module Python expression news['entries'][0:25], line 1, in expression
  Module AccessControl.ZopeGuards, line 67, in guarded_getitem
TypeError: string indices must be integers
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )