thanks for all of your help, I learned a lot from the replies and have a 
basic understand how traversal works now.

However, I have a question about the view lookup in pyramid with traversal.
For example, in Paul's 
tutorial<http://docs.pylonsproject.org/projects/pyramid_tutorials/en/latest/humans/resources/step04/index.html>
 , 
in the views.py, there is an view named *add_folder*.  It can be access via*
 *http://127.0.0.1:8080/add_folder
However, as the context is Folder, it can also be accessed via 
http://127.0.0.1:8080/folder1/add_folder
That said, if I add resource and make a link like  
http://127.0.0.1:8080/x/y/z/a/b/c/folder1/add_folder<http://127.0.0.1:8080/folder1/add_folder>,
 
the 3 URLs mentioned are getting the same view.
Is it normal in Traversal? As I know this will not happen in URL Dispatch. 

Thanks again for the great help
On Thursday, September 5, 2013 10:18:05 AM UTC+10, Chung WONG wrote:
>
> Hi all,
>
> I have read all the docs available on pyramid's website, however I still 
> don't really understand how to get a basic traversal app working.
> The hello world example is good but I am not able to extend it. The ZODB 
> wiki is good too but it is a bit too much information to me with auth and 
> zodb.
> What I am trying to do is to add some views to the hello world example but 
> my understanding is very vague.
> I created a starter scaffolding.
>
> # __init__.py
> from pyramid.config import Configurator
> *from pyramid.response import Response*
>
> *class Resource(dict):*
> *    pass*
> *
> *
> *def get_root(request):*
> *    return 
> Resource({'a':Resource({'b':Resource({'c':Resource({'c':Resource()})})})})
> *
> *
> *
> *def hello_world_of_resources(context,request):*
> *    output="Here's a resource and its children: %s" % content*
> *    return Response(output)*
>
> def main(global_config, **settings):
>     """ This function returns a Pyramid WSGI application.
>     """
>     config = Configurator(settings=settings,root_factory=get_root)
>     config.add_static_view('static', 'static', cache_max_age=3600)
> *    config.add_view(hello_world_of_resources,context=Resource)*
>     config.scan()
>     return config.make_wsgi_app() 
>
>
> #views.py
> from pyramid.view import view_config
> *from pyramid.response import Response*
>
> *@view_config()*
> *def my_login(request):*
> *    return Response('login')*
> *
> *
> *@view_config()*
> *def my_logout(request):*
> *    return Response('logout')*
>
> I have no clue how to link the resource with the views. Did I miss 
> something import in the docs or are there any very basic/bare minimum 
> traversal only tutorial?
> Thanks in advance.
>
>

-- 
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 pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to