[Zope-Annce] Silva 1.5.9 Released

2006-12-17 Thread Kit BLAKE
Infrae has just released version 1.5.9 of the Silva content management 
system. This is a maintenance release that improves performance, exposes 
Firefox spellcheck capability, and fixes various minor issues.


Changes in Silva and related products

An abridged list of changes follows. For complete details of the fixed 
issues see HISTORY.txt in the packages.


  Silva

  - Changed calls from getMetdata to getMetadataValue where possible,
resulting in a significant performance gain.
  - Fixed unicode bug in Indexers.
  - Fixed a number of minor bugs.

  SilvaMetadata

  - Bugfix for empty strings in aqcuirable metadata fields blocking
acquisition. Thanks to Nico Grubert for the bug report and fix.

  Kupu

  - When images exist in a document and the author scales one, the
display in Kupu can be cached by the browser and doesn't update
properly. The editor frame is now reloadable with the right-mouse
button so authors can force a reload.

  - Previously Kupu had a right-mouse button menu. This has been
disabled, with the intention of exposing spellcheck functionality
that is built into Firefox 2.0. This means, if you are using FF 2.0,
text in Silva is automatically checked. Dictionaries for all major
languages are simple to install.

  SilvaLayout

  - The modification time shown when viewing a folder is now taken from
the default document.

What is Silva?

Silva is a powerful CMS for organizations that manage complex websites. 
Content is stored in clean and futureproof XML, independent of layout 
and presentation. Features include versioning, workflow system, integral 
visual editor (Kupu), content reuse, sophisticated access control, 
multi-site management, extensive import/export facilities, fine-grained 
templating, and hi-res image storage and manipulation.


For more complete information, see the Silva Product Pages at 
http://infrae.com/products/silva/.


Download

The package can be downloaded from: http://infrae.com/download/Silva.

Links to developer mailing lists, the Silva issue tracker, and info 
about SVN access can be found on the Silva intro page.


Contact

FMI contact Eric Casteleijn, eric at infrae com, +31 10 243 7051.
___
Zope-Announce maillist  -  Zope-Announce@zope.org
http://mail.zope.org/mailman/listinfo/zope-announce

 Zope-Announce for Announcements only - no discussions

(Related lists - 
Users: http://mail.zope.org/mailman/listinfo/zope

Developers: http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope-Annce] A new templating system available!

2006-12-17 Thread Chris Withers

Hi All,

I'm proud to announce that after almost a year's development, the first
public release of Twiddler is available!

Twiddler is a simple but flexible templating system for dynamically
generating textual output. It comes with bindings for Zope 2 and should 
easily slot into a Zope 3 view in place of a ZPT.


The key features are:

- No need to learn a templating language.

- As simple as possible while still catering for all possible templating
  operations.

- Configurable input parsing so source can be html, xml, plain text or
  anything you write an input parser for.

- Configurable output rendering so output can be rendered to a unicode
  string, an email, or anything you write an output renderer for.

You can find out more and download from here:

http://www.simplistix.co.uk/software/python/twiddler

If you wish to ask questions, pass judgement or get help, please do so
in the following mailing list:

http://groups.google.com/group/twiddler

This is the first public release, so I'm looking for help with the
following:

- Finding anything that should be possible in a templating system but
  isn't with Twiddler

- Packaging it up for easier distribution. I know nothing about eggs,
  distutils, etc, and so could do with help to package Twiddler so that
  it can be more easily installed.

Finally, here's a couple of quick examples:


from twiddler import Twiddler
t = Twiddler('''body

... div id=titleA title/div
... select name=items
... option id=itemAn item/option
... /select
... /body''')


t['title'].replace('My title')
r = t['item'].repeater()
for i in range(1,4):

...   r.repeat('Item '+str(i),value=i,name=False)


print t.render()

body
div id=titleMy title/div
select name=items
option id=item value=1Item 1/option
option id=item value=2Item 2/option
option id=item value=3Item 3/option
/select
/body


from twiddler.input.plaintext import PlainText
t = Twiddler('''To: $to

... itemAn item/item
... ''',input=PlainText)


t['to'].replace('John Smith')
r = t['item'].repeater()
for i in range(1,4):

...   r.repeat('Item '+str(i),value=i,name=False)


print t.render()

To: John Smith
Item 1
Item 2
Item 3

Thanks for reading this far, I hope you enjoy it!

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

___
Zope-Announce maillist  -  Zope-Announce@zope.org
http://mail.zope.org/mailman/listinfo/zope-announce

 Zope-Announce for Announcements only - no discussions

(Related lists - 
Users: http://mail.zope.org/mailman/listinfo/zope

Developers: http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/ branch for fixing various ZPT issues with encoding and PUT factory

2006-12-17 Thread Andreas Jung
Log message for revision 71560:
  branch for fixing various ZPT issues with encoding and PUT factory
  

Changed:
  A   Zope/branches/ajung-zpt-encoding-fixes/

-=-
Copied: Zope/branches/ajung-zpt-encoding-fixes (from rev 71559, Zope/trunk)

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py some more tests for encoding issues

2006-12-17 Thread Andreas Jung
Log message for revision 71561:
  some more tests for encoding issues
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 13:56:47 UTC (rev 71560)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 15:08:25 UTC (rev 71561)
@@ -1,3 +1,5 @@
+# -*- encoding: utf-8 -*.*
+
 ZopePageTemplate regression tests.
 
 Ensures that adding a page template works correctly.
@@ -6,14 +8,47 @@
 
 
 
-
 import unittest
 import Zope2
 import transaction
 import zope.component.testing
 from zope.traversing.adapters import DefaultTraversable
 from Testing.makerequest import makerequest
+from Testing.ZopeTestCase import ZopeTestCase, installProduct
+from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate, 
manage_addPageTemplate
 
+
+ascii_str = 'htmlbodyhello world/body/html'
+utf8_str = 'htmlbodyÌöÀ/body/html'
+iso885915_str = unicode(utf8_str, 'utf8').encode('iso-8859-15')
+
+installProduct('PageTemplates')
+
+
+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.startswith(ascii_str), True)
+
+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.startswith(iso885915_str), True)
+
+def testPT_RenderWithUTF8(self):
+manage_addPageTemplate(self.app, 'test', text=utf8_str, 
encoding='utf8')
+zpt = self.app['test']
+result = zpt.pt_render()
+# use startswith() because the renderer appends a trailing \n
+self.assertEqual(result.startswith(utf8_str), True)
+
+
 class ZPTRegressions(unittest.TestCase):
 
 def setUp(self):
