Index: formdata.py
===================================================================
--- formdata.py	(révision 2215)
+++ formdata.py	(copie de travail)
@@ -224,8 +224,7 @@
 
         user = self.get_user()
         if user:
-            for k, v in user.get_substitution_variables().items():
-                d['form_'+k] = v
+            d.update(user.get_substitution_variables(prefix='form_'))
 
         data = get_dict_with_varnames(self.formdef.fields, self.data)
         for k, v in data.items():
@@ -266,9 +265,14 @@
                 variables.append((
                         _('Form'), 'form_var_'+field.varname,
                         _('Form Field: %s') % field.label))
-        user_variables = get_publisher().user_class.get_substitution_variables_list()
-        for cat, name, comment in user_variables:
-            variables.append((_('Form'), 'form_%s'%name, ''))
+        if True:
+            # TODO: do this only if form.user exists (think about the "hash" patch)
+            variables.append((_('Form'), 'form_user', _('Form Submitter')))
+            variables.append((_('Form'), 'form_user_display_name', _('Form Submitter Name')))
+            variables.append((_('Form'), 'form_user_email', _('Form Submitter Email')))
+            user_variables = get_publisher().user_class.get_substitution_variables_list(prefix='form_')
+            for cat, name, comment in user_variables:
+                variables.append((_('Form'), name, _('Form Submitter Field')))
         return variables
     get_substitution_variables_list = classmethod(get_substitution_variables_list)
 
@@ -291,6 +295,7 @@
 Substitutions.register('form_url', category=N_('Form'), comment=N_('Form URL'))
 Substitutions.register('form_uri', category=N_('Form'), comment=N_('Form URI'))
 Substitutions.register('form_status_url', category=N_('Form'), comment=N_('Form Status URL'))
-Substitutions.register('form_user_display_name', category=N_('Form'), comment=N_('Form Submitter Name'))
-Substitutions.register('form_user_email', category=N_('Form'), comment=N_('Form Submitter Email'))
+#Substitutions.register('form_user', category=N_('Form'), comment=N_('Form Submitter'))
+#Substitutions.register('form_user_display_name', category=N_('Form'), comment=N_('Form Submitter Name'))
+#Substitutions.register('form_user_email', category=N_('Form'), comment=N_('Form Submitter Email'))
 Substitutions.register_dynamic_source(FormData)
Index: users.py
===================================================================
--- users.py	(révision 2215)
+++ users.py	(copie de travail)
@@ -124,21 +124,21 @@
         return users_with_role
     get_users_with_role = classmethod(get_users_with_role)
 
-    def get_substitution_variables(self):
+    def get_substitution_variables(self, prefix='session_'):
         d = {
-            'user': self,
-            'user_display_name': self.display_name,
-            'user_email': self.email,
+            prefix+'user': self,
+            prefix+'user_display_name': self.display_name,
+            prefix+'user_email': self.email,
         }
         formdef = self.get_formdef()
         if formdef:
             from formdata import get_dict_with_varnames
             data = get_dict_with_varnames(formdef.fields, self.form_data)
             for k, v in data.items():
-                d['user_'+k] = v
+                d[prefix+'user_'+k] = v
         return d
 
-    def get_substitution_variables_list(cls):
+    def get_substitution_variables_list(cls, prefix='session_'):
         formdef = cls.get_formdef()
         if not formdef:
             return []
@@ -148,12 +148,12 @@
             # considered stable
             if field.varname:
                 variables.append((
-                        _('User'), 'user_var_'+field.varname,
-                        _('User Field: %s') % field.label))
+                        _('User'), prefix+'user_var_'+field.varname,
+                        _('Session User Field: %s') % field.label))
         return variables
     get_substitution_variables_list = classmethod(get_substitution_variables_list)
 
-Substitutions.register('user', category=N_('User'), comment=N_('User'))
-Substitutions.register('user_display_name', category=N_('User'), comment=N_('User Display Name'))
-Substitutions.register('user_email', category=N_('User'), comment=N_('User Email'))
+Substitutions.register('session_user', category=N_('User'), comment=N_('Session User'))
+Substitutions.register('session_user_display_name', category=N_('User'), comment=N_('Session User Display Name'))
+Substitutions.register('session_user_email', category=N_('User'), comment=N_('Session User Email'))
 Substitutions.register_dynamic_source(User)
