If I understood correctly, context allways a dict if path='/'
But if I do context={'/': <About company>, 'foo12': <foo12>} and path ='/' it
would be logical to return <About company> like path='/foo12' return
<foo12>.
Maybe check root path there
https://github.com/Pylons/pyramid/blob/master/pyramid/traversal.py#L724
if path='/' and hasattr(ob, '__getitem__'):
try:
ob = ob.__getitem__('/')
except KeyError:
pass
On Tuesday, May 20, 2014 2:58:21 PM UTC+6, Jens W. Klein wrote:
>
> On 2014-05-20 09:00, uralbash wrote:
> > Hello,
> >
> > I'm trying to go to home page (http://localhost:6543/) through
> > traversal. What should be the key of context to traversal choice it?
>
> Root is not a key in the dict: the dict object itself is root (context).
>
> So the root is a dict - or dict-like - and all 'contained' are fetched
> by calling __getitem__ on root (and for subpaths on the subobjects, it's
> a tree).
>
> HTH Jens
>
> > config.add_route('pages_view', '/*traverse',
> > factory='sacrud_pages.routes.root_factory')
> >
> > My context {'': <About company>, 'foo12': <foo12>}
> >
> > 1) http://localhost:6543/ - not choice <About company>
> >
> > >>> PATH_INFO = '/'
> > >>> PATH_INFO.split('/')
> > ['', '']
> >
> > 2) http://localhost:6543/foo12 - It OK (choice foo12)
> >
> > >>> PATH_INFO = '/foo12'
> > >>> PATH_INFO.split('/')
> > ['', 'foo12']
>
>
> --
> Klein & Partner KG, member of BlueDynamics Alliance
>
>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.