@@ -133,6 +168,7 @@
 def test_suite():
 suite = unittest.makeSuite(ZPTRegressions)
 suite.addTests(unittest.makeSuite(ZPTMacros))
+suite.addTests(unittest.makeSuite(ZopePageTemplateFileTests))
 return suite
 
 if __name__ == '__main__':

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ the PUT factory now tries to detect the encoding of uploaded contenthe PUT factory now tries to detect t

2006-12-17 Thread Andreas Jung
Log message for revision 71564:
  the PUT factory now tries to detect the encoding of uploaded contenthe PUT 
factory now tries to detect the encoding of uploaded contentt
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 15:46:14 UTC (rev 71563)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 17:22:41 UTC (rev 71564)
@@ -41,7 +41,8 @@
 from Products.PageTemplates.Expressions import SecureModuleImporter
 
 # regular expression to extract the encoding from the XML preamble
-encoding_reg = re.compile('\?xml.*?encoding=(.*?).*?\?', re.M)
+encoding_reg = re.compile(r'\?xml.*?encoding=(.*?).*?\?', re.M)
+charset_reg = re.compile(r'meta.*?charset=(?Pcharset[\w\-]*).*?', 
(re.I|re.M|re.S))
 
 preferred_encodings = ['utf-8', 'iso-8859-15']
 if os.environ.has_key('ZPT_PREFERRED_ENCODING'):
@@ -49,10 +50,19 @@
 
 def sniffEncoding(text, default_encoding='utf-8'):
 Try to determine the encoding from html or xml
+
+# sniff into the XML preamble
 if text.startswith('?xml'):
 mo = encoding_reg.search(text)
 if mo:
 return mo.group(1)
+   
+# sniff for meta http-equiv=content-type ... header
+else:
+mo = charset_reg.search(text)
+if mo:
+return mo.groupdict()['charset']
+
 return default_encoding
 
 class Src(Acquisition.Explicit):
@@ -79,7 +89,7 @@
 
 func_defaults = None
 func_code = FuncCode((), 0)
-strict = False
+strict = True
 
 _default_bindings = {'name_subpath': 'traverse_subpath'}
 _default_content_fn = os.path.join(package_home(globals()),
@@ -109,7 +119,7 @@
   'read', 'ZScriptHTML_tryForm')
 
 def __init__(self, id, text=None, content_type=None, encoding='utf-8',
- strict=False):
+ strict=True):
 self.id = id
 self.expand = 0
   
 self.strict = strict
@@ -294,7 +304,9 @@
 self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
 text = REQUEST.get('BODY', '')
 content_type = guess_type('', text) 
-self.pt_edit(text, content_type, self.output_encoding)
+encoding = sniffEncoding(text, self.output_encoding)
+self.output_encoding = encoding
+self.pt_edit(text, content_type, encoding)
 RESPONSE.setStatus(204)
 return RESPONSE
 

Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 15:46:14 UTC (rev 71563)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 17:22:41 UTC (rev 71564)
@@ -93,14 +93,7 @@
 pt = self.app.pt1
 self.assertEqual(pt.document_src(), self.text)
 
-def test_BBB_for_strict_attribute(self):
-# Collector 2213:  old templates don't have 'strict' attribute.
-from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
-zpt = ZopePageTemplate('issue_2213')
-del zpt.strict  # simulate old templates
-self.assertEqual(zpt.strict, False)
 
-
 class ZPTMacros(zope.component.testing.PlacelessSetup, unittest.TestCase):
 
 def setUp(self):

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/PageTemplateFile.py added comment

2006-12-17 Thread Andreas Jung
Log message for revision 71568:
  added comment
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/PageTemplateFile.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/PageTemplateFile.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/PageTemplateFile.py
2006-12-17 18:39:50 UTC (rev 71567)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/PageTemplateFile.py
2006-12-17 18:40:25 UTC (rev 71568)
@@ -35,6 +35,7 @@
 
 # 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('?xml'):
 return 'text/xml'

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py PUT factory tests

2006-12-17 Thread Andreas Jung
Log message for revision 71569:
  PUT factory tests
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 18:40:25 UTC (rev 71568)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 18:45:41 UTC (rev 71569)
@@ -22,8 +22,7 @@
 iso885915_str = 'htmlbodyüöäÜÖÄß/body/html'
 utf8_str = unicode(iso885915_str, 'iso-8859-15').encode('utf-8')
 
-xml_template = '''
-?xml vesion=1.0 encoding=%s?
+xml_template = '''?xml vesion=1.0 encoding=%s?
 foo
 üöäÜÖÄß
 /foo
@@ -81,13 +80,41 @@
 self.assertEqual(result.startswith(iso885915_str), True)
 
 def testPT_RenderWithUTF8(self):
-manage_addPageTemplate(self.app, 'test', text=utf8_str, 
encoding='utf8')
+manage_addPageTemplate(self.app, 'test', text=utf8_str, 
encoding='utf-8')
 zpt = self.app['test']
 result = zpt.pt_render()
 # use startswith() because the renderer appends a trailing \n
 self.assertEqual(result.startswith(utf8_str), True)
 
+def _createZPT(self):
+manage_addPageTemplate(self.app, 'test', text=utf8_str, 
encoding='utf-8')
+zpt = self.app['test']
+return zpt
 
