RE: [Zope3-Users] Re: How can I get a viewlet's docstring from within aviewlet manager?

2008-06-19 Thread Andreas Johnsen
Thanks, that solved my problem. Now I can get hold of the docstring I
want with "viewlet.__class__.__base__.__doc__" 


Andreas

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Philipp 
> von Weitershausen
> Sent: 14. juni 2008 11:22
> To: zope3-users@zope.org
> Subject: [Zope3-Users] Re: How can I get a viewlet's 
> docstring from within aviewlet manager?
> 
> Andreas Johnsen wrote:
> > Let's say I have defined 'class MyViewlet(viewlet.ViewletBase)' and 
> > registered it with the  directive. The class 
> > 'MyViewlet' has a docstring. How can I get this docstring from the
> > render() method in a viewlet manager?
> > 
> > In the viewlet manager the viewlet instance is an instance of 
> > 'zope.viewlet.metaconfigure.MyViewlet' and not my class 'MyViewlet'.
> 
> Yeah. Dynamic class generation sucks. For some reason, the 
> bad example led by browser:page et.al. has caught on and now 
> nearly all browser-related ZCML directives do it.
> 
> > Is there a path from 'zope.viewlet.metaconfigure.MyViewlet' to the 
> > class 'MyViewlet' or any other suggestions on how to get 
> the docstring 
> > defined in my class from a viewlet manager?
> 
> You could get the right base class from __bases__ and look at 
> that class's __doc__.
> 
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
> 
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] How can I get a viewlet's docstring from within a viewlet manager?

2008-06-14 Thread Andreas Johnsen
Hei,
 
Let's say I have defined 'class MyViewlet(viewlet.ViewletBase)' and registered 
it with the  directive. The class 'MyViewlet' has a docstring. 
How can I get this docstring from the render() method in a viewlet manager?
 
In the viewlet manager the viewlet instance is an instance of 
'zope.viewlet.metaconfigure.MyViewlet' and not my class 'MyViewlet'. Is there a 
path from 'zope.viewlet.metaconfigure.MyViewlet' to the class 'MyViewlet' or 
any other suggestions on how to get the docstring defined in my class from a 
viewlet manager?
 
 
Best regards,
 
Andreas
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


RE: [Zope3-Users] How can I determine (in code) if the instance isrunning in devmode or not?

2008-05-30 Thread Andreas Johnsen
Thanks! 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Marius Gedminas
> Sent: 30. mai 2008 12:12
> To: zope3-users@zope.org
> Subject: Re: [Zope3-Users] How can I determine (in code) if 
> the instance isrunning in devmode or not?
> 
> On Wed, May 28, 2008 at 04:45:13PM +0200, Andreas Johnsen wrote:
> > I want to insert some extra HTML from a viewlet manager 
> when running 
> > in devmode. How can I determine (in code) if the instance 
> is running 
> > in devmode or not?
> 
> from zope.app.appsetup.appsetup import getConfigContext
> 
> def is_devmode_enabled():
> """Is devmode enabled in zope.conf?"""
> config_context = getConfigContext()
> return config_context.hasFeature('devmode')
> 
> Regards,
> Marius Gedminas
> --
> "Don't trust a statistic you haven't faked yourself."
>   -- Seen in another posting by Markus Kuhn
> 
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] How can I determine (in code) if the instance is running in devmode or not?

2008-05-28 Thread Andreas Johnsen
Hei,

I want to insert some extra HTML from a viewlet manager when running in
devmode. How can I determine (in code) if the instance is running in
devmode or not?


Best regards,

Andreas
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Any performance issues with the macro attribute in the z3c:template directive?

2008-02-28 Thread Andreas Johnsen
Hei all Zopers,

I find the macro parameter in the z3c:template very useful for working
with templates for viewlets and pagelets. I guess it's slower to extract
a html-snippet from within a page template file (by including a macro
parameter) then including the entire page template file (by not
including the macro parameter). 

So before implementing this technique on a large scale, I want to ask if
anyone have experienced any performance issues with this technique?



Best regards,

Andreas
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


RE: [Zope3-Users] When should I use z3c.macroviewlet?

2008-02-27 Thread Andreas Johnsen
Thanks for a quick answer.

> > 
> > So in which use cases are z3c.macroviewlet the best option?
> 
> The idea behind the macroviewlet is the option to let you 
> define only one page template. The macroviewlet allows you to 
> register snippets from this template and the same template 
> could be used as layout template. This means you could really 
> support an XHTML template with the full layout including all 
> viewlets in it.
> 
> The main goal was to use the nice templates from the graphic 
> desingers without any additional templates. 
> 

It's more or less the same goal I want to achieve, but I thought I could
do the same with z3c.template (and the browser:viewlet directive).
Similar to the way z3c.template can be used to extract a snippet
(defined by a macro) from a page template for a pagelet. 

But that may not be the case and that's why a package like
z3c.macroviewlet has been made.


Andreas
  
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] When should I use z3c.macroviewlet?

2008-02-27 Thread Andreas Johnsen
Hei all Zopers,

I try to catch up with all the latest best practices on writing skins
and templates for Zope 3 - e.g. transforming from metal macros based
templates to viewlets, pagelets, layout templates and content templates
(the Z3C way of doing it). 

All this looks very nice! But there is one new kid on the block that I
don't grasp: z3c.macroviewlets.

I do understand that I can use the ZCML directive to extract a viewlet
from a defined macro in a page template, but is'nt this exactly the same
I can archive with z3c.template? 

The only difference I can see is that with z3c.template I will need two
directives to archive this; one for the viewlet (e.g. http://mail.zope.org/mailman/listinfo/zope3-users