Re: [Zope-dev] Relaxing Zope id rules for Zope 4 / Plone 5
On Feb 20, 2013, at 12:47 , Marius Gedminas wrote: > On Wed, Feb 20, 2013 at 09:57:52AM +0100, Wichert Akkerman wrote: >> I want to propose that we do the following: >> >> Allow arbitrary str object ids in Zope 4 based on Dieter's work. >> Configure standard name choosers, normalizers, etc. used to generate >> ids for content to create UTF-8 object ids. > > *puts Python 3 porter hat on* > > Why UTF-8 byte strings instead of Unicode? One subtle difference: I suggest byte strings which are set by default to UTF-8 encoded strings when they are generated, but can be anything. I have several reasons to not want to use unicode. One reason is that I am worried that this will break too much existing code; it is likely to require much more invasive changes in both Zope itself and third party packages. A second reason is that I feel that using unicode for an id is just wrong: an id can be any binary thing and does not need to be text: consider for example the unique ID for a user in active directory (ObjectGUID), or it can be text in a script that unicode does not support (http://www.unicode.org/standard/unsupported.html has a list), or it can come from a source that uses an unknown encoding or multiple encodings at the same time such as a filesystem or WebDAV users. For examples of the last see the crazy hoops Python 3 has to jump through to expose files via a unicode API, and even with all its magic tricks it still does not seem to work perfectly. The vast majority of object ids are text, but the ability to support other types of ids is extremely usef ul. So my suggestion would be: use unicode for object titles, descriptions, etc. but stick with byte strings for ids. Wichert. ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Relaxing Zope id rules for Zope 4 / Plone 5
On Wed, Feb 20, 2013 at 09:57:52AM +0100, Wichert Akkerman wrote: > I want to propose that we do the following: > > Allow arbitrary str object ids in Zope 4 based on Dieter's work. > Configure standard name choosers, normalizers, etc. used to generate > ids for content to create UTF-8 object ids. *puts Python 3 porter hat on* Why UTF-8 byte strings instead of Unicode? Marius Gedminas -- http://pov.lt/ -- Zope 3/BlueBream consulting and development signature.asc Description: Digital signature ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Relaxing Zope id rules for Zope 4 / Plone 5
Currently Zope has two rules for object ids: 1) they must be str instances, and 2) they must only consist of alphanumerics and a few extra characters. I have been playing around recently with trying to relax those rules to allow more flexible object ids, specifically allowing UTF-8 object ids. That seems to be entirely doable, and I made a simple package which monkey-patches Zope to do this: https://github.com/wichert/experimental.utf8id . Since all current browsers will interpret URLs as UTF-8 strings this will create beautiful URLs and gets us out of the ASCII-jail. Based on the result so far I want to suggest that we officially allow more flexible object ids for Zope 4. Dieter Mauer tried something similar five (!!) years ago: https://github.com/zopefoundation/Zope/commit/40f1a4af3605204de7d803afe11f6cbbc97e0ccd . His approach differs a bit from mine: I added checks to make sure ids are valid UTF-8 and still disallow some characters, while he allows everything except a slash (/). That has the advantage of easily supporting things like binary user ids (for example GUIDs from Active Directory users). I want to propose that we do the following: Allow arbitrary str object ids in Zope 4 based on Dieter's work. Configure standard name choosers, normalizers, etc. used to generate ids for content to create UTF-8 object ids. Wichert. ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )