[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/module/ Use normal strings for ModuleManager names

Ross Patterson me at rpatterson.net
Mon Feb 5 20:33:51 EST 2007


Log message for revision 72386:
  Use normal strings for ModuleManager names
  
  When unicode strings are used for manager names, interfaces break.  As
  such, convert unicode values to ascii values on manager registration
  to solve this problem.
  

Changed:
  U   Zope3/trunk/src/zope/app/module/interfaces.txt
  U   Zope3/trunk/src/zope/app/module/manager.py

-=-
Modified: Zope3/trunk/src/zope/app/module/interfaces.txt
===================================================================
--- Zope3/trunk/src/zope/app/module/interfaces.txt	2007-02-05 23:22:29 UTC (rev 72385)
+++ Zope3/trunk/src/zope/app/module/interfaces.txt	2007-02-06 01:33:48 UTC (rev 72386)
@@ -23,7 +23,7 @@
   >>> from zope.app.module import interfaces
   >>> root = setup.buildSampleFolderTree()
   >>> root_sm = setup.createSiteManager(root)
-  >>> manager = setup.addUtility(root_sm, 'foo',
+  >>> manager = setup.addUtility(root_sm, u'foo',
   ...                            interfaces.IModuleManager, manager)
 
 Now we can compile a module with interfaces and access everything

Modified: Zope3/trunk/src/zope/app/module/manager.py
===================================================================
--- Zope3/trunk/src/zope/app/module/manager.py	2007-02-05 23:22:29 UTC (rev 72385)
+++ Zope3/trunk/src/zope/app/module/manager.py	2007-02-06 01:33:48 UTC (rev 72386)
@@ -92,7 +92,9 @@
                         zope.component.interfaces.IRegistered)
 def setNameOnActivation(manager, event):
     """Set the module name upon registration activation."""
-    manager.name = event.object.name
+    # Convert the name to a normal string to avoid problems with
+    # unicode module names
+    manager.name = str(event.object.name)
 
 @zope.component.adapter(IModuleManager,
                         zope.component.interfaces.IUnregistered)



More information about the Zope3-Checkins mailing list