+def _makePUTRequest(self, body):
+return {'BODY' : body}
+
+def _put(self, text):
+zpt = self._createZPT()
+REQUEST = self.app.REQUEST
+REQUEST.set('BODY', text)
+zpt.PUT(REQUEST, REQUEST.RESPONSE)
+return zpt.output_encoding
+
+def testPutHTMLIso8859_15WithCharsetInfo(self):
+self.assertEqual(self._put(html_iso_8859_15_w_header), 'iso-8859-15')
+
+def testPutHTMLUTF8_WithCharsetInfo(self):
+self.assertEqual(self._put(html_utf8_w_header), 'utf-8')
+
+def testPutXMLIso8859_15(self):
+ XML: use always UTF-8 als output encoding 
+self.assertEqual(self._put(xml_iso_8859_15), 'utf-8')
+
+def testPutXMLUTF8(self):
+ XML: use always UTF-8 als output encoding 
+self.assertEqual(self._put(xml_utf8), 'utf-8')
+
 class ZPTRegressions(unittest.TestCase):
 
 def setUp(self):

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py set output-encoding for uploaded XML files always to UTF-8

2006-12-17 Thread Andreas Jung
Log message for revision 71570:
  set output-encoding for uploaded XML files always to UTF-8
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 18:45:41 UTC (rev 71569)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 18:46:12 UTC (rev 71570)
@@ -305,7 +305,10 @@
 text = REQUEST.get('BODY', '')
 content_type = guess_type('', text) 
 encoding = sniffEncoding(text, self.output_encoding)
-self.output_encoding = encoding
+if content_type == 'text/xml':
+self.output_encoding = 'utf-8'
+else:   
+self.output_encoding = encoding
 self.pt_edit(text, content_type, encoding)
 RESPONSE.setStatus(204)
 return RESPONSE

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py more tests

2006-12-17 Thread Andreas Jung
Log message for revision 71572:
  more tests
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 19:22:55 UTC (rev 71571)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 19:24:23 UTC (rev 71572)
@@ -47,17 +47,14 @@
 
 html_template_wo_header = '''
 html
-head
-META http-equiv=content-type content=text/html; charset=%s
-/hed
 body
 test üöäÜÖÄß
 /body
 /html
 '''
 
-html_iso_8859_15_wo_header = html_template_wo_header % 'iso-8859-15'
-html_utf8_wo_header = unicode(html_template_wo_header, 
'iso-8859-15').encode('utf-8') % 'utf-8'
+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')
@@ -107,6 +104,13 @@
 def testPutHTMLUTF8_WithCharsetInfo(self):
 self.assertEqual(self._put(html_utf8_w_header), 'utf-8')
 
+def testPutHTMLIso8859_15WithoutCharsetInfo(self):
+self.assertEqual(self._put(html_iso_8859_15_wo_header), 'iso-8859-15')
+
+def testPutHTMLUTF8_WithoutCharsetInfo(self):
+import pdb; pdb.set_trace() 
+self.assertEqual(self._put(html_utf8_wo_header), 'iso-8859-15')
+
 def testPutXMLIso8859_15(self):
  XML: use always UTF-8 als output encoding 
 self.assertEqual(self._put(xml_iso_8859_15), 'utf-8')

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py add checks for content-type

2006-12-17 Thread Andreas Jung
Log message for revision 71573:
  add checks for content-type
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 19:24:23 UTC (rev 71572)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 19:31:32 UTC (rev 71573)
@@ -96,28 +96,39 @@
 REQUEST = self.app.REQUEST
 REQUEST.set('BODY', text)
 zpt.PUT(REQUEST, REQUEST.RESPONSE)
-return zpt.output_encoding
+return zpt
 
 def testPutHTMLIso8859_15WithCharsetInfo(self):
-self.assertEqual(self._put(html_iso_8859_15_w_header), 'iso-8859-15')
+zpt = self._put(html_iso_8859_15_w_header)
+self.assertEqual(zpt.output_encoding, 'iso-8859-15')
+self.assertEqual(zpt.content_type, 'text/html')
 
 def testPutHTMLUTF8_WithCharsetInfo(self):
-self.assertEqual(self._put(html_utf8_w_header), 'utf-8')
+zpt = self._put(html_utf8_w_header)
+self.assertEqual(zpt.output_encoding, 'utf-8')
+self.assertEqual(zpt.content_type, 'text/html')
 
 def testPutHTMLIso8859_15WithoutCharsetInfo(self):
-self.assertEqual(self._put(html_iso_8859_15_wo_header), 'iso-8859-15')
+zpt = self._put(html_iso_8859_15_wo_header)
+self.assertEqual(zpt.output_encoding, 'iso-8859-15')
+self.assertEqual(zpt.content_type, 'text/html')
 
 def testPutHTMLUTF8_WithoutCharsetInfo(self):
-import pdb; pdb.set_trace() 
-self.assertEqual(self._put(html_utf8_wo_header), 'iso-8859-15')
+zpt = self._put(html_utf8_wo_header)
+self.assertEqual(zpt.output_encoding, 'iso-8859-15')
+self.assertEqual(zpt.content_type, 'text/html')
 
 def testPutXMLIso8859_15(self):
  XML: use always UTF-8 als output encoding 
-self.assertEqual(self._put(xml_iso_8859_15), 'utf-8')
+zpt = self._put(xml_iso_8859_15)
+self.assertEqual(zpt.output_encoding, 'utf-8')
+self.assertEqual(zpt.content_type, 'text/xml')
 
 def testPutXMLUTF8(self):
  XML: use always UTF-8 als output encoding 
-self.assertEqual(self._put(xml_utf8), 'utf-8')
+zpt = self._put(xml_utf8)
+self.assertEqual(zpt.output_encoding, 'utf-8')
+self.assertEqual(zpt.content_type, 'text/xml')
 
 class ZPTRegressions(unittest.TestCase):
 

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ removed 'strict' mode (now using unicode as internal representation) *always*

2006-12-17 Thread Andreas Jung
Log message for revision 71574:
  removed 'strict' mode (now using unicode as internal representation) *always*
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 19:31:32 UTC (rev 71573)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 19:35:18 UTC (rev 71574)
@@ -90,7 +90,6 @@
 
 func_defaults = None
 func_code = FuncCode((), 0)
