Render another objects main macro

classic Classic list List threaded Threaded
3 messages Options
Jan Filip Tristan Hasecke Jan Filip Tristan Hasecke
Reply | Threaded
Open this post in threaded view
|

Render another objects main macro

Hi,

I've got a little problem.
I have got two Objects one with the paths x/y/z and the other one with a/b/c.

Now I have got a custom view for object z which shall render everything that is within c's main macro.

I've tryed:

<div tal:define="portal context/@@plone_portal_state/portal">
            <div metal:use-macro="portal/a/b/c/main_template/macros/main"></div>
</div>

But I get the following error:

http://pastebin.com/CKrgSEpZ

Does anyone know a solution, how to render some objects main macro in another objects view?

Thank you very much
-Filip

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Nathan Van Gheem Nathan Van Gheem
Reply | Threaded
Open this post in threaded view
|

Re: Render another objects main macro

You'll have to use the actual view you want to render--not the
main_template I think.

so portal/a/b/c/viewname/macros/main

Otherwise, you can grab it within python code. Something like this
I've used in a project--edited a bit::

        try:
            view = aq_acquire(object, viewname)
        except AttributeError:
            view = queryMultiAdapter((self.context, self.request),
                                     name=viewname)

        if view:
            view = view.__of__(object)
            try:
                return view['macros']['main']
            except AttributeError:
                return view.macros['main']

Then use in template with:

<div metal:use-macro="view/main_macro" />

2012/4/14 Filip Hasecke <[hidden email]>:

> Hi,
>
> I've got a little problem.
> I have got two Objects one with the paths x/y/z and the other one with
> a/b/c.
>
> Now I have got a custom view for object z which shall render everything that
> is within c's main macro.
>
> I've tryed:
>
> <div tal:define="portal context/@@plone_portal_state/portal">
>             <div
> metal:use-macro="portal/a/b/c/main_template/macros/main"></div>
> </div>
>
> But I get the following error:
>
> http://pastebin.com/CKrgSEpZ
>
> Does anyone know a solution, how to render some objects main macro in
> another objects view?
>
> Thank you very much
> -Filip
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Plone-Users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-users
>

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Luca Fabbri Luca Fabbri
Reply | Threaded
Open this post in threaded view
|

Re: Render another objects main macro

In reply to this post by Jan Filip Tristan Hasecke
2012/4/14 Filip Hasecke <[hidden email]>:

> Hi,
>
> I've got a little problem.
> I have got two Objects one with the paths x/y/z and the other one with
> a/b/c.
>
> Now I have got a custom view for object z which shall render everything that
> is within c's main macro.
>
> I've tryed:
>
> <div tal:define="portal context/@@plone_portal_state/portal">
>             <div
> metal:use-macro="portal/a/b/c/main_template/macros/main"></div>
> </div>
>
> But I get the following error:
>
> http://pastebin.com/CKrgSEpZ
>
> Does anyone know a solution, how to render some objects main macro in
> another objects view?
>

Check how bda.contentproxy works


--
-- luca

twitter: http://twitter.com/keul
linkedin: http://linkedin.com/in/lucafbb
blog: http://blog.keul.it/

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users