annotate rhodecode/lib/dbmigrate/versions/008_version_1_5_0.py @ 4116:ffd45b185016 rhodecode-2.2.5-gpl

Imported some of the GPLv3'd changes from RhodeCode v2.2.5. This imports changes between changesets 21af6c4eab3d and 6177597791c2 in RhodeCode's original repository, including only changes to Python files and HTML. RhodeCode clearly licensed its changes to these files under GPLv3 in their /LICENSE file, which states the following: The Python code and integrated HTML are licensed under the GPLv3 license. (See: https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE or http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE for an online copy of that LICENSE file) Conservancy reviewed these changes and confirmed that they can be licensed as a whole to the Kallithea project under GPLv3-only. While some of the contents committed herein are clearly licensed GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the statement above from RhodeCode indicates that they intend GPLv3-only as their license, per GPLv3ยง14 and other relevant sections of GPLv3.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:03:13 -0400
parents b31984972e95
children 7e5f8c12a3fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3052
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 import logging
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2 import datetime
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4 from sqlalchemy import *
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 from sqlalchemy.exc import DatabaseError
3063
ca2b21819dfd Implemented better support for Wildcard queries
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
6 from sqlalchemy.orm import relation, backref, class_mapper, joinedload
3052
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 from sqlalchemy.orm.session import Session
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 from sqlalchemy.ext.declarative import declarative_base
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
10 from rhodecode.lib.dbmigrate.migrate import *
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 from rhodecode.lib.dbmigrate.migrate.changeset import *
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 from rhodecode.model.meta import Base
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14 from rhodecode.model import meta
3148
b31984972e95 Migration upgrades cache for lightweight dashboard
Marcin Kuzminski <marcin@python-works.com>
parents: 3086
diff changeset
15 from rhodecode.lib.dbmigrate.versions import _reset_base
3052
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 log = logging.getLogger(__name__)
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
18
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
19
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 def upgrade(migrate_engine):
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21 """
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
22 Upgrade operations go here.
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23 Don't create your own engine; bind migrate_engine to your metadata
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 """
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
25 _reset_base(migrate_engine)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
26 from rhodecode.lib.dbmigrate.schema import db_1_5_0
3063
ca2b21819dfd Implemented better support for Wildcard queries
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
27 #==========================================================================
ca2b21819dfd Implemented better support for Wildcard queries
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
28 # USER LOGS
ca2b21819dfd Implemented better support for Wildcard queries
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
29 #==========================================================================
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
30
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
31 tbl = db_1_5_0.UserLog.__table__
3063
ca2b21819dfd Implemented better support for Wildcard queries
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
32 username = Column("username", String(255, convert_unicode=False,
ca2b21819dfd Implemented better support for Wildcard queries
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
33 assert_unicode=None), nullable=True,
ca2b21819dfd Implemented better support for Wildcard queries
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
34 unique=None, default=None)
ca2b21819dfd Implemented better support for Wildcard queries
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
35 # create username column
ca2b21819dfd Implemented better support for Wildcard queries
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
36 username.create(table=tbl)
ca2b21819dfd Implemented better support for Wildcard queries
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
37
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
38 _Session = meta.Session()
3086
f9c44f3ed4c6 fixed migrations
Marcin Kuzminski <marcin@python-works.com>
parents: 3065
diff changeset
39 ## after adding that column fix all usernames
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
40 users_log = _Session.query(db_1_5_0.UserLog)\
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
41 .options(joinedload(db_1_5_0.UserLog.user))\
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
42 .options(joinedload(db_1_5_0.UserLog.repository)).all()
3086
f9c44f3ed4c6 fixed migrations
Marcin Kuzminski <marcin@python-works.com>
parents: 3065
diff changeset
43
f9c44f3ed4c6 fixed migrations
Marcin Kuzminski <marcin@python-works.com>
parents: 3065
diff changeset
44 for entry in users_log:
f9c44f3ed4c6 fixed migrations
Marcin Kuzminski <marcin@python-works.com>
parents: 3065
diff changeset
45 entry.username = entry.user.username
f9c44f3ed4c6 fixed migrations
Marcin Kuzminski <marcin@python-works.com>
parents: 3065
diff changeset
46 _Session.add(entry)
f9c44f3ed4c6 fixed migrations
Marcin Kuzminski <marcin@python-works.com>
parents: 3065
diff changeset
47 _Session.commit()
f9c44f3ed4c6 fixed migrations
Marcin Kuzminski <marcin@python-works.com>
parents: 3065
diff changeset
48
f9c44f3ed4c6 fixed migrations
Marcin Kuzminski <marcin@python-works.com>
parents: 3065
diff changeset
49 #alter username to not null
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
50 tbl_name = db_1_5_0.UserLog.__tablename__
3065
09e8623362ef remove not null from user_id column for users log archiving
Marcin Kuzminski <marcin@python-works.com>
parents: 3063
diff changeset
51 tbl = Table(tbl_name,
09e8623362ef remove not null from user_id column for users log archiving
Marcin Kuzminski <marcin@python-works.com>
parents: 3063
diff changeset
52 MetaData(bind=migrate_engine), autoload=True,
09e8623362ef remove not null from user_id column for users log archiving
Marcin Kuzminski <marcin@python-works.com>
parents: 3063
diff changeset
53 autoload_with=migrate_engine)
3086
f9c44f3ed4c6 fixed migrations
Marcin Kuzminski <marcin@python-works.com>
parents: 3065
diff changeset
54 col = tbl.columns.username
3065
09e8623362ef remove not null from user_id column for users log archiving
Marcin Kuzminski <marcin@python-works.com>
parents: 3063
diff changeset
55
09e8623362ef remove not null from user_id column for users log archiving
Marcin Kuzminski <marcin@python-works.com>
parents: 3063
diff changeset
56 # remove nullability from revision field
3086
f9c44f3ed4c6 fixed migrations
Marcin Kuzminski <marcin@python-works.com>
parents: 3065
diff changeset
57 col.alter(nullable=False)
3052
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
58
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
59 # issue fixups
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
60 fixups(db_1_5_0, meta.Session)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
61
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 3052
diff changeset
62
3052
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
63 def downgrade(migrate_engine):
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
64 meta = MetaData()
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
65 meta.bind = migrate_engine
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
66
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
67
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
68 def fixups(models, _SESSION):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
69 # ** create default permissions ** #
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
70 #=====================================
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
71 for p in models.Permission.PERMS:
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
72 if not models.Permission.get_by_key(p[0]):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
73 new_perm = models.Permission()
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
74 new_perm.permission_name = p[0]
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
75 new_perm.permission_longname = p[0] #translation err with p[1]
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
76 print 'Creating new permission %s' % p[0]
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
77 _SESSION().add(new_perm)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
78
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
79 _SESSION().commit()
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
80
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
81 # ** populate default permissions ** #
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
82 #=====================================
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
83
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
84 user = models.User.query().filter(models.User.username == 'default').scalar()
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
85
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
86 def _make_perm(perm):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
87 new_perm = models.UserToPerm()
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
88 new_perm.user = user
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
89 new_perm.permission = models.Permission.get_by_key(perm)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
90 return new_perm
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
91
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
92 def _get_group(perm_name):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
93 return '.'.join(perm_name.split('.')[:1])
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
94
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
95 perms = models.UserToPerm.query().filter(models.UserToPerm.user == user).all()
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
96 defined_perms_groups = map(_get_group,
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
97 (x.permission.permission_name for x in perms))
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
98 log.debug('GOT ALREADY DEFINED:%s' % perms)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
99 DEFAULT_PERMS = models.Permission.DEFAULT_USER_PERMISSIONS
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
100
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
101 # for every default permission that needs to be created, we check if
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
102 # it's group is already defined, if it's not we create default perm
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
103 for perm_name in DEFAULT_PERMS:
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
104 gr = _get_group(perm_name)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
105 if gr not in defined_perms_groups:
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
106 log.debug('GR:%s not found, creating permission %s'
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
107 % (gr, perm_name))
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
108 new_perm = _make_perm(perm_name)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
109 _SESSION().add(new_perm)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
110 _SESSION().commit()
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
111
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
112 # ** create default options ** #
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
113 #===============================
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
114 skip_existing = True
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
115 for k, v in [
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
116 ('default_repo_enable_locking', False),
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
117 ('default_repo_enable_downloads', False),
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
118 ('default_repo_enable_statistics', False),
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
119 ('default_repo_private', False),
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
120 ('default_repo_type', 'hg')]:
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
121
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
122 if skip_existing and models.RhodeCodeSetting.get_by_name(k) is not None:
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
123 log.debug('Skipping option %s' % k)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
124 continue
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
125 setting = models.RhodeCodeSetting(k, v)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
126 _SESSION().add(setting)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
127
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3148
diff changeset
128 _SESSION().commit()