-strict = True
 
 _default_bindings = {'name_subpath': 'traverse_subpath'}
 _default_content_fn = os.path.join(package_home(globals()),
@@ -119,11 +118,9 @@
 security.declareProtected(view_management_screens,
   'read', 'ZScriptHTML_tryForm')
 
-def __init__(self, id, text=None, content_type=None, encoding='utf-8',
- strict=True):
+def __init__(self, id, text=None, content_type=None, encoding='utf-8', 
strict=True):
 self.id = id
 self.expand = 0
   
-self.strict = strict
 self.ZBindings_edit(self._default_bindings)
 self.output_encoding = encoding
 if not text:
@@ -135,7 +132,7 @@
 security.declareProtected(change_page_templates, 'pt_edit')
 def pt_edit(self, text, content_type, encoding='utf-8'):
 text = text.strip()
-if self.strict and not isinstance(text, unicode):
+if not isinstance(text, unicode):
 text = unicode(text, encoding)
 
 self.ZCacheable_invalidate()
@@ -169,7 +166,7 @@
 
 security.declareProtected(change_page_templates, 'pt_setTitle')
 def pt_setTitle(self, title, encoding='utf-8'):
-if self.strict and not isinstance(title, unicode):
+if not isinstance(title, unicode):
 title = unicode(title, encoding)
 self._setPropValue('title', title)
 

Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 19:31:32 UTC (rev 71573)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 19:35:18 UTC (rev 71574)
@@ -174,14 +174,7 @@
 pt = self.app.pt1
 self.assertEqual(pt.document_src(), self.text)
 
-def test_BBB_for_strict_attribute(self):
-# Collector 2213:  old templates don't have 'strict' attribute.
-from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
-zpt = ZopePageTemplate('issue_2213')
-del zpt.strict  # simulate old templates
-self.assertEqual(zpt.strict, True)
 
-
 class ZPTMacros(zope.component.testing.PlacelessSetup, unittest.TestCase):
 
 def setUp(self):

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py - removed 'encoding' parameter from pt_edit() to restore the original API

2006-12-17 Thread Andreas Jung
Log message for revision 71575:
  - removed 'encoding' parameter from pt_edit() to restore the original API
  - moved the encoding detection into pt_edit() to make it available in a 
single place
  
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 19:35:18 UTC (rev 71574)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 19:49:11 UTC (rev 71575)
@@ -123,15 +123,30 @@
 self.expand = 0
   
 self.ZBindings_edit(self._default_bindings)
 self.output_encoding = encoding
+
+# default content
 if not text:
 text = open(self._default_content_fn).read()
 encoding = 'utf-8'
 content_type = 'text/html'
-self.pt_edit(text, content_type, encoding)
+self.pt_edit(text, content_type)
 
 security.declareProtected(change_page_templates, 'pt_edit')
-def pt_edit(self, text, content_type, encoding='utf-8'):
+def pt_edit(self, text, content_type):
+
 text = text.strip()
+
+guessed_content_type = guess_type('', text)
+if guessed_content_type != content_type:
+raise ValueError('Guessed content-type != passed content-type (%s 
vs. %s)' % 
+ (guessed_content_type, content_type))
+
+encoding = sniffEncoding(text)
+if content_type == 'text/xml':
+self.output_encoding = 'utf-8'
+else:   
+self.output_encoding = encoding
+
 if not isinstance(text, unicode):
 text = unicode(text, encoding)
 
@@ -195,8 +210,7 @@
 if not content_type in ('text/html', 'text/xml'):
 raise ValueError('Unsupported mimetype: %s' % content_type)
 
-encoding = sniffEncoding(text)
-self.pt_edit(text, content_type, encoding)
+self.pt_edit(text, content_type)
 return self.pt_editForm(manage_tabs_message='Saved changes')
 
 security.declareProtected(change_page_templates, 'pt_changePrefs')
@@ -302,12 +316,7 @@
 self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
 text = REQUEST.get('BODY', '')
 content_type = guess_type('', text) 
-encoding = sniffEncoding(text)
-if content_type == 'text/xml':
-self.output_encoding = 'utf-8'
-else:   
-self.output_encoding = encoding
-self.pt_edit(text, content_type, encoding)
+self.pt_edit(text, content_type)
 RESPONSE.setStatus(204)
 return RESPONSE
 

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py pt_edit() now has an optional 'keep_output_encoding' flag that is

2006-12-17 Thread Andreas Jung
Log message for revision 71576:
  pt_edit() now has an optional 'keep_output_encoding' flag that is
  necessary for pt_edit() calls where the encoding should not be changed
  by sniffing inside the content (used by pt_editAction(), ZMI and by
  the constructor)
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 19:49:11 UTC (rev 71575)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 20:13:38 UTC (rev 71576)
@@ -122,17 +122,16 @@
 self.id = id
 self.expand = 0
   
 self.ZBindings_edit(self._default_bindings)
-self.output_encoding = encoding
+self.output_encoding = 'utf-8'
 
 # default content
 if not text:
 text = open(self._default_content_fn).read()
-encoding = 'utf-8'
 content_type = 'text/html'
-self.pt_edit(text, content_type)
+self.pt_edit(text, content_type, True)
 
 security.declareProtected(change_page_templates, 'pt_edit')
-def pt_edit(self, text, content_type):
+def pt_edit(self, text, content_type, keep_output_encoding=False):
 
 text = text.strip()
 
@@ -142,11 +141,14 @@
  (guessed_content_type, content_type))
 
 encoding = sniffEncoding(text)
-if content_type == 'text/xml':
-self.output_encoding = 'utf-8'
-else:   
-self.output_encoding = encoding
+if not keep_output_encoding:
+if content_type == 'text/xml':
+self.output_encoding = 'utf-8'
+else:   
+self.output_encoding = encoding
 
+encoding = self.output_encoding
+
 if not isinstance(text, unicode):
 text = unicode(text, encoding)
 
@@ -161,16 +163,16 @@
 source_dot_xml = Src()
 
 security.declareProtected(change_page_templates, 'pt_editAction')
