You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by rj...@apache.org on 2014/03/04 06:25:43 UTC

svn commit: r1573857 - /bloodhound/trunk/bloodhound_relations/bhrelations/validation.py

Author: rjollos
Date: Tue Mar  4 05:25:43 2014
New Revision: 1573857

URL: http://svn.apache.org/r1573857
Log:
0.8dev: Make exception message in `OneToManyValidator` translatable and use markup to emphasize text. Refs #776,

Modified:
    bloodhound/trunk/bloodhound_relations/bhrelations/validation.py

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/validation.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/validation.py?rev=1573857&r1=1573856&r2=1573857&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/validation.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/validation.py Tue Mar  4 05:25:43 2014
@@ -17,8 +17,10 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
+from genshi.builder import tag
 from trac.core import Component, implements, TracError
 from trac.resource import get_resource_shortname
+from trac.util.translation import tag_
 
 from bhrelations.api import IRelationValidator, RelationsSystem, \
     ResourceIdSerializer, TicketRelationsSpecifics
@@ -182,10 +184,11 @@ class OneToManyValidator(Validator):
                                                    relation.type)
         if existing_relations:
             raise ValidationError(
-                "%s can only have one %s" % (
-                    relation.source,
-                    self.render_relation_type(relation.type)
-                ))
+                tag_("Resource %(source)s can only have one %(relation)s "
+                     "relation.",
+                     source=tag.em(relation.source),
+                     relation=tag.b(self.render_relation_type(relation.type)))
+            )
 
 
 class ReferencesOlderValidator(Validator):