[PEAK] sitemaps after refactoring
Radek Kanovsky
rk at dat.cz
Wed Apr 27 13:45:07 EDT 2005
I have found some problems in view registration. The code bellow worked
before the last sitemap/traverseView refactoring. If I use more than one
<location> tag, no view is found:
from peak.api import *
from urllib import quote
SITEMAP = '''\
<location id='root'>
<view name='index_html' object='1'/>
<location name='sub'>
<view name='index_html' object='2'/>
</location>
</location>
'''
root = config.makeRoot()
map = root.lookupComponent('ref:sitemap at data:,%s' % quote(SITEMAP))
policy = web.TestPolicy(map)
print policy.simpleTraverse('/', False).current # should print 1
print policy.simpleTraverse('/sub/', False).current # should print 2
Also if there is view on location and view for some content type with
the same name, traverseView raises AmbiguousMethod, if content type is
superclass of web.Location:
<location id='root'>
<view name='index_html' object='1'/>
<content type='object'>
<view name='index_html' object='2'/>
</content>
</location>
This example also worked before refactoring. There is workaround for
this but is unnatural:
<location id='root'>
<content type='web.Location'>
<view name='index_html' object='1'/>
</content>
<content type='object'>
<view name='index_html' object='2'/>
</content>
</location>
RadekK
More information about the PEAK
mailing list