comparison pylons_app/lib/hooks.py @ 536:39203995f2c4

made action logger more global, to be used in other places to log other actions. cleaned unused import in simpleHG, fixed little logging in hooks
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 02 Oct 2010 01:52:43 +0200
parents 3d6d548ad3cc
children
comparison
equal deleted inserted replaced
535:72778dda34cf 536:39203995f2c4
61 try: 61 try:
62 sa = meta.Session 62 sa = meta.Session
63 username = kwargs['url'].split(':')[-1] 63 username = kwargs['url'].split(':')[-1]
64 user_log = sa.query(UserLog)\ 64 user_log = sa.query(UserLog)\
65 .filter(UserLog.user == sa.query(User)\ 65 .filter(UserLog.user == sa.query(User)\
66 .filter(User.username == username).one())\ 66 .filter(User.username == username).one())\
67 .order_by(UserLog.user_log_id.desc()).first() 67 .order_by(UserLog.user_log_id.desc()).first()
68 68
69 if not user_log.revision: 69 if user_log and not user_log.revision:
70 user_log.revision = str(repo['tip']) 70 user_log.revision = str(repo['tip'])
71 sa.add(user_log) 71 sa.add(user_log)
72 sa.commit() 72 sa.commit()
73 73
74 except Exception, e: 74 except Exception, e: