Changeset 3127

Show
Ignore:
Timestamp:
01/22/08 11:36:42 (8 months ago)
Author:
cbalan
Message:

TeamRosterPlugin: - Initialize session for new users.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • teamrosterplugin/0.11/tracteamroster/userprofiles_stores.py

    r3126 r3127  
    77# 
    88import traceback 
     9import time 
    910from StringIO import StringIO 
    1011 
     
    117118            return False 
    118119         
     120        # initialize user session 
     121        db = self.env.get_db_cnx() 
     122        cursor=db.cursor() 
     123        try: 
     124            cursor.execute("INSERT INTO session (sid, last_visit, authenticated)" 
     125                           " VALUES(%s,%s,1)", [userProfile.id, int(time.time())]) 
     126        except Exception, e: 
     127            self.log.debug("Session for %s exists, no need to re-create it."%(userProfile.id)) 
     128         
     129        # enable user 
    119130        userProfile.enabled = "1" 
    120131        userProfile.store = self 
     
    131142        if not isinstance(userProfile, UserProfile): 
    132143            raise TracError("Class %s is not a instance of UserProfile class"%(userProfile.__class__.__name__)) 
     144         
    133145         
    134146        # grabing the old version in order identify the changes 
     
    317329            return False 
    318330         
     331        # initialize user session 
     332        db = self.env.get_db_cnx() 
     333        cursor=db.cursor() 
     334        try: 
     335            cursor.execute("INSERT INTO session (sid, last_visit, authenticated)" 
     336                           " VALUES(%s,%s,1)", [userProfile.id, int(time.time())]) 
     337        except Exception, e: 
     338            self.log.debug("Session for %s exists, no need to re-create it."%(userProfile.id)) 
     339 
     340        # enable user 
    319341        userProfile.enabled = "1" 
    320342        userProfile.store = self