-def pt_editAction(self, REQUEST, title, text, content_type, encoding, 
expand):
+def pt_editAction(self, REQUEST, title, text, content_type, expand):
 Change the title and document.
 
 if self.wl_isLocked():
 raise ResourceLockedError(File is locked via WebDAV)
 
 self.expand = expand
-self.pt_setTitle(title, encoding)
+self.pt_setTitle(title, self.output_encoding)
 
-self.pt_edit(text, content_type, encoding)
+self.pt_edit(text, content_type, True)
 REQUEST.set('text', self.read()) # May not equal 'text'!
 REQUEST.set('title', self.title)
 message = Saved changes.

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py more tests

2006-12-17 Thread Andreas Jung
Log message for revision 71577:
  more tests
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 20:13:38 UTC (rev 71576)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
  2006-12-17 20:24:43 UTC (rev 71577)
@@ -68,6 +68,7 @@
 result = zpt.pt_render()
 # use startswith() because the renderer appends a trailing \n
 self.assertEqual(result.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')
@@ -75,6 +76,7 @@
 result = zpt.pt_render()
 # use startswith() because the renderer appends a trailing \n
 self.assertEqual(result.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')
@@ -82,6 +84,7 @@
 result = zpt.pt_render()
 # use startswith() because the renderer appends a trailing \n
 self.assertEqual(result.startswith(utf8_str), True)
+self.assertEqual(zpt.output_encoding, 'iso-8859-15')
 
 def _createZPT(self):
 manage_addPageTemplate(self.app, 'test', text=utf8_str, 
encoding='utf-8')

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py fixes

2006-12-17 Thread Andreas Jung
Log message for revision 71578:
  fixes
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 20:24:43 UTC (rev 71577)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 20:24:56 UTC (rev 71578)
@@ -122,7 +122,7 @@
 self.id = id
 self.expand = 0
   
 self.ZBindings_edit(self._default_bindings)
-self.output_encoding = 'utf-8'
+self.output_encoding = encoding
 
 # default content
 if not text:
@@ -146,9 +146,9 @@
 self.output_encoding = 'utf-8'
 else:   
 self.output_encoding = encoding
+else:
+encoding = self.output_encoding
 
-encoding = self.output_encoding
-
 if not isinstance(text, unicode):
 text = unicode(text, encoding)
 

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


[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py some more comments

2006-12-17 Thread Andreas Jung
Log message for revision 71579:
  some more comments
  

Changed:
  U   
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py

-=-
Modified: 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
===
--- 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 20:24:56 UTC (rev 71578)
+++ 
Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
2006-12-17 20:26:10 UTC (rev 71579)
@@ -141,12 +141,15 @@
  (guessed_content_type, content_type))
 
 encoding = sniffEncoding(text)
+
+# for WebDAV, FTP 
 if not keep_output_encoding:
 if content_type == 'text/xml':
 self.output_encoding = 'utf-8'
 else:   
 self.output_encoding = encoding
 else:
+# ZMI - no changes allowed
 encoding = self.output_encoding
 
 if not isinstance(text, unicode):

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


Re: [Zope-dev] Next step on Blobs?

2006-12-17 Thread Christian Theune
Hi,

Sidnei da Silva wrote:
 - What's the next step on supporting ZODB Blobs?

Start using it! :)

 - Is there a branch of Zope that actually uses it?

Nope, not yet. I don't have any plans for Zope 2, but I'll be working on
the Zope 3 side.

I guess that we need to decide whether we want to release the current
ZODB trunk together with the next releases of Zope (2 and 3). In this
case we'll need a release branch for ZODB 3.8 and switch Zope to it.

From my perspective, we could:

- Have blobs available and let people pick them up.

  This option has the lowest potention for interrupting anybody's
  operation of existing applications/servers.

- Make the existing File implementation use blobs

  This would be good so people see how to use them and get blobs widely
  exposed. Ideally, the Zope beta releases would uncover problems with
  existing applications/installations.

- Make new Big File implementations based on blobs

  This would also allow people to see how to use blobs, but is a bit
  more conservative approach as blobs are a new feature and we don't
  want to destroy existing databases.

Additionally, we could change the existing skeletons for zope.conf and
zeo.conf to include a blob storage in their examples.

Christian

-- 
gocept gmbh  co. kg - forsterstraße 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: OpenPGP digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Zope Tests: 7 OK

2006-12-17 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list.
Period Sat Dec 16 12:00:00 2006 UTC to Sun Dec 17 12:00:00 2006 UTC.
There were 7 messages: 7 from Zope Unit Tests.


Tests passed OK
---

Subject: OK : Zope-2.6 Python-2.1.3 : Linux
From: Zope Unit Tests
Date: Sat Dec 16 21:07:21 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006838.html

Subject: OK : Zope-2.6 Python-2.3.6 : Linux
From: Zope Unit Tests
Date: Sat Dec 16 21:08:51 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006839.html

Subject: OK : Zope-2.7 Python-2.3.6 : Linux
From: Zope Unit Tests
Date: Sat Dec 16 21:10:22 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006840.html

Subject: OK : Zope-2.8 Python-2.3.6 : Linux
From: Zope Unit Tests
Date: Sat Dec 16 21:11:52 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006841.html

Subject: OK : Zope-2.9 Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Sat Dec 16 21:13:22 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006842.html

Subject: OK : Zope-2.10 Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Sat Dec 16 21:14:52 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006843.html

Subject: OK : Zope-trunk Python-2.4.4 : Linux
From: Zope Unit Tests
Date: Sat Dec 16 21:16:22 EST 2006
URL: http://mail.zope.org/pipermail/zope-tests/2006-December/006844.html

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] [Zope 2.10/ZPT] Fixes for encoding and webdav issues

2006-12-17 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

I've created a branch

svn+ssh://svn.zope.org/repos/main/Zope/branches/ajung-zpt-encoding-fixes

that should fix several encoding and webdav issues that unfortunately were
discovered before the final 2.10 release.

What has changed?

