equal
deleted
inserted
replaced
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
10 # FOR A PARTICULAR PURPOSE. |
10 # FOR A PARTICULAR PURPOSE. |
11 # |
11 # |
12 |
12 |
13 __docformat__ = 'restructuredtext' |
13 """PyAMS_utils.scripts.zodb module |
14 |
14 |
|
15 This module provides a single function which will be used by "pyams_upgrade" command line |
|
16 script to upgrade existing database schema when installing a new application release |
|
17 """ |
15 |
18 |
16 # import standard library |
|
17 import argparse |
19 import argparse |
18 import sys |
20 import sys |
19 import textwrap |
21 import textwrap |
20 |
22 |
21 # import interfaces |
23 from pyramid.paster import bootstrap |
22 |
24 |
23 # import packages |
|
24 from pyams_utils.site import site_upgrade |
25 from pyams_utils.site import site_upgrade |
25 from pyramid.paster import bootstrap |
26 |
|
27 |
|
28 __docformat__ = 'restructuredtext' |
26 |
29 |
27 |
30 |
28 def upgrade_site(): |
31 def upgrade_site(): |
29 """Check for site upgrade""" |
32 """Check for site upgrade""" |
30 usage = "usage: {0} config_uri".format(sys.argv[0]) |
33 usage = "usage: {0} config_uri".format(sys.argv[0]) |
36 parser.add_argument('config_uri', help='Name of configuration file') |
39 parser.add_argument('config_uri', help='Name of configuration file') |
37 args = parser.parse_args() |
40 args = parser.parse_args() |
38 |
41 |
39 config_uri = args.config_uri |
42 config_uri = args.config_uri |
40 env = bootstrap(config_uri) |
43 env = bootstrap(config_uri) |
41 settings, closer = env['registry'].settings, env['closer'] |
44 closer = env['closer'] |
42 try: |
45 try: |
43 site_upgrade(env['request']) |
46 site_upgrade(env['request']) |
44 finally: |
47 finally: |
45 closer() |
48 closer() |