> 2. Are there ways to improve it? For example I would love to know how
>    you can check if you can actually render an object. (For example
>    you can not render Control_Panel).

To render your python product objects in Zope like
<dtml-var yourObject>
you just define a method __str__

take a look at python code for the base ZClass Renderable

probably the easiest thing to do in your python product

install renderable

in your python file 

import Renderable

and add Renderable as base class.

if you want have the display html in python you can do an extended
python string ''' '''

and define a method render that returns it

or use the HTMLFile and Globals (ala most Zope Products) and do it as an
html file

Cheers

Kapil

"Alexandre A. Rodioukov" wrote:
> 
> Hello folks.
> 
> I want to be able to render Zope objects from my python external
> method/product. Idea is to use it to render parent object. Here is
> code I came up so far with:
> 
> def view(self, REQUEST):
>         if self.meta_type == 'Folder':
>                 doc = self.aq_base.index_html(self, self.REQUEST)
>         else:
>                 doc = self.aq_base(self, self.REQUEST)
>         return doc
> 
> It does return rendered parent object, but I have some questions and
> probably request for improvement ideas :)
> 
> 1. The whole thing becomes broken with SiteAccess. Complains about
>    premissions/PhysicalRoot (AFAIR)
> 
> 2. Are there ways to improve it? For example I would love to know how
>    you can check if you can actually render an object. (For example
>    you can not render Control_Panel).
> 
> Possible use for it (to make the whole idea a bit clearer)
> 
> /index_html (some stuff in it)
> /view (above code in external method)
> 
> /index_html/view returns rendered index_html doing some magic with
> HTML/whatever is in it (for example encrypts it with public key, strips
> down carriage returns/tabs/spaces etc...) In other words acts as a
> filter.
> 
> Thanks for any advice,
> 
> Regards, Simuran.
> 
> _______________________________________________
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to