Until Zope 2.10 the ZopePageTemplate class had no notion of an encoding. 
You could upload ascii, iso-8859-15, utf8...or whatever...everything has 
been stored as a Python  byte string. For backward compatibility we did not 
convert the data into Python unicode strings with the introduction of the 
Zope 3 ZPT
implementation. Although the ZopePageTemplate implementation already had a
'strict' flag (to enforce the conversion to Python unicode) the Zope 2
implementation did not enforce unicode as storage for a ZPT. This caused
several encoding problems when editing a ZPT through the ZMI and in
addition the WebDAV support was broken in Zope 2.10.0 and Zope 2.10.1.

A ZPT has now something as an output_encoding. When you create a ZPT 
through the ZMI you'll be asked about the encoding (which is utf8 by 
default). The pt_render() method now converts the internal unicode 
representation back to the output encoding. This is basically the behavior 
of the old ZPT implementation. In addition the __call__() method sets the 
'charset' property of the content-type header according to the configured 
output encoding.

WebDAV: the PUT factory was using the write() method to store uploaded 
content. This method wasn't aware of the output encoding. PUT() now
uses pt_edit(). This implies that the uploaded content must have the same
encoding as the output encoding. Means: when you create a ZPT with encoding
UTF-8 you can't upload new content with a different encoding. This is
a slightly different behavior from older Zope versions and might break
backward compatibility. Anyone having such a usecase? One might check in 
addition for the 'encoding' attribute inside the XML preamble or for the
'charset' property inside a meta http-equiv=content-type .. tag for 
HTML documents.

Any objections merging the changes on the head after further polishing and 
writing some more test?

Andreas

- -- 
ZOPYX Ltd.  Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376
E-Publishing, Python, Zope  Plone development, Consulting
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFhWvECJIWIbr9KYwRAg5xAJ9LEYbyy2TCrKj1b4VUcqE90qqqkwCeLr6B
F3YYBC8V2oPEaOq1xH1FeFg=
=68R/
-END PGP SIGNATURE-

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Next step on Blobs?

2006-12-17 Thread Fred Drake

On 12/17/06, Christian Theune [EMAIL PROTECTED] wrote:

Nope, not yet. I don't have any plans for Zope 2, but I'll be working on
the Zope 3 side.

...

- Make the existing File implementation use blobs

  This would be good so people see how to use them and get blobs widely
  exposed. Ideally, the Zope beta releases would uncover problems with
  existing applications/installations.


There's more than one of these.  zope.file was intended to use blobs
when they come along, so I'd suggest that making that support blobs
directly, with backward compatibility for the existing structure, is
the right way to go.


 -Fred

--
Fred L. Drake, Jr.fdrake at gmail.com
Every sin is the result of a collaboration. --Lucius Annaeus Seneca
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Re: [Zope 2.10/ZPT] Fixes for encoding and webdav issues

2006-12-17 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andreas Jung wrote:
 Hi,
 
 I've created a branch
 
 svn+ssh://svn.zope.org/repos/main/Zope/branches/ajung-zpt-encoding-fixes
 
 that should fix several encoding and webdav issues that unfortunately were
 discovered before the final 2.10 release.
 
 What has changed?
 
 Until Zope 2.10 the ZopePageTemplate class had no notion of an encoding.
 You could upload ascii, iso-8859-15, utf8...or whatever...everything has
 been stored as a Python  byte string. For backward compatibility we did not
 convert the data into Python unicode strings with the introduction of the
 Zope 3 ZPT
 implementation. Although the ZopePageTemplate implementation already had a
 'strict' flag (to enforce the conversion to Python unicode) the Zope 2
 implementation did not enforce unicode as storage for a ZPT. This caused
 several encoding problems when editing a ZPT through the ZMI and in
 addition the WebDAV support was broken in Zope 2.10.0 and Zope 2.10.1.
 
 A ZPT has now something as an output_encoding. When you create a ZPT
 through the ZMI you'll be asked about the encoding (which is utf8 by
 default). The pt_render() method now converts the internal unicode
 representation back to the output encoding. This is basically the behavior
 of the old ZPT implementation. In addition the __call__() method sets the
 'charset' property of the content-type header according to the configured
 output encoding.

That is dangerous, because a page template may be called without being
the main driver for a request;  the response encoding should be used,
if already set, rather than the value set on the template.

 WebDAV: the PUT factory was using the write() method to store uploaded
 content. This method wasn't aware of the output encoding. PUT() now
 uses pt_edit(). This implies that the uploaded content must have the same
 encoding as the output encoding. Means: when you create a ZPT with encoding
 UTF-8 you can't upload new content with a different encoding. This is
 a slightly different behavior from older Zope versions and might break
 backward compatibility. Anyone having such a usecase? One might check in
 addition for the 'encoding' attribute inside the XML preamble or for the
 'charset' property inside a meta http-equiv=content-type .. tag for
 HTML documents.

PUT should always extract the encoding from the upload request, and use
it to decode the template to unicode for storage.  While saving that
encoding as the outpout encoding for a newly-created template is
reasonable, modifying the output encoding for an existing template is
riskier.  I'm not even sure there is a usecase for a per-template output
encoding -- it seems more like a site-wide policy to me (perhaps
configured as a view?)

 Any objections merging the changes on the head after further polishing and
 writing some more test?



Tres.
- --
===
Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFhX3C+gerLs4ltQ4RAgA+AJ9HnkSxrN6DgiY1jujxSGXJ324E2QCgjstU
gQdBYp9Uay/+tDApM+uPYNI=
=27Or
-END PGP SIGNATURE-

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Re: [Zope 2.10/ZPT] Fixes for encoding and webdav issues

2006-12-17 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



- --On 17. Dezember 2006 12:26:26 -0500 Tres Seaver [EMAIL PROTECTED] 
wrote:

 A ZPT has now something as an output_encoding. When you create a ZPT
 through the ZMI you'll be asked about the encoding (which is utf8 by
 default). The pt_render() method now converts the internal unicode
 representation back to the output encoding. This is basically the
 behavior of the old ZPT implementation. In addition the __call__()
 method sets the 'charset' property of the content-type header according
 to the configured output encoding.

 That is dangerous, because a page template may be called without being
 the main driver for a request;  the response encoding should be used,
 if already set, rather than the value set on the template.

