[PEAK] sitemaps: <content> in non-root <location>

Phillip J. Eby pje at telecommunity.com
Mon Dec 20 12:22:27 EST 2004


At 02:10 PM 12/20/04 +0100, Radek Kanovsky wrote:
>Hi all,
>
>I have a problem with following sitemap:
>
>     <location id='root'>
>       <location name='nums'>
>          <container object="{'1':1,'2':2,'3':3}"/>
>          <view name='index_html' resource='test/show.pwt'/>
>          <content type='int'>
>             <view name='index_html' resource='test/show_num.pwt'/>
>          </content>
>       </location>
>     </location>
>
>It doesn't work as I would expect. View 'index_html' (i.e. 'show_num.pwt'
>template) is not found for int objects returned from container when
>traversing URLs like '/nums/X/'. Workaround for this is to move whole
>'<content>..</content>' block one level up:
>
>     <location id='root'>
>       <location name='nums'>
>          <container object="{'1':1,'2':2,'3':3}"/>
>          <view name='index_html' resource='test/show.pwt'/>
>       </location>
>       <content type='int'>
>         <view name='index_html' resource='test/show_num.pwt'/>
>       </content>
>     </location>
>
>Then one cannot have two locations '/nums' and '/fancy_nums' operating
>over the same container but showing int objects in different ways.
>Am I correct or do I need to use some other approach? I have tried
>to force peak.web doing things my way but unsuccessfuly yet.

That's weird.  I could've sworn there are unit tests that do basically the 
same thing as you're doing.  Indeed, if you look at 
peak.web.tests.test_resources.LocationTests, there are several that 
register views on a nested location.

Maybe there's a problem with the sitemap mechanism itself, though, as 
test_sitemap doesn't seem to do any tests with registering a view with a 
nested location like this.  So, I guess another test case is needed.




More information about the PEAK mailing list