Merge lp:~elachuni/rnr-server/configglue-1.0 into lp:rnr-server

Proposed by Anthony Lenton
Status: Merged
Approved by: Łukasz Czyżykowski
Approved revision: 215
Merged at revision: 215
Proposed branch: lp:~elachuni/rnr-server/configglue-1.0
Merge into: lp:rnr-server
Diff against target: 297 lines (+101/-96)
6 files modified
django_project/config_dev/settings.py (+5/-15)
requirements.txt (+2/-2)
setup.py (+2/-2)
src/reviewsapp/schema.py (+88/-77)
src/reviewsapp/tests/test_middleware.py (+3/-0)
src/reviewsapp/tests/test_pep8.py (+1/-0)
To merge this branch: bzr merge lp:~elachuni/rnr-server/configglue-1.0
Reviewer Review Type Date Requested Status
Ratings and Reviews Developers Pending
Review via email: mp+99427@code.launchpad.net

Commit message

Updated to configglue 1.0.1

Description of the change

This branch switches rnr-server to use the latest configglue 1.0.1.
Deploying thins branch will require pulling in configglue from a branch, until all co-hosted services are upgraded.

While I was there I updated the pep8-test to work with the latest pep8 0.7.0 that was released today (that added "max_line_length" to the list of options), and fixed a middleware test.

To post a comment you must log in.
215. By Anthony Lenton