Ok, you're right. Is there an reliable way to distinguish between
a direct call and a non-direct call?


 WebDAV: the PUT factory was using the write() method to store uploaded
 content. This method wasn't aware of the output encoding. PUT() now
 uses pt_edit(). This implies that the uploaded content must have the same
 encoding as the output encoding. Means: when you create a ZPT with
 encoding UTF-8 you can't upload new content with a different encoding.
 This is a slightly different behavior from older Zope versions and might
 break backward compatibility. Anyone having such a usecase? One might
 check in addition for the 'encoding' attribute inside the XML preamble
 or for the 'charset' property inside a meta http-equiv=content-type
 .. tag for HTML documents.

 PUT should always extract the encoding from the upload request, and use
 it to decode the template to unicode for storage.

This works already. However there will be cases when the code can't 
autodetect an encoding.

 While saving that
 encoding as the outpout encoding for a newly-created template is
 reasonable, modifying the output encoding for an existing template is
 riskier.

Newly created content-type is still an open point..look as if I have to 
write a bunch of unittests for all edgecases.

- -aj

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFhYD0CJIWIbr9KYwRAgNHAKCPkhRE5By/ORg6HUgf/Hz3a29t2wCgxRnp
16FC8lfCNkxvPwxXHsOKMMQ=
=IxWq
-END PGP SIGNATURE-

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-PAS] Domain authentication on plone

2006-12-17 Thread Alessandro Ronchi

I have a Plone 2.5 with Zope 2.9 on a windows Server.
I need to match windows domain users with plone users and login with that
information with a single sign on.

I don't want to import groups, files, directories or properties from my domain
users, I need only to authenticate a user against the domain user.

It's not important If I need to change the plone usernames to reflect the
windows ones, it's not important if I have to add a plone user every windows
user and match in a table the corrispondence of this couple.

I'm not using apache.

I've found this howto:
http://plone.org/documentation/how-to/singlesignonwindowsdomains/
but I think it's old and it's not focused on plonepas on plone 2.5.
I've understood I need to catch NTLM authentication, but I don't
understand how can I do that. for me it's enough to get the ntml user
and associate it to a plone user, nothing more.

How can I do that? Is there any updated howto?

I really need this, please help me...


--
Alessandro Ronchi
Skype: aronchi - Wengo: aleronchi
http://www.alessandroronchi.net - Il mio sito personale
http://www.soasi.com - Sviluppo Software e Sistemi Open Source
___
Zope-PAS mailing list
Zope-PAS@zope.org
http://mail.zope.org/mailman/listinfo/zope-pas


RE: [Zope] Zope, setlocale(), requests and traversal

2006-12-17 Thread Dieter Maurer
Doyon, Jean-Francois wrote at 2006-12-15 08:38 -0500:
setlocale() is a python thing.  It wraps a C library, and that function
setups an application wide environment (A bit like an environment
variable would ...) ... Which is why it's not thread safe.

If you do not have a thread aware implementation of setlocale, then
it is *VERY* dangerous to change setlocale inside a thread -- as
changing any global data can lead to non-deterministic behaviour in
a multi-threaded environment unless special precautions (locking) are
taken.


Apparently, you are aware of the danger. But, I have not seen
how you avoid the problem in your sketched solution.

-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Building a Zope based site

2006-12-17 Thread Dieter Maurer
John Poltorak wrote at 2006-12-15 18:13 +:
 ...
 #hours required * hour-rate

OK, so what hourly rate should I expect to pay? and how does anyone know 
how much time it will take?

I'm thinking of getting something setup which would mirror a small weekly 
newspaper.

When I worked for a newspaper about 7 years ago, we implemented
something like this (internet based editorial system for a magazine
with internet presentation of the magazine editions) within 2 weeks
with 2 to 3 persons assigned to the project -- i.e. with about
24 person days or 200 person hours.

*However*, the project conditions have been optimal:

  The requester (a new chief of a partner department) had a very well founded
  technical understanding of what he wanted and what wishes might be expensive
  and used this understanding to strive for an easy solution.
  He was quick to take decisions and took the decisions always along
  the start simple, grow later principle.

Under less optimal conditions, the solution could easily have been *much* more
expensive!


Note that this was an internal project.
Your priorities and approaches may be different
for a project with external consultants.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] attribute-less object(assign or del)

2006-12-17 Thread Dieter Maurer
Kate Legere wrote at 2006-12-11 09:31 -0500:
This is the full trackback:

   
Site Error Log Site Error Log at  /error_log
Exception traceback

Time   2006/12/11 09:26:04.451 US/Eastern
User Name (User Id)[EMAIL PROTECTED] ([EMAIL PROTECTED])
Request URL
http://staffnet.kfpl.ca:8080/kfplStaff/statsTracker/display/copy_of_stats_ou
tput_branch
Exception Type TypeError
Exception Valueattribute-less object (assign or del)
 
  PythonScript at
/kfplStaff/statsTracker/display/copy_of_stats_output_branch
  Line 45
* Module RestrictedPython.Guards, line 96, in handler

TypeError: attribute-less object (assign or del)

This gives us another two potential problem causes.

  * It is likely that you cannot change 'Record' attributes
in restricted code (such as in 'PythonScript').

Try in trusted code (e.g. an ExternalMethod).

  * Maybe, you try to change not a Record instance
(a single hit) but the Result instance (representing
the complete result list). Result instances do not have
any writable attributes.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Building a Zope based site

2006-12-17 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



- --On 17. Dezember 2006 10:21:20 +0100 Dieter Maurer [EMAIL PROTECTED] 
wrote:

 John Poltorak wrote at 2006-12-15 18:13 +:
 ...
 # hours required * hour-rate

 OK, so what hourly rate should I expect to pay? and how does anyone know
 how much time it will take?

 I'm thinking of getting something setup which would mirror a small
 weekly  newspaper.

 When I worked for a newspaper about 7 years ago, we implemented
 something like this (internet based editorial system for a magazine
 with internet presentation of the magazine editions) within 2 weeks
 with 2 to 3 persons assigned to the project -- i.e. with about
 24 person days or 200 person hours.

 *However*, the project conditions have been optimal:

