On Feb 19, 7:12 pm, "wyatt-bC" <[EMAIL PROTECTED]> wrote:

<...>

> map.resources :articles do |article|
>     article.resources :comments
> end

<...>

> > > I'm not sure exactly how you'd translate the Ruby above directly to
> > > Python, but I think it would be cool if Pylons had this feature... and
> > > I'd be glad to volunteer some time to working on it. Would this be
> > > fairly straightforward given the current architecture of Routes?
>
> > In Routes, it'd prolly require explicitly adding the stuff the mapping
> > anonymous block is doing, which is probably something like this:
>
> > map.resource('comment', 'comments', controller='article_comments',
> > name_prefix='article_', path_prefix='articles/:article_id')
>
> How about:
>
> map.resource('article', 'articles')
> map.resource('user', 'users')
> map.resource('comment', 'comments', nested_under='articles')
> map.resource('comment', 'comments', nested_under='users')
>
> One thing that's cool about the Rails version is that you can nest
> multiple resources at once inside the block:
>
> map.resources :articles do |article|
>     article.resources :comments
>     article.resources :tags
> end
>
> My question is, what sort of object is `article`? map.resource could
> return the `article` thingie, then the Python version could look like
> this:
>
> article = map.resource('article', 'articles')
> article.resource('comment', 'comments')
> article.resource('tag', 'tags')

Or maybe a `with` version would work:

with map.resource('article', 'article') as article:
    article.resource('comment', 'comments')
    article.resource('tag', 'tags')

This at least looks similar to the Rails version (though maybe not a
"proper" use of `with`?).


<...>

__wyatt


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to