hi everyone,
I am working on a treemenu based on Mike Renfro's 'new generation
sitemap' and have modified slightly the scripts to do some extra
filtering of the objects before they are added to the treemenu. In
the script that finds child folders I have added a call to a script
onsiteCheck that checks whether the request comes from onsite or
from internet and if it has certain attribute or property, this
works fine (see below)
## Script (Python)
"list_child_folders"
##
# Find child folders of the current without a sitemap property
results=[]
ids=[]
for object in context.REQUEST.PARENTS[0].objectIds(['Folder', 'Page
Container']):
item=getattr(context, object)
if item.onsiteCheck()=="yes":
ids.append(object)
for id in ids:
object=getattr(context, id)
if hasattr(object.aq_explicit, 'siteMap'):
results.append(object)
return results
However when I try to do the same in the list_sibling_folders, I
get an AttributeError __call__
File
/zope/Zope-2.5.0-solaris-2.6-sparc/lib/python/Products/PythonScripts/PythonScript.py,
line 302, in _exec (Object: onsiteCheck) (Info: ({'script':
<PythonScript instance at 16ed4d8>, 'context': <Folder instance
at 1c4f7a0>, 'container': <Folder instance at 108f478>,
'traverse_subpath': []}, (), {}, None)) File Script (Python), line 7, in
onsiteCheck
Here is the list_sibling_folders script
# Find sibling folders within the current folder with a sitemap
property
results=[]
ids2=[]
if len(context.REQUEST.PARENTS)>1:
for object in context.REQUEST.PARENTS[1].objectIds(['Folder',
'Page Container']):
item=getattr(context, object)
if item.onsiteCheck()=="yes":
ids2.append(object)
for id in ids2:
object=getattr(context, id)
if hasattr(object.aq_explicit, 'siteMap'):
results.append(object)
return results
and here is the onsiteCheck script (not very well written, but
still....)
"""
Script used for the 'new generation sitemap': checks each item of the
top, parent,
child and sibling scripts for publishOffsite properties or attributes
(called in these scripts)
MR 27/6/02
"""
if context.Location() != 'internet':
return "yes"
elif context.meta_type=='Folder':
if (context.hasProperty('publishOffsite') and
(context.getProperty('publishOffsite')=="on")):
return "yes"
elif context.meta_type=='Page Container':
if (hasattr(context, 'publishOffsite') and (getattr(context,
'publishOffsite')=="on")):
return "yes"
Can anyone help please?
Thanks