[ZCM] [ZC] 2147/ 3 Comment "ZCatalog needs better handling of unicode type paths"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Tue Jul 11 08:41:30 EDT 2006


Issue #2147 Update (Comment) "ZCatalog needs better handling of unicode type paths"
 Status Rejected, Zope/bug+solution low
To followup, visit:
  http://www.zope.org/Collectors/Zope/2147

==============================================================
= Comment - Entry #3 by tseaver on Jul 11, 2006 8:41 am

There isn't any particular reason why the underlying catalog code
requires this -- it doesn't even need for RIDs to be string-like. E.g.:

  >>> from Products.ZCatalog.Catalog import Catalog
  >>> c = Catalog()
  >>> class Foo:
  ...     pass
  ...
  >>> foo = Foo()
  >>> foo.a = 'a'
  >>> c.addColumn('a')
  >>> c.catalogObject(foo, ('can', 'be', 'a', 'tuple'))
  >>> c.uids.keys()[0]
  ('can', 'be', 'a', 'tuple')

Aren't we allowing people to use Unicode IDs for objects at this
point?
________________________________________
= Reject - Entry #2 by ajung on Jul 11, 2006 2:33 am

 Status: Pending => Rejected

Paths are not supposed to be unicode strings. 
________________________________________
= Request - Entry #1 by dpollard on Jul 10, 2006 1:35 pm

A large number of folders and Archetypes objects were created programmatically in Plone 2.1.3 on Zope 2.7.8 but did not always appear in the catalog, or at times seemed to disappear from the catalog. Behaviour has been flakey.

The path of the object somehow has been created as a unicode object and ZCatalog expects a string or raises a CatalogError. Adding a test for a unicode object has solved (at least part of) the problem: 

--- ZCatalog.py.orig 2004-05-26 07:47:07.000000000 +0100
+++ ZCatalog.py.modified      2006-07-05 15:47:08.000000000 +0100
@@ -521,7 +521,7 @@
                     "method if no unique id is provided when cataloging"
                     )
             else: uid='/'.join(uid())
-        elif not isinstance(uid,str):
+        elif not isinstance(uid,basestring):  
             raise CatalogError('The object unique id must be a string.')

         self._catalog.catalogObject(obj, uid, None, idxs,

==============================================================



More information about the Zope-Collector-Monitor mailing list