[Zope-Checkins] SVN: Zope/trunk/ merging Zope211-3.4-integration branch

2008-03-09 Thread Andreas Jung
Log message for revision 77097:
  merging Zope211-3.4-integration branch
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  _U  Zope/trunk/lib/python/
  U   Zope/trunk/lib/python/Products/Five/event.zcml
  U   Zope/trunk/lib/python/Products/Five/form/tests/forms.txt
  U   Zope/trunk/lib/python/Products/Five/i18n.zcml
  U   Zope/trunk/lib/python/Products/Five/meta.zcml
  U   Zope/trunk/lib/python/Products/PageTemplates/www/ptEdit.zpt
  D   Zope/trunk/lib/python/Products/Transience/tests/testCounters.py
  U   Zope/trunk/lib/python/ZPublisher/HTTPRequest.py
  U   Zope/trunk/lib/python/ZPublisher/tests/testHTTPRequest.py
  U   Zope/trunk/lib/python/tempstorage/tests/testTemporaryStorage.py
  _U  Zope/trunk/lib/python/zope/
  _U  Zope/trunk/lib/python/zope/app/
  U   Zope/trunk/setup.py
  _U  Zope/trunk/utilities/

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2007-06-26 14:03:20 UTC (rev 77096)
+++ Zope/trunk/doc/CHANGES.txt  2007-06-26 14:07:01 UTC (rev 77097)
@@ -4,6 +4,10 @@
   Change information for previous versions of Zope can be found in the
   file HISTORY.txt.
 
+  Todo
+
+ - Fix ZClasses (once again)
+
   Trunk  (unreleased)
 
 Restructuring
@@ -51,6 +55,10 @@
 
 Features added
 
+  - integrated ZODB 3.8
+
+  - integraed Zope 3.4
+
   - Support for using zopectl on Windows has been added. All commands are
 supported and there are two Windows specific ones: install and remove,
 which install or remove the Windows service. The start, stop and
@@ -97,6 +105,7 @@
 
 Bugs Fixed
 
+<<< .working
   - Five.browser.metaconfigure.page didn't protect names from interface
 superclasses (http://www.zope.org/Collectors/Zope/2333)
 
@@ -139,6 +148,8 @@
 XML representation for that property to show a namespace of
 xmlns="None".  Fixed within OFS.PropertySheets.dav__propstat.
 
+  - integrated theuni's additional test from 2.11 (see r73132)
+
   - Relaxed requirements for context of
 Products.Five.browser.pagetemplatefile.ZopeTwoPageTemplateFile,
 to reduce barriers for testing renderability of views which


Property changes on: Zope/trunk/lib/python
___
Name: svn:externals
   - ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1
BTrees -r 68677 
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/BTrees
persistent -r 68677 
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/persistent
ThreadedAsync  -r 68677 
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ThreadedAsync
transaction-r 68677 
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/transaction
ZEO-r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZEO
ZODB   -r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZODB
ZopeUndo   -r 68677 
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZopeUndo
zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon
pytz   -r 69031 
svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/pytz
zodbcode   -r 69031 
svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/zodbcode
mechanize  -r 69031 
svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/mechanize
docutils   svn://svn.zope.org/repos/main/docutils/tags/0.4.0-zope
ClientForm svn://svn.zope.org/repos/main/Zope3/trunk/src/ClientForm
RestrictedPython   
svn://svn.zope.org/repos/main/RestrictedPython/tags/3.4.1/src/RestrictedPython

   + ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1
BTrees svn://svn.zope.org/repos/main/ZODB/trunk/src/BTrees
persistent svn://svn.zope.org/repos/main/ZODB/trunk/src/persistent
ThreadedAsync  svn://svn.zope.org/repos/main/ZODB/trunk/src/ThreadedAsync
transactionsvn://svn.zope.org/repos/main/ZODB/trunk/src/transaction
ZEOsvn://svn.zope.org/repos/main/ZODB/trunk/src/ZEO
ZODB   svn://svn.zope.org/repos/main/ZODB/trunk/src/ZODB
ZopeUndo   svn://svn.zope.org/repos/main/ZODB/trunk/src/ZopeUndo
zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon
pytz   svn://svn.zope.org/repos/main/Zope3/trunk/src/pytz
#zodbcode   svn://svn.zope.org/repos/main/Zope3/trunk/src/zodbcode
zodbcode   svn://svn.zope.org/repos/main/zodbcode/trunk/src/zodbcode
mechanize  svn://svn.zope.org/repos/main/Zope3/trunk/src/mechanize
docutils   svn://svn.zope.org/repos/main/docutils/tags/0.4.0-zope
ClientForm svn://svn.zope.org/repos/main/Zope3/trunk/src/ClientForm

RestrictedPython   
svn://svn.zope.org/repos/main/RestrictedPython/tags/3.4.1/src/RestrictedPython


Modified: Zope/trunk/lib/python/Products/Five/event.zcml
===
--- Zope/trunk/lib/python/Products/Five/event.zcml  2007-06-26 14:03:20 UTC 
(rev 77096)
+

[Zope-Checkins] SVN: Zope/trunk/ Merging

2006-12-20 Thread Andreas Jung
Log message for revision 71628:
  Merging 
  
  /Zope/branches/ajung-zpt-encoding-fixes
  
  This branch fixes several encoding issues with the ZopePageTemplate
  implementation, some webdav issues and now uses unicode internally
  for ZPT instances (but not for the PageTemplate(File) classes)
   
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py
  U   Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py
  U   Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  A   Zope/trunk/lib/python/Products/PageTemplates/utils.py
  U   Zope/trunk/lib/python/Products/PageTemplates/www/default.html
  U   Zope/trunk/lib/python/Products/PageTemplates/www/ptEdit.zpt

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2006-12-20 16:46:11 UTC (rev 71627)
+++ Zope/trunk/doc/CHANGES.txt  2006-12-20 16:54:06 UTC (rev 71628)
@@ -39,6 +39,8 @@
 until the late startup phase. This in in particular useful when running
 Zope behind a loadbalancer (patch by Patrick Gerken).
 
+  - the ZopePageTemplate implementation now uses unicode internally.   
 
+
 Bugs Fixed
 
   - Collector #2191: extended DateTime parser for better support

Modified: Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py
===
--- Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py
2006-12-20 16:46:11 UTC (rev 71627)
+++ Zope/trunk/lib/python/Products/PageTemplates/PageTemplateFile.py
2006-12-20 16:54:06 UTC (rev 71628)
@@ -32,6 +32,14 @@
 LOG = getLogger('PageTemplateFile')
 
 def guess_type(filename, text):
+
+# check for XML ourself since guess_content_type can't
+# detect text/xml  if 'filename' won't end with .xml
+# XXX: fix this in zope.contenttype
+
+if text.startswith('', re.M)
+from Products.PageTemplates.utils import encodingFromXMLPreamble, 
charsetFromMetaEquiv
+
 
 preferred_encodings = ['utf-8', 'iso-8859-15']
 if os.environ.has_key('ZPT_PREFERRED_ENCODING'):
 preferred_encodings.insert(0, os.environ['ZPT_PREFERRED_ENCODING'])
+  
 
-def sniffEncoding(text, default_encoding='utf-8'):
-"""Try to determine the encoding from html or xml"""
-if text.startswith('hello world'
+iso885915_str = 'üöäÜÖÄß'
+utf8_str = unicode(iso885915_str, 'iso-8859-15').encode('utf-8')
+
+xml_template = '''
+
+üöäÜÖÄß
+
+'''
+
+xml_iso_8859_15 = xml_template % 'iso-8859-15'
+xml_utf8 = unicode(xml_template, 'iso-8859-15').encode('utf-8') % 'utf-8'
+
+html_template_w_header = '''
+
+
+
+
+
+test üöäÜÖÄß
+
+
+'''
+
+html_iso_8859_15_w_header = html_template_w_header % 'iso-8859-15'
+html_utf8_w_header = unicode(html_template_w_header, 
'iso-8859-15').encode('utf-8') % 'utf-8'
+
+html_template_wo_header = '''
+
+
+test üöäÜÖÄß
+
+
+'''
+
+html_iso_8859_15_wo_header = html_template_wo_header 
+html_utf8_wo_header = unicode(html_template_wo_header, 
'iso-8859-15').encode('utf-8') 
+
+
+installProduct('PageTemplates')
+
+class ZPTUtilsTests(unittest.TestCase):
+
+def testExtractEncodingFromXMLPreamble(self):
+extract = encodingFromXMLPreamble
+self.assertEqual(extract(''), 'utf-8')
+self.assertEqual(extract(''), 
'utf-8')
+self.assertEqual(extract(''), 
'utf-8')
+self.assertEqual(extract(''), 'iso-8859-15')
+self.assertEqual(extract(''), 'iso-8859-15')
+
+def testExtractCharsetFromMetaHTTPEquivTag(self):
+extract = charsetFromMetaEquiv
+self.assertEqual(extract(''), 'utf-8')
+self.assertEqual(extract(''), 'iso-8859-15')
+self.assertEqual(extract(''), None)
+self.assertEqual(extract('...'), None)
+
+
+class ZopePageTemplateFileTests(ZopeTestCase):
+
+def testPT_RenderWithAscii(self):
+manage_addPageTemplate(self.app, 'test', text=ascii_str, 
encoding='ascii')
+zpt = self.app['test']
+result = zpt.pt_render()
+# use startswith() because the renderer appends a trailing \n
+self.assertEqual(result.encode('ascii').startswith(ascii_str), True)
+self.assertEqual(zpt.output_encoding, 'iso-8859-15')
+
+def testPT_RenderWithISO885915(self):
+manage_addPageTemplate(self.app, 'test', text=iso885915_str, 
encoding='iso-8859-15')
+zpt = self.app['test']
+result = zpt.pt_render()
+# use startswith() because the renderer appends a trailing \n
+
self.assertEqual(result.encode('iso-8859-15').startswith(iso885915_str), True)
+self.assertEqual(zpt.output_encoding, 'iso-8859-15')
+
+def testPT_RenderWithUTF8(self):
+manage_addPageTemplate(self.app, 'test', text=utf8_str, 
encoding='utf-8')
+zpt = self.app['test']
+result = zpt.pt_render()
+# u

[Zope-Checkins] SVN: Zope/trunk/ merging ajung-fast-listen branch

2006-08-29 Thread Andreas Jung
Log message for revision 69861:
  merging ajung-fast-listen branch
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/ZServer/HTTPServer.py
  U   Zope/trunk/lib/python/ZServer/component.xml
  U   Zope/trunk/lib/python/ZServer/datatypes.py
  U   Zope/trunk/lib/python/Zope2/Startup/__init__.py
  U   Zope/trunk/skel/etc/zope.conf.in

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===
--- Zope/trunk/doc/CHANGES.txt  2006-08-29 15:51:39 UTC (rev 69860)
+++ Zope/trunk/doc/CHANGES.txt  2006-08-29 16:29:33 UTC (rev 69861)
@@ -27,6 +27,11 @@
 
 Features added
 
+  - added 'fast_listen' directive to http-server and webdav-source-server
+sections in etc/zope.conf in order to defer the opening of the sockets
+until the late startup phase. This in in particular useful when running
+Zope behind a loadbalancer (patch by Patrick Gerken).
+
 Bugs Fixed
 
   - Collector #2155: Fix wrong parameter being passed to

Modified: Zope/trunk/lib/python/ZServer/HTTPServer.py
===
--- Zope/trunk/lib/python/ZServer/HTTPServer.py 2006-08-29 15:51:39 UTC (rev 
69860)
+++ Zope/trunk/lib/python/ZServer/HTTPServer.py 2006-08-29 16:29:33 UTC (rev 
69861)
@@ -428,8 +428,10 @@
 channel_class = zhttp_channel
 shutup=0
 
-def __init__ (self, ip, port, resolver=None, logger_object=None):
+def __init__ (self, ip, port, resolver=None, logger_object=None,
+  fast_listen=True):
 self.shutup=1
+self.fast_listen = fast_listen
 http_server.__init__(self, ip, port, resolver, logger_object)
 self.shutup=0
 self.log_info('%s server started at %s\n'
@@ -460,8 +462,13 @@
 
 def listen(self, num):
 # override asyncore limits for nt's listen queue size
-self.accepting = 1
-return self.socket.listen (num)
 
+if self.fast_listen:
+self.accepting = 1
+return self.socket.listen (num)
+else:
+return 0
+
+
 class zwebdav_server(zhttp_server):
 server_protocol = 'WebDAV'

Modified: Zope/trunk/lib/python/ZServer/component.xml
===
--- Zope/trunk/lib/python/ZServer/component.xml 2006-08-29 15:51:39 UTC (rev 
69860)
+++ Zope/trunk/lib/python/ZServer/component.xml 2006-08-29 16:29:33 UTC (rev 
69861)
@@ -19,6 +19,12 @@
  receive WebDAV source responses to GET requests.

  
+ 
+   
+ Defines wether the http server should listen to requests immediatelly
+ or only after zope is ready to run
+   
+ 
  
   
 

Modified: Zope/trunk/lib/python/ZServer/datatypes.py
===
--- Zope/trunk/lib/python/ZServer/datatypes.py  2006-08-29 15:51:39 UTC (rev 
69860)
+++ Zope/trunk/lib/python/ZServer/datatypes.py  2006-08-29 16:29:33 UTC (rev 
69861)
@@ -70,6 +70,7 @@
 self.force_connection_close = section.force_connection_close
 # webdav-source-server sections won't have webdav_source_clients:
 webdav_clients = getattr(section, "webdav_source_clients", None)
+self.fast_listen = getattr(section, 'fast_listen')
 self.webdav_source_clients = webdav_clients
 self.use_wsgi = section.use_wsgi
 
@@ -81,6 +82,7 @@
 handler.set_webdav_source_clients(self.webdav_source_clients)
 server = self.server_class(ip=self.ip, port=self.port,
resolver=self.dnsresolver,
+   fast_listen=self.fast_listen,
logger_object=access_logger)
 server.install_handler(handler)
 return server

Modified: Zope/trunk/lib/python/Zope2/Startup/__init__.py
===
--- Zope/trunk/lib/python/Zope2/Startup/__init__.py 2006-08-29 15:51:39 UTC 
(rev 69860)
+++ Zope/trunk/lib/python/Zope2/Startup/__init__.py 2006-08-29 16:29:33 UTC 
(rev 69861)
@@ -100,6 +100,7 @@
 self.makePidFile()
 self.setupInterpreter()
 self.startZope()
+self.serverListen()
 from App.config import getConfiguration
 config = getConfiguration()
 if not config.twisted_servers:
@@ -211,6 +212,18 @@
 ZServer.setNumberOfThreads(self.cfg.zserver_threads)
 ZServer.CONNECTION_LIMIT = self.cfg.max_listen_sockets
 
+
+def serverListen(self):
+
+   for server in self.cfg.servers:
+
+if hasattr(server, 'fast_listen'):
+# This one has the delayed listening feature
+if not server.fast_listen:
+server.fast_listen = True
+server.listen(1024) # same value as defined in 
medusa.http_server.py  
+
+
 def setupServers(self):
 socket_err = (