comparison rhodecode/model/__init__.py @ 2882:12fce5e499d5 beta

obfuscate password in logs for engine connection string
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 29 Sep 2012 19:16:00 +0200
parents 169807710db2
children 1f7b8c73c94a dc4644865e8b
comparison
equal deleted inserted replaced
2881:6b79e96f6ecd 2882:12fce5e499d5
41 # You should have received a copy of the GNU General Public License 41 # You should have received a copy of the GNU General Public License
42 # along with this program. If not, see <http://www.gnu.org/licenses/>. 42 # along with this program. If not, see <http://www.gnu.org/licenses/>.
43 43
44 import logging 44 import logging
45 from rhodecode.model import meta 45 from rhodecode.model import meta
46 from rhodecode.lib.utils2 import safe_str 46 from rhodecode.lib.utils2 import safe_str, obfuscate_url_pw
47 47
48 log = logging.getLogger(__name__) 48 log = logging.getLogger(__name__)
49 49
50 50
51 def init_model(engine): 51 def init_model(engine):
54 Call this before using any of the tables or classes in the model, 54 Call this before using any of the tables or classes in the model,
55 preferably once in application start 55 preferably once in application start
56 56
57 :param engine: engine to bind to 57 :param engine: engine to bind to
58 """ 58 """
59 log.info("initializing db for %s" % engine) 59 engine_str = obfuscate_url_pw(str(engine.url))
60 log.info("initializing db for %s" % engine_str)
60 meta.Base.metadata.bind = engine 61 meta.Base.metadata.bind = engine
61 62
62 63
63 class BaseModel(object): 64 class BaseModel(object):
64 """ 65 """