fix format_field detection for fields not using FormatConstraint tls-sprint
authorsylvain.thenault@logilab.fr
Thu, 12 Mar 2009 18:41:26 +0100
branchtls-sprint
changeset 1100 7ca89f4468e4
parent 1099 2353d1472094
child 1101 0c067de38e46
fix format_field detection for fields not using FormatConstraint
schema.py
--- a/schema.py	Thu Mar 12 18:40:56 2009 +0100
+++ b/schema.py	Thu Mar 12 18:41:26 2009 +0100
@@ -341,11 +341,8 @@
         (the first tuple element containing the text and the second the text format)
         """
         for rschema, _ in self.attribute_definitions():
-            if rschema.type.endswith('_format'):
-                for constraint in self.constraints(rschema):
-                    if isinstance(constraint, FormatConstraint):
-                        yield self.subject_relation(rschema.type[:-7]), rschema
-                        break
+            if rschema.type.endswith('_format') and self.has_subject_relation(rschema.type[:-7]):
+                yield self.subject_relation(rschema.type[:-7]), rschema
                     
     def check_perm(self, session, action, eid=None):
         # NB: session may be a server session or a request object