Hi I have the following breadcrumbs method: <dtml-in PARENTS reverse> <dtml-with PARENTS> <dtml-if sequence-start> <a href="/nbs_online" class='cyan_link'>Home</a> <dtml-else> <dtml-if sequence-end><dtml-else>›› <a href="<dtml-var absolute_url>" class='cyan_link'><dtml-var title_or_id></a> </dtml-if> </dtml-if> </dtml-with> </dtml-in> The problem is when I am in a folder: a\b\c\d\index_html My breadcrumbs only displays a - b - c quite obviously because I only list the parents and it goes for d as the base node and lists all its parents Now if index_html is a dtml document shouldnt it consider that as the base object and then list all of its parents as a true breadcrumbs should?? What do I have to do to get that kind of thing going?? I think that the solution is to add the following in the end of the breadcrumbs: (in pseudo..) if calling_object not folder: list the containing folder How then do I get the information required to the the abovementioned.... namely: calling_object & containing_folder (which would merely be calling_object.parent)?? TIA AM -- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
AM wrote:
<dtml-in PARENTS reverse> <dtml-with PARENTS> <dtml-if sequence-start> <a href="/nbs_online" class='cyan_link'>Home</a> <dtml-else> <dtml-if sequence-end><dtml-else>›› <a href="<dtml-var absolute_url>" class='cyan_link'><dtml-var title_or_id></a> </dtml-if> </dtml-if> </dtml-with> </dtml-in>
Using PARENTS for breadrumbs is bogus. I would do have a python script called 'breadcrumbs': result = [] url = context.getPhysicalRoot().absolute_url() path = context.getPhysicalPath() for id in path: url = url + '/' + id result.append({'id':id,'url':url} return result[1:] # adjust as appropriate to get your site root Then just do the following in your method: <dtml-in breadcrumbs mapping> <a href="&dtml-url;">&dtml-id;</a> <dtml-unless sequence-end> ›› </dtml-unless> </dtml-in> cheers, Chris
I get an attribute error for getPhysicalRoot()... Traceback (innermost last): File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 150, in publish_module File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 114, in publish File /var/local/zope/leonardo/lib/python/Zope/__init__.py, line 159, in zpublisher_exception_hook (Object: layout) File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 98, in publish File /var/local/zope/leonardo/lib/python/ZPublisher/mapply.py, line 88, in mapply (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 39, in call_object (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Shared/DC/Scripts/Bindings.py, line 252, in __call__ (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Shared/DC/Scripts/Bindings.py, line 283, in _bindAndExec (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Products/PythonScripts/PythonScript.py, line 302, in _exec (Object: gen_nav_list) (Info: ({'script': <PythonScript instance at 8adb590>, 'context': <Folder instance at 8b69490>, 'container': <Folder instance at 8b69490>, 'traverse_subpath': []}, (), {}, None)) File Script (Python), line 2, in nav_path File /var/local/zope/leonardo/lib/python/AccessControl/ZopeGuards.py, line 58, in guarded_getattr (Object: layout) AttributeError: (see above) Is the functionality not there in Py2.1 My config Zope 2.5.x on RH7.2 with Python 2.1.2 TIA AM Chris Withers wrote:
AM wrote:
<dtml-in PARENTS reverse> <dtml-with PARENTS> <dtml-if sequence-start> <a href="/nbs_online" class='cyan_link'>Home</a> <dtml-else> <dtml-if sequence-end><dtml-else>›› <a href="<dtml-var absolute_url>" class='cyan_link'><dtml-var title_or_id></a> </dtml-if> </dtml-if> </dtml-with> </dtml-in>
Using PARENTS for breadrumbs is bogus.
I would do have a python script called 'breadcrumbs':
result = [] url = context.getPhysicalRoot().absolute_url() path = context.getPhysicalPath() for id in path: url = url + '/' + id result.append({'id':id,'url':url} return result[1:] # adjust as appropriate to get your site root
Then just do the following in your method:
<dtml-in breadcrumbs mapping> <a href="&dtml-url;">&dtml-id;</a> <dtml-unless sequence-end> ›› </dtml-unless> </dtml-in>
cheers,
Chris
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
Pretty much the sam ething... this time for aq_chain Traceback (innermost last): File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 150, in publish_module File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 114, in publish File /var/local/zope/leonardo/lib/python/Zope/__init__.py, line 159, in zpublisher_exception_hook (Object: layout) File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 98, in publish File /var/local/zope/leonardo/lib/python/ZPublisher/mapply.py, line 88, in mapply (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 39, in call_object (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Shared/DC/Scripts/Bindings.py, line 252, in __call__ (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Shared/DC/Scripts/Bindings.py, line 283, in _bindAndExec (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Products/PythonScripts/PythonScript.py, line 302, in _exec (Object: gen_nav_list) (Info: ({'script': <PythonScript instance at 8bd5ca8>, 'context': <Folder instance at 8a002c8>, 'container': <Folder instance at 8a002c8>, 'traverse_subpath': []}, (), {}, None)) File Script (Python), line 2, in gen_nav_list File /var/local/zope/leonardo/lib/python/AccessControl/ZopeGuards.py, line 58, in guarded_getattr (Object: layout) AttributeError: (see above) Do I have something missing in my installation?? I tried to run the script, the PyScript from my site root and got an unauthorised error (without the aq_chain part ie) with the aqchain part I get the same error as above. Traceback (innermost last): File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 150, in publish_module File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 114, in publish File /var/local/zope/leonardo/lib/python/Zope/__init__.py, line 159, in zpublisher_exception_hook (Object: Zope) File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 98, in publish File /var/local/zope/leonardo/lib/python/ZPublisher/mapply.py, line 88, in mapply (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 39, in call_object (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Shared/DC/Scripts/Bindings.py, line 252, in __call__ (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Shared/DC/Scripts/Bindings.py, line 283, in _bindAndExec (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Products/PythonScripts/PythonScript.py, line 302, in _exec (Object: gen_nav_list) (Info: ({'script': <PythonScript instance at 8c2c670>, 'context': <Application instance at 89d6a30>, 'container': <Application instance at 89d6a30>, 'traverse_subpath': []}, (), {}, None)) File Script (Python), line 2, in gen_nav_list File /var/local/zope/leonardo/lib/python/AccessControl/ZopeGuards.py, line 58, in guarded_getattr (Object: Zope) File /var/local/zope/leonardo/lib/python/AccessControl/ZopeGuards.py, line 40, in aq_validate (Object: Zope) File /var/local/zope/leonardo/lib/python/AccessControl/SecurityManager.py, line 83, in validate File /var/local/zope/leonardo/lib/python/AccessControl/ZopeSecurityPolicy.py, line 177, in validate Unauthorized: (see above) WHats going on?? TIA AM Chris Withers wrote:
AM wrote:
I get an attribute error for getPhysicalRoot()...
try putting:
raise repr((context.aq_chain,context))
...on the line before the getPhysicalRoot and let us know what the resultign exception type is.
cheers,
Chris
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
How are you calling the breadcrumbs script? Looks like you have something funky going on :-( Chris
well the script & dtml method that you provided I copied into a directory /site/layout In the same directory I have another method that calls the dtml method(yours) and finally all over the site dtml documents call the dtml method that calls the dtml method that calls the python script.... :) However The same errors are generated when I press the test tab on the script page. or the I try to view the dtml method that you provided TIA AM Chris Withers wrote:
How are you calling the breadcrumbs script?
Looks like you have something funky going on :-(
Chris
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
AM wrote:
well the script & dtml method that you provided I copied into a directory /site/layout In the same directory I have another method that calls the dtml method(yours)
Why this setup? Why not just include the DTML of my method in your method? How are you calling my method from your method?
and finally all over the site dtml documents call the dtml method that calls the dtml method that calls the python script.... :)
How is this calling done?
However The same errors are generated when I press the test tab on the script page. or the I try to view the dtml method that you provided
weird, sorry, out of luck :-( Chris
If I copy the same three lines into a PyScript at / url = context.getPhysicalRoot().absolute_url() print url return printed I get the : Error Type: Unauthorized Error Value: You are not allowed to access getPhysicalRoot in this context Traceback (innermost last): File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 150, in publish_module File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 114, in publish File /var/local/zope/leonardo/lib/python/Zope/__init__.py, line 159, in zpublisher_exception_hook (Object: Zope) File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 98, in publish File /var/local/zope/leonardo/lib/python/ZPublisher/mapply.py, line 88, in mapply (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/ZPublisher/Publish.py, line 39, in call_object (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Shared/DC/Scripts/Bindings.py, line 252, in __call__ (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Shared/DC/Scripts/Bindings.py, line 283, in _bindAndExec (Object: gen_nav_list) File /var/local/zope/leonardo/lib/python/Products/PythonScripts/PythonScript.py, line 302, in _exec (Object: gen_nav_list) (Info: ({'script': <PythonScript instance at 8ad5810>, 'context': <Application instance at 8c7aa58>, 'container': <Application instance at 8c7aa58>, 'traverse_subpath': []}, (), {}, None)) File Script (Python), line 3, in gen_nav_list File /var/local/zope/leonardo/lib/python/AccessControl/ZopeGuards.py, line 58, in guarded_getattr (Object: Zope) File /var/local/zope/leonardo/lib/python/AccessControl/ZopeGuards.py, line 40, in aq_validate (Object: Zope) File /var/local/zope/leonardo/lib/python/AccessControl/SecurityManager.py, line 83, in validate File /var/local/zope/leonardo/lib/python/AccessControl/ZopeSecurityPolicy.py, line 177, in validate Unauthorized: (see above) Why of Why?? TIA AM Chris Withers wrote:
AM wrote:
well the script & dtml method that you provided I copied into a directory /site/layout In the same directory I have another method that calls the dtml method(yours)
Why this setup? Why not just include the DTML of my method in your method? How are you calling my method from your method?
and finally all over the site dtml documents call the dtml method that calls the dtml method that calls the python script.... :)
How is this calling done?
However The same errors are generated when I press the test tab on the script page. or the I try to view the dtml method that you provided
weird, sorry, out of luck :-(
Chris
.
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
my final solution: result = [] url = container.REQUEST.BASE0 path = context.getPhysicalPath() for id in path: if id != '': url = url + '/' + id result.append({'id':id,'url':url}) return result # adjust as appropriate to get your site root Now the only problem is I wanted the titles for these thingies cos ids cant have spaces..... Anyway thanks a lot for your help. AM Chris Withers wrote:
AM wrote:
well the script & dtml method that you provided I copied into a directory /site/layout In the same directory I have another method that calls the dtml method(yours)
Why this setup? Why not just include the DTML of my method in your method? How are you calling my method from your method?
and finally all over the site dtml documents call the dtml method that calls the dtml method that calls the python script.... :)
How is this calling done?
However The same errors are generated when I press the test tab on the script page. or the I try to view the dtml method that you provided
weird, sorry, out of luck :-(
Chris
.
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
participants (2)
-
AM -
Chris Withers