# HG changeset patch # User Nicolas VINOT # Date 2011-10-06 23:55:51 # Node ID 8ac6673384322d703b772028d98eced3734fcb4e # Parent 8898a79ac628a49825abbf9af3a3951c7f612381 # Parent a5981def196124e178e16f4164192139230f2f8b Merge with upstream diff --git a/rhodecode/lib/db_manage.py b/rhodecode/lib/db_manage.py --- a/rhodecode/lib/db_manage.py +++ b/rhodecode/lib/db_manage.py @@ -160,7 +160,9 @@ class DbManage(object): 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 @@ class DbManage(object): 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 @@ class DbManage(object): ('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() diff --git a/rhodecode/lib/dbmigrate/versions/003_version_1_2_0.py b/rhodecode/lib/dbmigrate/versions/003_version_1_2_0.py --- a/rhodecode/lib/dbmigrate/versions/003_version_1_2_0.py +++ b/rhodecode/lib/dbmigrate/versions/003_version_1_2_0.py @@ -76,6 +76,14 @@ def upgrade(migrate_engine): #========================================================================== from rhodecode.model.db import Repository + #ADD clone_uri column# + + clone_uri = Column("clone_uri", String(length=255, convert_unicode=False, + assert_unicode=None), + nullable=True, unique=False, default=None) + + clone_uri.create(Repository().__table__) + #ADD downloads column# enable_downloads = Column("downloads", Boolean(), nullable=True, unique=None, default=True) enable_downloads.create(Repository().__table__) @@ -92,21 +100,16 @@ def upgrade(migrate_engine): group_id.create(Repository().__table__) - #ADD clone_uri column# - - clone_uri = Column("clone_uri", String(length=255, convert_unicode=False, - assert_unicode=None), - nullable=True, unique=False, default=None) - - clone_uri.create(Repository().__table__) - - #========================================================================== # Upgrade of `user_followings` table #========================================================================== - follows_from = Column('follows_from', DateTime(timezone=False), nullable=True, unique=None, default=datetime.datetime.now) - follows_from.create(Repository().__table__) + from rhodecode.model.db import UserFollowing + + follows_from = Column('follows_from', DateTime(timezone=False), + nullable=True, unique=None, + default=datetime.datetime.now) + follows_from.create(UserFollowing().__table__) return diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ if py_version < (2, 5): requirements = [ "Pylons==1.0.0", "WebHelpers>=1.2", + "formencode==1.2.4", "SQLAlchemy>=0.7.2,<0.8", "Mako>=0.4.2", "pygments>=1.4",