Thanks. I was trying the __before__ method in the parent controller
as opposed to the leaf controller. Once I overrode the __before__
method in the leaf (child) controller, I was able to get the nesting
working for get and get_all. However, edit and delete fail in genshi
when trying to iterate through menu_items (even though I am not using
menu_items). I have posted a separate post to ask where I can find
the source code for CrudRestController.
Module ?:19 in <Expression
u'iter(sorted(tmpl_context.menu_items.iteritems()))'>
<< <div style="float:left; padding-left:0px;">
<ul id="menu_items" py:if="hasattr(tmpl_context,
'menu_items')">
<li py:for="lower, item in
sorted(tmpl_context.menu_items.iteritems())">
<a href="${'../' * (1 + value_of('pk_count', 1))}$
{lower}s/">$item.__name__</a>
</li>
>> <li py:for="lower, item in sorted(tmpl_context.menu_items.iteritems())">
Module genshi.template.eval:321 in lookup_attr view
Module genshi.template.eval:405 in undefined view
UndefinedError: '' has no member named "iteritems"
==================
On Apr 6, 11:21 pm, Wesley Dyk <[email protected]> wrote:
> On Mon, Apr 5, 2010 at 6:20 PM, ozwyzard <[email protected]> wrote:
> > When using CRUDRestController, is there a way to implement REST style
> > URLs as follows?
> > http://website.com/controller_1/arg_11/arg_12/controller_2/arg_21/arg_22
>
> > It seems the CRUDRestController is not derived from
> > ObjectDispatchController, so the new TG2 'lookup' method does not
> > apply. As a workaround, I am trying to implement the above by
> > instantiating controller2 within controller1's get_one() method.
>
> > References:
> >http://turbogears.org/2.0/docs/modules/tgcontroller.html#tg.controlle...
> >http://turbogears2.sourcearchive.com/documentation/2.0.1/controllers_...
>
> > Thanks.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "TurboGears" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/turbogears?hl=en.
>
> I would check out this link on the RestController implementation of
> the same style. The key is the __before__ method. CrudRestController
> implements this method, so be sure to call it if you override it.
>
> http://turbogears.org/2.0/docs/main/RestControllers.html#nesting-reso...
>
> Wes
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.