fix 3.10 deprecation warning
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 21 Oct 2010 18:00:06 +0200
changeset 715 52a9fd8e9380
parent 714 b01c0b4fedc9
child 716 448d9fb3ae71
fix 3.10 deprecation warning
views/__init__.py
--- a/views/__init__.py	Wed Oct 20 17:15:17 2010 +0200
+++ b/views/__init__.py	Thu Oct 21 18:00:06 2010 +0200
@@ -27,8 +27,10 @@
 _('Available checkers:')
 _('Available options:')
 
-def build_help_func(attr, apycot_type, etype='TestConfig'):
-    def help_func(form, attr=attr, apycot_type=apycot_type, etype=etype):
+def build_help_func(apycot_type):
+    def help_func(form, field, apycot_type=apycot_type):
+        attr = field.name
+        etype = form.edited_entity.__regid__
         req = form._cw
         help = req.vreg.schema.eschema(etype).rdef(attr).description
         help = '<div>%s.</div>' % req._(help)
@@ -51,7 +53,7 @@
 
 for etype in ('TestConfig', 'ProjectEnvironment'):
     _afs.tag_subject_of((etype, 'refinement_of', '*'), 'main', 'attributes')
-    helpfunc = build_help_func('check_config', 'options', etype=etype)
+    helpfunc = build_help_func('options')
     _affk.tag_attribute((etype, 'check_config'), {'help': helpfunc})