[form] add assertion to ensure field has a name when `role_name` is called stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 22 Aug 2012 14:17:22 +0200
branchstable
changeset 8517 199fefe396ab
parent 8516 75fe6dca79b4
child 8518 153a7c9cdca9
[form] add assertion to ensure field has a name when `role_name` is called
web/formfields.py
--- a/web/formfields.py	Tue Aug 21 15:23:29 2012 +0200
+++ b/web/formfields.py	Wed Aug 22 14:17:22 2012 +0200
@@ -313,6 +313,7 @@
 
     def role_name(self):
         """return <field.name>-<field.role> if role is specified, else field.name"""
+        assert self.name, 'field without a name (give it to constructor for explicitly built fields)'
         if self.role is not None:
             return role_name(self.name, self.role)
         return self.name