Upgraded configglue to 1.0.1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'django_project/config_dev/settings.py'
2--- django_project/config_dev/settings.py 2011-07-06 20:00:34 +0000
3+++ django_project/config_dev/settings.py 2012-03-26 21:47:20 +0000
4@@ -1,29 +1,19 @@
5 import logging.config
6 import os.path
7
8-try:
9- from configglue.pyschema import SchemaConfigParser
10-except ImportError:
11- from configglue.pyschema.parser import SchemaConfigParser
12-
13-from django_configglue.utils import update_settings, SETTINGS_ENCODING
14+from django_configglue.utils import configglue
15
16 from reviewsapp.schema import RnRSchema
17
18
19 # get absolute path for config files
20 current_dir = os.path.dirname(os.path.abspath(__file__))
21-config_files = map(lambda x: os.path.join(current_dir, x),
22+config_files = [path for path in map(lambda x: os.path.join(current_dir, x),
23 ['config/main.cfg', '../../local_config/local.cfg',
24 'local.cfg'])
25-
26-# parse config files
27-parser = SchemaConfigParser(RnRSchema())
28-parser.read(config_files)
29-update_settings(parser, locals())
30-
31-# keep parser reference
32-__CONFIGGLUE_PARSER__ = parser
33+ if os.path.exists(path)]
34+
35+configglue(RnRSchema, config_files, __name__)
36
37 if 'LOGGING_CONFIG_FILE' in locals():
38 logging.config.fileConfig(os.path.join(current_dir, LOGGING_CONFIG_FILE))
39
40=== modified file 'requirements.txt'
41--- requirements.txt 2012-02-06 15:38:27 +0000
42+++ requirements.txt 2012-03-26 21:47:20 +0000
43@@ -1,8 +1,8 @@
44 -f https://launchpad.net/launchpadlib/+download?start=10
45-configglue==0.10
46+configglue==1.0.1
47 coverage
48 django==1.3
49-django-configglue==0.4
50+django-configglue==0.6.1
51 django-openid-auth==0.2
52 django-piston
53 python-openid
54
55=== modified file 'setup.py'
56--- setup.py 2011-09-21 20:41:33 +0000
57+++ setup.py 2012-03-26 21:47:20 +0000
58@@ -18,8 +18,8 @@
59 'django',
60 'django-openid-auth==0.2',
61 'django-piston',
62- 'configglue==0.10',
63- 'django-configglue==0.4',
64+ 'configglue==1.0.1',
65+ 'django-configglue==0.6.1',
66 'python-openid',
67 'south==0.7',
68 'launchpadlib==1.6.0',
69
70=== modified file 'src/reviewsapp/schema.py'
71--- src/reviewsapp/schema.py 2012-03-21 22:05:09 +0000
72+++ src/reviewsapp/schema.py 2012-03-26 21:47:20 +0000
73@@ -1,19 +1,30 @@
74+# This file is part of Software Center Ratings and Reviews
75+# Copyright (C) 2010 Canonical Ltd.
76+#
77+# This program is free software: you can redistribute it and/or modify
78+# it under the terms of the GNU Affero General Public License as
79+# published by the Free Software Foundation, either version 3 of the
80+# License, or (at your option) any later version.
81+#
82+# This program is distributed in the hope that it will be useful,
83+# but WITHOUT ANY WARRANTY; without even the implied warranty of
84+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
85+# GNU Affero General Public License for more details.
86+#
87+# You should have received a copy of the GNU Affero General Public License
88+# along with this program. If not, see <http://www.gnu.org/licenses/>.
89+
90+"""Configuration schema declaration."""
91+
92+from __future__ import absolute_import
93+
94+__metaclass__ = type
95+__all__ = [
96+ 'RnRSchema',
97+ ]
98+
99 import django
100-
101-# This conditional import is to support reorganization of the code in latest
102-# configglue branch (the one required by django-configglue trunk).
103-try:
104- from configglue.pyschema import ConfigSection
105- from configglue.pyschema.options import (
106- BoolConfigOption, DictConfigOption,
107- IntConfigOption, LinesConfigOption, StringConfigOption
108- )
109-except ImportError:
110- from configglue.pyschema.schema import (
111- ConfigSection, BoolConfigOption, DictConfigOption, IntConfigOption,
112- LinesConfigOption, StringConfigOption
113- )
114-
115+from configglue import schema
116 from django_configglue.schema import schemas
117
118 DjangoSchema = schemas.get(django.get_version())
119@@ -21,83 +32,83 @@
120
121 class RnRSchema(DjangoSchema):
122 # default
123- pgconnect_timeout = IntConfigOption(default=10)
124- serve_static_media = BoolConfigOption()
125- extra_pythonpath = LinesConfigOption(item=StringConfigOption())
126- default_timeout = IntConfigOption(default=None)
127- soft_request_timeout = IntConfigOption(default=20)
128+ pgconnect_timeout = schema.IntOption(default=10)
129+ serve_static_media = schema.BoolOption()
130+ extra_pythonpath = schema.ListOption(item=schema.StringOption())
131+ default_timeout = schema.IntOption(default=None)
132+ soft_request_timeout = schema.IntOption(default=20)
133
134 # openid
135- openid = ConfigSection()
136- openid.openid_create_users = BoolConfigOption()
137- openid.openid_reuse_users = BoolConfigOption()
138- openid.openid_launchpad_teams_mapping = DictConfigOption()
139- openid.openid_sso_server_url = StringConfigOption()
140- openid.openid_set_language_from_sreg = BoolConfigOption()
141- openid.openid_update_details_from_sreg = BoolConfigOption()
142- openid.openid_sreg_extra_fields = LinesConfigOption(
143- item=StringConfigOption())
144- openid.openid_sreg_required_fields = LinesConfigOption(
145- item=StringConfigOption())
146- openid.openid_launchpad_staff_teams = LinesConfigOption(
147- item=StringConfigOption())
148+ class openid(schema.Section):
149+ openid_create_users = schema.BoolOption()
150+ openid_reuse_users = schema.BoolOption()
151+ openid_launchpad_teams_mapping = schema.DictOption()
152+ openid_sso_server_url = schema.StringOption()
153+ openid_set_language_from_sreg = schema.BoolOption()
154+ openid_update_details_from_sreg = schema.BoolOption()
155+ openid_sreg_extra_fields = schema.ListOption(
156+ item=schema.StringOption())
157+ openid_sreg_required_fields = schema.ListOption(
158+ item=schema.StringOption())
159+ openid_launchpad_staff_teams = schema.ListOption(
160+ item=schema.StringOption())
161
162 # logging
163- logging = ConfigSection()
164- logging.oops_dir = StringConfigOption(help='Absolute path to the'
165- 'directory oops reports will be stored in')
166- logging.logging_config_file = StringConfigOption(fatal=True)
167+ class logging(schema.Section):
168+ oops_dir = schema.StringOption(help='Absolute path to the'
169+ 'directory oops reports will be stored in')
170+ logging_config_file = schema.StringOption(fatal=True)
171
172 # loadtest
173- loadtest = ConfigSection()
174- loadtest.enable_statistics_logging = BoolConfigOption()
175- loadtest.network_interfaces = LinesConfigOption(item=StringConfigOption())
176- loadtest.disks = LinesConfigOption(item=StringConfigOption())
177- loadtest.seconds_between_logging = IntConfigOption(default=5)
178- loadtest.stats_to_log = LinesConfigOption(item=StringConfigOption())
179+ class loadtest(schema.Section):
180+ enable_statistics_logging = schema.BoolOption()
181+ network_interfaces = schema.ListOption(
182+ item=schema.StringOption())
183+ disks = schema.ListOption(item=schema.StringOption())
184+ seconds_between_logging = schema.IntOption(default=5)
185+ stats_to_log = schema.ListOption(item=schema.StringOption())
186
187 # SSO API
188- sso_api = ConfigSection()
189- sso_api.sso_api_service_root = StringConfigOption()
190- sso_api.sso_api_auth_username = StringConfigOption()
191- sso_api.sso_api_auth_password = StringConfigOption()
192- sso_api.sso_api_identity_prefix = StringConfigOption()
193- sso_api.sso_auth_mode_no_ubuntu_sso_plaintext_only = BoolConfigOption()
194+ class sso_api(schema.Section):
195+ sso_api_service_root = schema.StringOption()
196+ sso_api_auth_username = schema.StringOption()
197+ sso_api_auth_password = schema.StringOption()
198+ sso_api_identity_prefix = schema.StringOption()
199+ sso_auth_mode_no_ubuntu_sso_plaintext_only = schema.BoolOption()
200
201 # RnR
202- rnr = ConfigSection()
203- rnr.moderators_group = StringConfigOption()
204- rnr.preload_api_service_roots = BoolConfigOption()
205- rnr.api_reviews_pagination = IntConfigOption()
206- rnr.cache_review_stats_seconds = IntConfigOption()
207- rnr.token_cache_expiry_hours = IntConfigOption(default=4)
208- rnr.reviewsapp_media_root = StringConfigOption()
209- rnr.force_https_in_environment = BoolConfigOption()
210- rnr.allow_multiple_reviews_for_testing = BoolConfigOption(default=False)
211- rnr.enable_artificial_oops = BoolConfigOption()
212- rnr.modify_window_minutes = IntConfigOption()
213- rnr.enable_gzip_content = BoolConfigOption(default=True)
214- rnr.enable_histogram_data = BoolConfigOption(default=True)
215+ class rnr(schema.Section):
216+ moderators_group = schema.StringOption()
217+ preload_api_service_roots = schema.BoolOption()
218+ api_reviews_pagination = schema.IntOption()
219+ cache_review_stats_seconds = schema.IntOption()
220+ token_cache_expiry_hours = schema.IntOption(default=4)
221+ reviewsapp_media_root = schema.StringOption()
222+ force_https_in_environment = schema.BoolOption()
223+ allow_multiple_reviews_for_testing = schema.BoolOption(default=False)
224+ enable_artificial_oops = schema.BoolOption()
225+ modify_window_minutes = schema.IntOption()
226+ enable_gzip_content = schema.BoolOption(default=True)
227+ enable_histogram_data = schema.BoolOption(default=True)
228
229 # Launchpad
230- launchpad = ConfigSection()
231- launchpad.lp_service = StringConfigOption()
232- launchpad.lp_consumer_name = StringConfigOption()
233- launchpad.launchpadlib_dir = StringConfigOption(
234- default='/tmp/.launchpadlib')
235+ class launchpad(schema.Section):
236+ lp_service = schema.StringOption()
237+ lp_consumer_name = schema.StringOption()
238+ launchpadlib_dir = schema.StringOption(default='/tmp/.launchpadlib')
239
240 # Piston
241- piston = ConfigSection()
242- piston.oauth_data_store = StringConfigOption()
243+ class piston(schema.Section):
244+ oauth_data_store = schema.StringOption()
245
246 # Softwarecenter agent.
247- sca = ConfigSection()
248- sca.sca_host_url = StringConfigOption(
249- default='https://software-center.ubuntu.com/')
250- sca.sca_apps_cache_timeout = IntConfigOption(default=3600)
251+ class sca(schema.Section):
252+ sca_host_url = schema.StringOption(
253+ default='https://software-center.ubuntu.com/')
254+ sca_apps_cache_timeout = schema.IntOption(default=3600)
255
256 # preflight
257- preflight = ConfigSection()
258- preflight.preflight_base_template = StringConfigOption(
259- default="light/index.1col.html")
260- preflight.preflight_table_class = StringConfigOption(default="listing")
261+ class preflight(schema.Section):
262+ preflight_base_template = schema.StringOption(
263+ default="light/index.1col.html")
264+ preflight_table_class = schema.StringOption(default="listing")
265
266=== modified file 'src/reviewsapp/tests/test_middleware.py'
267--- src/reviewsapp/tests/test_middleware.py 2012-03-21 22:05:09 +0000
268+++ src/reviewsapp/tests/test_middleware.py 2012-03-26 21:47:20 +0000
269@@ -35,6 +35,7 @@
270 from django.test import TestCase
271 from mock import patch, MagicMock, Mock
272
273+import reviewsapp.urls
274 from reviewsapp.middleware.stats import StatisticsLoggingMiddleware
275 from reviewsapp.middleware.exception import (
276 LogExceptionMiddleware,
277@@ -306,6 +307,8 @@
278 # soft_request_timeout is an IntConfigOption, but a float works too
279 with patch_settings(ENABLE_ARTIFICIAL_OOPS=True,
280 SOFT_REQUEST_TIMEOUT=0.1):
281+ reload(reviewsapp.urls)
282 response = self.client.get('/reviews/delay/0.1/')
283
284+ reload(reviewsapp.urls)
285 self.assertTrue('dump-oops' in environ)
286
287=== modified file 'src/reviewsapp/tests/test_pep8.py'
288--- src/reviewsapp/tests/test_pep8.py 2012-01-26 14:10:00 +0000
289+++ src/reviewsapp/tests/test_pep8.py 2012-03-26 21:47:20 +0000
290@@ -56,6 +56,7 @@
291 show_pep8 = False
292 select = []
293 ignore = []
294+ max_line_length = 79
295 pep8.options = Options()
296 pep8.message = self.message
297 Options.physical_checks = pep8.find_checks('physical_line')

Subscribers

People subscribed via source and target branches