server/dev-fas.cfg | 1
server/mirrormanager/config/app.cfg | 6 ++--
server/mirrormanager/schema_updates/__init__.py | 12 ++++++--
server/update-database-schema | 35 ++++++++++++++++++++++++
4 files changed, 47 insertions(+), 7 deletions(-)
New commits:
commit 5475353e44cb3672725f0f19d21625479171dd6c
Author: Toshio Kuratomi <toshio(a)fedoraproject.org>
Date: Wed Jul 20 19:59:57 2011 -0700
Two fixes for TG-1.1.x: Set the default template engine to kid
explicitly and remove unneeded sqlalchemy.dburi:/// for using jsonfas
auth.
diff --git a/server/dev-fas.cfg b/server/dev-fas.cfg
index 71b4f6d..3c0414b 100644
--- a/server/dev-fas.cfg
+++ b/server/dev-fas.cfg
@@ -45,7 +45,6 @@ tg.strict_parameters = True
##############################
# Fedora Account System config
-sqlalchemy.dburi="sqlite:///"
identity.provider='jsonfas2'
identity.saprovider.model.visit="fedora.accounts.tgfas.VisitIdentity"
visit.manager="jsonfas2"
diff --git a/server/mirrormanager/config/app.cfg b/server/mirrormanager/config/app.cfg
index a09f610..e6f68bc 100644
--- a/server/mirrormanager/config/app.cfg
+++ b/server/mirrormanager/config/app.cfg
@@ -10,14 +10,14 @@
# which view (template engine) to use if one is not specified in the
# template name
-# tg.defaultview = "kid"
+tg.defaultview = "kid"
# The following kid settings determine the settings used by the kid serializer.
# One of (html|xml|json)
-# kid.outputformat="html"
+kid.outputformat="html"
-# kid.encoding="utf-8"
+kid.encoding="utf-8"
# The sitetemplate is used for overall styling of a site that
# includes multiple TurboGears applications
commit ba082b1b52f1bfa3e53665c572195fa3a949e1e3
Author: Matt Domsch <Matt_Domsch(a)dell.com>
Date: Sat Jul 9 23:33:46 2011 -0500
add update-database-schema, add update_countries()
diff --git a/server/mirrormanager/schema_updates/__init__.py
b/server/mirrormanager/schema_updates/__init__.py
index c164091..ba1cf29 100644
--- a/server/mirrormanager/schema_updates/__init__.py
+++ b/server/mirrormanager/schema_updates/__init__.py
@@ -4,6 +4,7 @@ from turbogears import identity, config
from mirrormanager.model import *
from sqlobject import SQLObject, BoolCol, IntCol
from oldtables import *
+import GeoIP
from turbogears.database import PackageHub
hub = PackageHub("mirrormanager")
@@ -53,6 +54,12 @@ def change_tables():
OldSiteToSite.sqlmeta.addColumn(DatabaseIndex("username_idx",
'upstream_site', 'username', unique=True), changeSchema=True)
changes['sitetosite.username_password'] = True
+def update_countries():
+ db_countries = set(c for c.code in Country.select())
+ geoip_countries = set(GeoIP.country_codes)
+ diff = geoip_countries.difference(db_countries)
+ for cc in diff:
+ Country(code=cc)
def fill_new_columns():
global changes
@@ -80,10 +87,9 @@ def fill_new_columns():
s.username = None
s.password = None
+ update_countries()
+
def update():
- """Fills newly created database columns with information.
- Run this after using tg-admin sql upgrade.
- """
change_tables()
fill_new_columns()
diff --git a/server/update-database-schema b/server/update-database-schema
new file mode 100755
index 0000000..045a7c8
--- /dev/null
+++ b/server/update-database-schema
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+__requires__ = 'TurboGears[future]'
+import pkg_resources
+pkg_resources.require("TurboGears")
+
+import turbogears
+from optparse import OptionParser
+import mirrormanager.schema_updates
+
+from turbogears.database import PackageHub
+hub = __connection__ = None
+
+def doit():
+ mirrormanager.schema_updates.update()
+
+
+def main():
+ parser = OptionParser(usage=sys.argv[0] + " [options]")
+ parser.add_option("-c", "--config",
+ dest="config", default='dev.cfg',
+ help="TurboGears config file to use")
+
+ (options, args) = parser.parse_args()
+
+ turbogears.update_config(configfile=options.config,
+ modulename="mirrormanager.config")
+ global hub
+ global __connection__
+ hub = PackageHub("mirrormanager")
+ __connection__ = hub
+
+ doit()
+
+if __name__ == "__main__":
+ sys.exit(main())
Show replies by date