Re: [Zope-Checkins] Re: [Checkins] SVN: Zope/trunk/ Added LAZY_FILE_LOADING constant to PageTemplateFile. When set to True Page Template files aren't lo

2008-03-09 Thread Martijn Faassen
Hey,

The modification was made to the Zope 2 part of ZPT. It'd be nice if
this change could be made in the Zope 3 libraries? I guess this was
investigated but found impractical?

Regards,

Martijn
___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


Re: [Zope-Checkins] Re: [Checkins] SVN: Zope/trunk/ Added LAZY_FILE_LOADING constant to PageTemplateFile. When set to True Page Template files aren't lo

2007-10-17 Thread Christian Theune
Am Mittwoch, den 17.10.2007, 11:13 +0200 schrieb Wichert Akkerman:
 Previously Christian Theune wrote:
  Cool,
  
  Am Dienstag, den 16.10.2007, 17:16 -0400 schrieb Hanno Schlichting:
   Log message for revision 80896:
 Added LAZY_FILE_LOADING constant to PageTemplateFile. When set to True 
   Page Template files aren't lo
 aded and parsed on Zope startup anymore, but on first access instead. 
   When complex add-ons like Plon
 e are installed this can safe up to 30% of the Zope startup time. This 
   gets a ZConfig switch ones I 
 figured out how to write one ;)
 
   Modified: Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py
   ===
   --- Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py  
   2007-10-16 20:12:30 UTC (rev 80895)
   +++ Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py  
   2007-10-16 21:16:07 UTC (rev 80896)
   @@ -31,6 +31,8 @@

LOG = getLogger('PageTemplateFile')

   +LAZY_FILE_LOADING = False
   +
def guess_type(filename, text):
  
  
  Hmm. Maybe an option that can actually be configured would be better?
  What about adding an option to zope.conf?
 
 The commit message said:
 
This gets a ZConfig switch ones I figured out how to write one ;)
 
 perhaps you know how that works? :)

Argh. I, I missed that. :)

Sure.

Edit Zope2/Startup/zopeschema.xml

There you need to add a key, something like:

key name=lazy-file-loading datatype=boolean default=true
 description
   ...
 /description
/key

In the actual code you can go and fetch the current configuration and
read this attribute using:

import App.config
App.config.getConfiguration().lazy_file_loading

Notice that the Python attribute has underscores instead of hyphens.

Christian

-- 
gocept gmbh  co. kg - forsterstrasse 29 - 06112 halle/saale - germany
www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins