--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_utils/scripts/zodb.py Thu Feb 19 00:46:48 2015 +0100
@@ -0,0 +1,46 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+import optparse
+import sys
+import textwrap
+
+# import interfaces
+
+# import packages
+from pyams_utils.site import site_upgrade
+from pyramid.paster import bootstrap
+
+
+def upgrade_site():
+ """Check for site upgrade"""
+ usage = "usage: %prog config_uri"
+ description = """Check for database upgrade.
+ Usage: pyams_upgrade production.ini
+ """
+ parser = optparse.OptionParser(usage=usage,
+ description=textwrap.dedent(description))
+ options, args = parser.parse_args(sys.argv[1:])
+ if not len(args) >= 1:
+ print("You must provide at least one configuration file")
+ return 2
+ config_uri = args[0]
+ env = bootstrap(config_uri)
+ settings, closer = env['registry'].settings, env['closer']
+ try:
+ site_upgrade(env['request'])
+ finally:
+ closer()