[Scodoc-devel] [SVN] Scolar : [1209] - Fixed problem with Zope DB transactions on Users db.

eviennet at lipn.univ-paris13.fr eviennet at lipn.univ-paris13.fr
Jeu 14 Mar 11:24:17 CET 2013


Une pièce jointe HTML a été nettoyée...
URL: <https://www-rt.iutv.univ-paris13.fr/pipermail/scodoc-devel/attachments/20130314/fb7f3d30/attachment.html>
-------------- section suivante --------------
Modified: trunk/ZScoUsers.py
===================================================================
--- trunk/ZScoUsers.py	2013-03-14 09:22:20 UTC (rev 1208)
+++ trunk/ZScoUsers.py	2013-03-14 10:24:17 UTC (rev 1209)
@@ -348,18 +348,18 @@
         user = self._user_list( args={'user_name':user_name} )
         assert len(user) == 1, 'database inconsistency: len(r)=%d'%len(r)
         # should not occur, already tested in _can_handle_passwd
-        cnx = self.GetUsersDBConnexion()
+        cnx = self.GetUsersDBConnexion() # en mode autocommit
         cursor = cnx.cursor(cursor_factory=ScoDocCursor)
         cursor.execute('update sco_users set date_modif_passwd=now(), passwd_temp=0 where user_name=%(user_name)s',
                        { 'user_name' : user_name } )
-        cnx.commit()
         req = { 'password' : password,
                 'password_confirm' : password,
                 'roles' : [user[0]['roles']] }
 
         # Laisse le exUserFolder modifier les donnees
         self.acl_users.manage_editUser( user_name, req )
-        
+        # Termine cette transaction:
+        self.UsersDB().db.commit()
         log("change_password: change ok for %s" % user_name)
         self.get_userlist_cache().inval_cache() #>
 
@@ -1026,11 +1026,11 @@
         cursor = cnx.cursor(cursor_factory=ScoDocCursor)
         ui = { 'user_name' : user_name }
         cursor.execute("update sco_users set passwd_temp=1 where user_name='%(user_name)s'" % ui)
-
         # Send email
         info['passwd'] = password
         sco_import_users.mail_password(info, context=self, reset=True)
 
+                
 # --------------------------------------------------------------------
 #
 # Zope Product Administration


Plus d'informations sur la liste de diffusion Scodoc-devel