Mercurial > kallithea
diff rhodecode/lib/db_manage.py @ 1510:90062009bb1e beta
added default ldap option into migration
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 04 Oct 2011 22:43:26 +0200 |
parents | b02aa5f2f066 |
children | bf263968da47 2c0d35e336b5 |
line wrap: on
line diff
--- a/rhodecode/lib/db_manage.py Tue Oct 04 14:11:42 2011 +0200 +++ b/rhodecode/lib/db_manage.py Tue Oct 04 22:43:26 2011 +0200 @@ -160,7 +160,9 @@ def step_3(self): print ('Adding additional settings into RhodeCode db') self.klass.fix_settings() - + print ('Adding ldap defaults') + self.klass.create_ldap_options(skip_existing=True) + upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1) #CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE @@ -307,7 +309,7 @@ self.sa.rollback() raise - def create_ldap_options(self): + def create_ldap_options(self,skip_existing=False): """Creates ldap settings""" try: @@ -319,6 +321,9 @@ ('ldap_attr_login', ''), ('ldap_attr_firstname', ''), ('ldap_attr_lastname', ''), ('ldap_attr_email', '')]: + if skip_existing and RhodeCodeSettings.get_by_name(k) != None: + log.debug('Skipping option %s' % k) + continue setting = RhodeCodeSettings(k, v) self.sa.add(setting) self.sa.commit()