[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/component/registration.py Added translation slots

Dmitry Vasiliev dima at hlabs.spb.ru
Thu Jun 30 04:05:49 EDT 2005


Log message for revision 30952:
  Added translation slots
  

Changed:
  U   Zope3/trunk/src/zope/app/component/registration.py

-=-
Modified: Zope3/trunk/src/zope/app/component/registration.py
===================================================================
--- Zope3/trunk/src/zope/app/component/registration.py	2005-06-29 21:48:07 UTC (rev 30951)
+++ Zope3/trunk/src/zope/app/component/registration.py	2005-06-30 08:05:48 UTC (rev 30952)
@@ -31,10 +31,12 @@
 from zope.app.event import objectevent
 from zope.app.location import inside
 from zope.app.traversing.interfaces import TraversalError
+from zope.app.i18n import ZopeMessageIDFactory as _
 
 # BBB: First introduced in 3.1; should go away in 3.3 
 import bbb
 
+
 class RegistrationEvent(objectevent.ObjectEvent):
     """An event that is created when a registration-related activity occured."""
     implements(interfaces.IRegistrationEvent)
@@ -58,7 +60,7 @@
         registry = registration.getRegistry()
         if registry and registry.registered(registration):
             return interfaces.ActiveStatus
-        
+
         return interfaces.InactiveStatus
 
     def __set__(self, inst, value):
@@ -90,8 +92,8 @@
 
     def getRegistry(self):
         """See interfaces.IRegistration"""
-        raise NotImplementedError, \
-              'This method must be implemented by each specific regstration.' 
+        raise NotImplementedError(
+              'This method must be implemented by each specific regstration.')
 
 
 class ComponentRegistration(bbb.registration.BBBComponentRegistration,
@@ -106,7 +108,7 @@
     def __init__(self, component, permission=None):
         # BBB: Will go away in 3.3.
         super(ComponentRegistration, self).__init__(component, permission)
-        # self.component = component        
+        # self.component = component
         if permission == 'zope.Public':
             permission = CheckerPublic
         self.permission = permission
@@ -145,8 +147,9 @@
             objectpath = zapi.getPath(registration)
         except: # XXX
             objectpath = str(registration)
-        raise DependencyError("Can't delete active registration (%s)"
-                              % objectpath)
+        msg = _("Can't delete active registration (${path})")
+        msg.mapping["path"] = objectpath
+        raise DependencyError(msg)
 
 
 def ComponentRegistrationRemoveSubscriber(componentRegistration, event):
@@ -184,7 +187,7 @@
     if event.oldParent is not None and event.newParent is not None:
         if event.oldParent is not event.newParent:
             raise DependencyError(
-                "Can't move a registered component from its container.")
+                _("Can't move a registered component from its container."))
 
 
 class Registered(bbb.registration.BBBRegistered, object):
@@ -260,9 +263,8 @@
 
     def __init__(self, ob, request=None):
         self.context = ob.registrationManager
-        
+
     def traverse(self, name, ignore):
         if name == '':
             return self.context
         raise TraversalError(self.context, name)
-        



More information about the Zope3-Checkins mailing list