..and the times have changed: we now have different technologies and 
different requirements. So such numbers - without knowing about the 
requirements - are dust and smoke.

- -aj


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFhQ6rCJIWIbr9KYwRAlMqAKDM+M+rjyB/mrP8NnYW3ufC3ZMnFQCgoW0w
ETGFpnDqJyHNzbyFwsU+fOQ=
=dMzx
-END PGP SIGNATURE-

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Preserving Context

2006-12-17 Thread Dieter Maurer
Javier Subervi wrote at 2006-12-11 00:41 -0800:
I have a page template which I use to catch and customize 404 errors. In that 
page, I call a script that offers site navigation.

This is quite a difficult situation:

  In case of 404 errors, you may not yet have reached the final destination
  (as something in the url is problematic -- and the problem does not
  need to be at the url's end).


Within the restrictions of the problem sketched above (only very high
intelligence can try to overcome them), I would approach your case
in the following way:

  Have a trivial script in each context where you are interested
  in special treatment of 404 errors.
  As the script is trivial, there is no problem, in having
  a separate copy in each context.

  The trivial script determines the error context and
  then calls your centralized (non-trivial) script passing
  in the determined context.
  

-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Wrapping zope with socksify

2006-12-17 Thread Dieter Maurer
Patrick Gerken wrote at 2006-12-13 16:13 +0100:
 ...
Now we got the problem that zope randomly crashed.

There are many ways crashed can be interpreted.

If crashed means died from a fatal signal (SIGSEGV, SIGBUS,
SIGABORT, ...), then the analysis of the core file may provide
valuable insights.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Login track

2006-12-17 Thread Dieter Maurer
stefan83 wrote at 2006-12-15 14:51 +0100:
 ...
I have my own information system on Zope. I would like to enable users to 
login and do acts, what they can do (according to security settings). But I 
cannot track already logged users.

HTTP is essentially a stateless protocol. To store login information
you need to have some support from your HTTP client (i.e. browser).

Essentially, you have two options:

  *  HTTP authentication

 In this case, the login is performed and the login
 information stored by the HTTP client.

 Your application just tells the client that it requires
 authentication (by generating a 401 (Unauthorized) response).

 The client will then open the login dialog and pass the obtained
 authentication information with any following request.

  *  Cookie based authentication

 In this case, the login is performed by your application
 and the obtained information stored in a cookie.

 The client will add cookie information to any request (provided
 cookies are not disabled) and your application can check the cookies
 to find out the users identity.

 Usually, you will use a component that handles this in a standard
 way. One option is CookieCrumbler (part of CMFCore),
 a more modern (but also considerably more abstract and maybe
 more difficult) one is PluggableAuthService with
 a CookieAuthHelper plugin.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Building a Zope based site

2006-12-17 Thread Dieter Maurer
Andreas Jung wrote at 2006-12-17 10:32 +0100:
 ...
 When I worked for a newspaper about 7 years ago, we implemented
 something like this (internet based editorial system for a magazine
 with internet presentation of the magazine editions) within 2 weeks
 with 2 to 3 persons assigned to the project -- i.e. with about
 24 person days or 200 person hours.

 *However*, the project conditions have been optimal:

..and the times have changed: we now have different technologies

which may reduce the required time -- otherwise, you simply forget
about the new technologies and stick with the old ones.

and 
different requirements.

Maybe.

 So such numbers - without knowing about the 
requirements - are dust and smoke.

Looks like you think a bit too much in black and white categories:

  Even when I do not know many details, I can still provide some hints.

  To stay with your car example: When I hear that someone wants a new
  car, I can predict that he will probably at least need 3.000 dollars
  even when he did not yet specify precise details about the wanted car.
  Of course, if his car should win the Formular One competition, this
  will quickly get 30 million dollars.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Building a Zope based site

2006-12-17 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



- --On 17. Dezember 2006 11:10:42 +0100 Dieter Maurer [EMAIL PROTECTED] 
wrote:

 Looks like you think a bit too much in black and white categories:

   Even when I do not know many details, I can still provide some hints.



No, it's just about people asking general question with the expectation 
getting a very detailed answer without providing at least simple detail 
about what they really want *wink to John*. The quality of an answer simply 
reflects the quality of the question.

- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFFhRqyCJIWIbr9KYwRAsqMAJsFXTFDpZ6jbwxs29XJpDMmDAWX6gCgzXGA
hQb5yWPEsMMjnkBwm7a9+n0=
=q3EH
-END PGP SIGNATURE-

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] [Warning] Danger from Zope caching, especially the CMF Caching Policy Manager

2006-12-17 Thread Dieter Maurer
Crosspost: 'Reply-To' set to 'zope-cmf'.

We nearly escaped a catastrophy: a page with sensitive personal
information ended in a shared cache and was delivered to arbitrary
people. This happened despite the fact that the template generating
the page contained a response.setHeader('Cache-Control', 'no-cache')
(and related headers for non HTTP/1.1 clients).

The analysis quickly revealed broken design in the
CMF Caching Policy Manager (CPM)
as the cause:

  *  it has applied its general policy depite the fact that
 the template itself has provided more adequate decisions with
 respect to caching

  *  the caching policy manager action affects the complete response.
 Therefore, only the top level object, the object that controls
 the response content, should influence the CPM decisions.

 In the concrete case, the primary template did not trigger
 the CPM but the call of a secondary template responsible only for a tiny
 part of the response.

The same problem also affects Zope's HTMLCacheManager.


The description indicates in what direction the CPM should get fixed:

  * If the response already provides cache control, the CPM should
not override it, as it is likely that the specific information
available to the response generating process is more trustworthy
then the general CPM policies.

This is arguable, especially as it changes the current behaviour.
Maybe, it should be controlled by an additional configuration option.

  * The CPM (and Zope's HTTP Cache Manager) must set cache headers
only based on the object that generated the (complete) response
entity and not based on other objects called during the request
(and probably only responsible for part of the entity).


-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )