Show More
@@ -69,7 +69,7 b' class TestAdminController(object):' | |||||
69 | with open(os.path.join(FIXTURES, 'journal_dump.csv')) as f: |
|
69 | with open(os.path.join(FIXTURES, 'journal_dump.csv')) as f: | |
70 | for row in csv.DictReader(f): |
|
70 | for row in csv.DictReader(f): | |
71 | ul = UserLog() |
|
71 | ul = UserLog() | |
72 |
for k, v in row. |
|
72 | for k, v in row.items(): | |
73 | v = safe_unicode(v) |
|
73 | v = safe_unicode(v) | |
74 | if k == 'action_date': |
|
74 | if k == 'action_date': | |
75 | v = strptime(v) |
|
75 | v = strptime(v) |
@@ -236,7 +236,7 b' class TestAdminSettingsGlobal(object):' | |||||
236 | assert_session_flash(response, 'Updated application settings') |
|
236 | assert_session_flash(response, 'Updated application settings') | |
237 | app_settings = SettingsModel().get_all_settings() |
|
237 | app_settings = SettingsModel().get_all_settings() | |
238 | del settings['csrf_token'] |
|
238 | del settings['csrf_token'] | |
239 |
for key, value in settings. |
|
239 | for key, value in settings.items(): | |
240 | assert app_settings[key] == value.decode('utf-8') |
|
240 | assert app_settings[key] == value.decode('utf-8') | |
241 |
|
241 | |||
242 | return response |
|
242 | return response |
@@ -75,7 +75,7 b' class AdminDefaultSettingsView(BaseAppVi' | |||||
75 |
|
75 | |||
76 | try: |
|
76 | try: | |
77 | form_result = form.to_python(dict(self.request.POST)) |
|
77 | form_result = form.to_python(dict(self.request.POST)) | |
78 |
for k, v in form_result. |
|
78 | for k, v in form_result.items(): | |
79 | setting = SettingsModel().create_or_update_setting(k, v) |
|
79 | setting = SettingsModel().create_or_update_setting(k, v) | |
80 | Session().add(setting) |
|
80 | Session().add(setting) | |
81 | Session().commit() |
|
81 | Session().commit() |
@@ -128,7 +128,7 b' class RepoSummaryView(RepoAppView):' | |||||
128 |
|
128 | |||
129 | # Sort first by decreasing count and second by the file extension, |
|
129 | # Sort first by decreasing count and second by the file extension, | |
130 | # so we have a consistent output. |
|
130 | # so we have a consistent output. | |
131 |
lang_stats_items = sorted(lang_stats_d. |
|
131 | lang_stats_items = sorted(lang_stats_d.items(), | |
132 | key=lambda k: (-k[1], k[0]))[:10] |
|
132 | key=lambda k: (-k[1], k[0]))[:10] | |
133 | lang_stats = [(x, {"count": y, |
|
133 | lang_stats = [(x, {"count": y, | |
134 | "desc": LANGUAGES_EXTENSIONS_MAP.get(x)}) |
|
134 | "desc": LANGUAGES_EXTENSIONS_MAP.get(x)}) | |
@@ -267,7 +267,7 b' class RepoSummaryView(RepoAppView):' | |||||
267 | def _create_reference_items(self, repo, full_repo_name, refs, ref_type, format_ref_id): |
|
267 | def _create_reference_items(self, repo, full_repo_name, refs, ref_type, format_ref_id): | |
268 | result = [] |
|
268 | result = [] | |
269 | is_svn = h.is_svn(repo) |
|
269 | is_svn = h.is_svn(repo) | |
270 |
for ref_name, raw_id in refs. |
|
270 | for ref_name, raw_id in refs.items(): | |
271 | files_url = self._create_files_url( |
|
271 | files_url = self._create_files_url( | |
272 | repo, full_repo_name, ref_name, raw_id, is_svn) |
|
272 | repo, full_repo_name, ref_name, raw_id, is_svn) | |
273 | result.append({ |
|
273 | result.append({ |
@@ -1112,7 +1112,7 b' class AuthUser(object):' | |||||
1112 | k: v for k, v in perms['user_groups'].items() |
|
1112 | k: v for k, v in perms['user_groups'].items() | |
1113 | if v != 'usergroup.none'} |
|
1113 | if v != 'usergroup.none'} | |
1114 | perms['repository_branches'] = { |
|
1114 | perms['repository_branches'] = { | |
1115 |
k: v for k, v in perms['repository_branches']. |
|
1115 | k: v for k, v in perms['repository_branches'].items() | |
1116 | if v != 'branch.none'} |
|
1116 | if v != 'branch.none'} | |
1117 | return perms |
|
1117 | return perms | |
1118 |
|
1118 |
@@ -192,7 +192,7 b' class ModelGenerator(object):' | |||||
192 | downgradeCommands.append( |
|
192 | downgradeCommands.append( | |
193 | "post_meta.tables[%(table)r].drop()" % {'table': tn}) |
|
193 | "post_meta.tables[%(table)r].drop()" % {'table': tn}) | |
194 |
|
194 | |||
195 |
for (tn, td) in self.diff.tables_different. |
|
195 | for (tn, td) in self.diff.tables_different.items(): | |
196 | if td.columns_missing_from_A or td.columns_different: |
|
196 | if td.columns_missing_from_A or td.columns_different: | |
197 | pre_table = self.diff.metadataB.tables[tn] |
|
197 | pre_table = self.diff.metadataB.tables[tn] | |
198 | decls.extend(self._getTableDefn( |
|
198 | decls.extend(self._getTableDefn( |
@@ -23,7 +23,7 b' alias = {' | |||||
23 |
|
23 | |||
24 | def alias_setup(): |
|
24 | def alias_setup(): | |
25 | global alias |
|
25 | global alias | |
26 |
for key, val in alias. |
|
26 | for key, val in alias.items(): | |
27 | setattr(api, key, val) |
|
27 | setattr(api, key, val) | |
28 | alias_setup() |
|
28 | alias_setup() | |
29 |
|
29 | |||
@@ -135,7 +135,7 b' def main(argv=None, **kwargs):' | |||||
135 | override_kwargs[opt] = value |
|
135 | override_kwargs[opt] = value | |
136 |
|
136 | |||
137 | # override kwargs with options if user is overwriting |
|
137 | # override kwargs with options if user is overwriting | |
138 |
for key, value in options.__dict__. |
|
138 | for key, value in options.__dict__.items(): | |
139 | if value is not None: |
|
139 | if value is not None: | |
140 | override_kwargs[key] = value |
|
140 | override_kwargs[key] = value | |
141 |
|
141 | |||
@@ -143,7 +143,7 b' def main(argv=None, **kwargs):' | |||||
143 | f_required = list(f_args) |
|
143 | f_required = list(f_args) | |
144 | candidates = dict(kwargs) |
|
144 | candidates = dict(kwargs) | |
145 | candidates.update(override_kwargs) |
|
145 | candidates.update(override_kwargs) | |
146 |
for key, value in candidates. |
|
146 | for key, value in candidates.items(): | |
147 | if key in f_args: |
|
147 | if key in f_args: | |
148 | f_required.remove(key) |
|
148 | f_required.remove(key) | |
149 |
|
149 | |||
@@ -160,7 +160,7 b' def main(argv=None, **kwargs):' | |||||
160 | kwargs.update(override_kwargs) |
|
160 | kwargs.update(override_kwargs) | |
161 |
|
161 | |||
162 | # configure options |
|
162 | # configure options | |
163 |
for key, value in options.__dict__. |
|
163 | for key, value in options.__dict__.items(): | |
164 | kwargs.setdefault(key, value) |
|
164 | kwargs.setdefault(key, value) | |
165 |
|
165 | |||
166 | # configure logging |
|
166 | # configure logging |
@@ -131,7 +131,7 b' def construct_engine(engine, **opts):' | |||||
131 | kwargs['echo'] = echo |
|
131 | kwargs['echo'] = echo | |
132 |
|
132 | |||
133 | # parse keyword arguments |
|
133 | # parse keyword arguments | |
134 |
for key, value in opts. |
|
134 | for key, value in opts.items(): | |
135 | if key.startswith('engine_arg_'): |
|
135 | if key.startswith('engine_arg_'): | |
136 | kwargs[key[11:]] = guess_obj_type(value) |
|
136 | kwargs[key[11:]] = guess_obj_type(value) | |
137 |
|
137 |
@@ -103,7 +103,7 b' class BaseModel(object):' | |||||
103 | d[k] = getattr(self, k) |
|
103 | d[k] = getattr(self, k) | |
104 |
|
104 | |||
105 | # also use __json__() if present to get additional fields |
|
105 | # also use __json__() if present to get additional fields | |
106 |
for k, val in getattr(self, '__json__', lambda: {})(). |
|
106 | for k, val in getattr(self, '__json__', lambda: {})().items(): | |
107 | d[k] = val |
|
107 | d[k] = val | |
108 | return d |
|
108 | return d | |
109 |
|
109 |
@@ -82,7 +82,7 b' class BaseModel(object):' | |||||
82 | # update with attributes from __json__ |
|
82 | # update with attributes from __json__ | |
83 | if callable(_json_attr): |
|
83 | if callable(_json_attr): | |
84 | _json_attr = _json_attr() |
|
84 | _json_attr = _json_attr() | |
85 |
for k, val in _json_attr. |
|
85 | for k, val in _json_attr.items(): | |
86 | d[k] = val |
|
86 | d[k] = val | |
87 | return d |
|
87 | return d | |
88 |
|
88 |
@@ -83,7 +83,7 b' class BaseModel(object):' | |||||
83 | # update with attributes from __json__ |
|
83 | # update with attributes from __json__ | |
84 | if callable(_json_attr): |
|
84 | if callable(_json_attr): | |
85 | _json_attr = _json_attr() |
|
85 | _json_attr = _json_attr() | |
86 |
for k, val in _json_attr. |
|
86 | for k, val in _json_attr.items(): | |
87 | d[k] = val |
|
87 | d[k] = val | |
88 | return d |
|
88 | return d | |
89 |
|
89 |
@@ -83,7 +83,7 b' class BaseModel(object):' | |||||
83 | # update with attributes from __json__ |
|
83 | # update with attributes from __json__ | |
84 | if callable(_json_attr): |
|
84 | if callable(_json_attr): | |
85 | _json_attr = _json_attr() |
|
85 | _json_attr = _json_attr() | |
86 |
for k, val in _json_attr. |
|
86 | for k, val in _json_attr.items(): | |
87 | d[k] = val |
|
87 | d[k] = val | |
88 | return d |
|
88 | return d | |
89 |
|
89 |
@@ -83,7 +83,7 b' class BaseModel(object):' | |||||
83 | # update with attributes from __json__ |
|
83 | # update with attributes from __json__ | |
84 | if callable(_json_attr): |
|
84 | if callable(_json_attr): | |
85 | _json_attr = _json_attr() |
|
85 | _json_attr = _json_attr() | |
86 |
for k, val in _json_attr. |
|
86 | for k, val in _json_attr.items(): | |
87 | d[k] = val |
|
87 | d[k] = val | |
88 | return d |
|
88 | return d | |
89 |
|
89 |
@@ -83,7 +83,7 b' class BaseModel(object):' | |||||
83 | # update with attributes from __json__ |
|
83 | # update with attributes from __json__ | |
84 | if callable(_json_attr): |
|
84 | if callable(_json_attr): | |
85 | _json_attr = _json_attr() |
|
85 | _json_attr = _json_attr() | |
86 |
for k, val in _json_attr. |
|
86 | for k, val in _json_attr.items(): | |
87 | d[k] = val |
|
87 | d[k] = val | |
88 | return d |
|
88 | return d | |
89 |
|
89 |
@@ -83,7 +83,7 b' class BaseModel(object):' | |||||
83 | # update with attributes from __json__ |
|
83 | # update with attributes from __json__ | |
84 | if callable(_json_attr): |
|
84 | if callable(_json_attr): | |
85 | _json_attr = _json_attr() |
|
85 | _json_attr = _json_attr() | |
86 |
for k, val in _json_attr. |
|
86 | for k, val in _json_attr.items(): | |
87 | d[k] = val |
|
87 | d[k] = val | |
88 | return d |
|
88 | return d | |
89 |
|
89 |
@@ -84,7 +84,7 b' class BaseModel(object):' | |||||
84 | # update with attributes from __json__ |
|
84 | # update with attributes from __json__ | |
85 | if callable(_json_attr): |
|
85 | if callable(_json_attr): | |
86 | _json_attr = _json_attr() |
|
86 | _json_attr = _json_attr() | |
87 |
for k, val in _json_attr. |
|
87 | for k, val in _json_attr.items(): | |
88 | d[k] = val |
|
88 | d[k] = val | |
89 | return d |
|
89 | return d | |
90 |
|
90 |
@@ -84,7 +84,7 b' class BaseModel(object):' | |||||
84 | # update with attributes from __json__ |
|
84 | # update with attributes from __json__ | |
85 | if callable(_json_attr): |
|
85 | if callable(_json_attr): | |
86 | _json_attr = _json_attr() |
|
86 | _json_attr = _json_attr() | |
87 |
for k, val in _json_attr. |
|
87 | for k, val in _json_attr.items(): | |
88 | d[k] = val |
|
88 | d[k] = val | |
89 | return d |
|
89 | return d | |
90 |
|
90 |
@@ -84,7 +84,7 b' class BaseModel(object):' | |||||
84 | # update with attributes from __json__ |
|
84 | # update with attributes from __json__ | |
85 | if callable(_json_attr): |
|
85 | if callable(_json_attr): | |
86 | _json_attr = _json_attr() |
|
86 | _json_attr = _json_attr() | |
87 |
for k, val in _json_attr. |
|
87 | for k, val in _json_attr.items(): | |
88 | d[k] = val |
|
88 | d[k] = val | |
89 | return d |
|
89 | return d | |
90 |
|
90 |
@@ -84,7 +84,7 b' class BaseModel(object):' | |||||
84 | # update with attributes from __json__ |
|
84 | # update with attributes from __json__ | |
85 | if callable(_json_attr): |
|
85 | if callable(_json_attr): | |
86 | _json_attr = _json_attr() |
|
86 | _json_attr = _json_attr() | |
87 |
for k, val in _json_attr. |
|
87 | for k, val in _json_attr.items(): | |
88 | d[k] = val |
|
88 | d[k] = val | |
89 | return d |
|
89 | return d | |
90 |
|
90 |
@@ -85,7 +85,7 b' class BaseModel(object):' | |||||
85 | # update with attributes from __json__ |
|
85 | # update with attributes from __json__ | |
86 | if callable(_json_attr): |
|
86 | if callable(_json_attr): | |
87 | _json_attr = _json_attr() |
|
87 | _json_attr = _json_attr() | |
88 |
for k, val in _json_attr. |
|
88 | for k, val in _json_attr.items(): | |
89 | d[k] = val |
|
89 | d[k] = val | |
90 | return d |
|
90 | return d | |
91 |
|
91 |
@@ -85,7 +85,7 b' class BaseModel(object):' | |||||
85 | # update with attributes from __json__ |
|
85 | # update with attributes from __json__ | |
86 | if callable(_json_attr): |
|
86 | if callable(_json_attr): | |
87 | _json_attr = _json_attr() |
|
87 | _json_attr = _json_attr() | |
88 |
for k, val in _json_attr. |
|
88 | for k, val in _json_attr.items(): | |
89 | d[k] = val |
|
89 | d[k] = val | |
90 | return d |
|
90 | return d | |
91 |
|
91 |
@@ -85,7 +85,7 b' class BaseModel(object):' | |||||
85 | # update with attributes from __json__ |
|
85 | # update with attributes from __json__ | |
86 | if callable(_json_attr): |
|
86 | if callable(_json_attr): | |
87 | _json_attr = _json_attr() |
|
87 | _json_attr = _json_attr() | |
88 |
for k, val in _json_attr. |
|
88 | for k, val in _json_attr.items(): | |
89 | d[k] = val |
|
89 | d[k] = val | |
90 | return d |
|
90 | return d | |
91 |
|
91 |
@@ -85,7 +85,7 b' class BaseModel(object):' | |||||
85 | # update with attributes from __json__ |
|
85 | # update with attributes from __json__ | |
86 | if callable(_json_attr): |
|
86 | if callable(_json_attr): | |
87 | _json_attr = _json_attr() |
|
87 | _json_attr = _json_attr() | |
88 |
for k, val in _json_attr. |
|
88 | for k, val in _json_attr.items(): | |
89 | d[k] = val |
|
89 | d[k] = val | |
90 | return d |
|
90 | return d | |
91 |
|
91 |
@@ -88,7 +88,7 b' class BaseModel(object):' | |||||
88 | # update with attributes from __json__ |
|
88 | # update with attributes from __json__ | |
89 | if callable(_json_attr): |
|
89 | if callable(_json_attr): | |
90 | _json_attr = _json_attr() |
|
90 | _json_attr = _json_attr() | |
91 |
for k, val in _json_attr. |
|
91 | for k, val in _json_attr.items(): | |
92 | d[k] = val |
|
92 | d[k] = val | |
93 | return d |
|
93 | return d | |
94 |
|
94 |
@@ -90,7 +90,7 b' class BaseModel(object):' | |||||
90 | # update with attributes from __json__ |
|
90 | # update with attributes from __json__ | |
91 | if callable(_json_attr): |
|
91 | if callable(_json_attr): | |
92 | _json_attr = _json_attr() |
|
92 | _json_attr = _json_attr() | |
93 |
for k, val in _json_attr. |
|
93 | for k, val in _json_attr.items(): | |
94 | d[k] = val |
|
94 | d[k] = val | |
95 | return d |
|
95 | return d | |
96 |
|
96 |
@@ -134,7 +134,7 b' class BaseModel(object):' | |||||
134 | # update with attributes from __json__ |
|
134 | # update with attributes from __json__ | |
135 | if callable(_json_attr): |
|
135 | if callable(_json_attr): | |
136 | _json_attr = _json_attr() |
|
136 | _json_attr = _json_attr() | |
137 |
for k, val in _json_attr. |
|
137 | for k, val in _json_attr.items(): | |
138 | d[k] = val |
|
138 | d[k] = val | |
139 | return d |
|
139 | return d | |
140 |
|
140 |
@@ -134,7 +134,7 b' class BaseModel(object):' | |||||
134 | # update with attributes from __json__ |
|
134 | # update with attributes from __json__ | |
135 | if callable(_json_attr): |
|
135 | if callable(_json_attr): | |
136 | _json_attr = _json_attr() |
|
136 | _json_attr = _json_attr() | |
137 |
for k, val in _json_attr. |
|
137 | for k, val in _json_attr.items(): | |
138 | d[k] = val |
|
138 | d[k] = val | |
139 | return d |
|
139 | return d | |
140 |
|
140 |
@@ -135,7 +135,7 b' class BaseModel(object):' | |||||
135 | # update with attributes from __json__ |
|
135 | # update with attributes from __json__ | |
136 | if callable(_json_attr): |
|
136 | if callable(_json_attr): | |
137 | _json_attr = _json_attr() |
|
137 | _json_attr = _json_attr() | |
138 |
for k, val in _json_attr. |
|
138 | for k, val in _json_attr.items(): | |
139 | d[k] = val |
|
139 | d[k] = val | |
140 | return d |
|
140 | return d | |
141 |
|
141 |
@@ -135,7 +135,7 b' class BaseModel(object):' | |||||
135 | # update with attributes from __json__ |
|
135 | # update with attributes from __json__ | |
136 | if callable(_json_attr): |
|
136 | if callable(_json_attr): | |
137 | _json_attr = _json_attr() |
|
137 | _json_attr = _json_attr() | |
138 |
for k, val in _json_attr. |
|
138 | for k, val in _json_attr.items(): | |
139 | d[k] = val |
|
139 | d[k] = val | |
140 | return d |
|
140 | return d | |
141 |
|
141 |
@@ -136,7 +136,7 b' class BaseModel(object):' | |||||
136 | # update with attributes from __json__ |
|
136 | # update with attributes from __json__ | |
137 | if callable(_json_attr): |
|
137 | if callable(_json_attr): | |
138 | _json_attr = _json_attr() |
|
138 | _json_attr = _json_attr() | |
139 |
for k, val in _json_attr. |
|
139 | for k, val in _json_attr.items(): | |
140 | d[k] = val |
|
140 | d[k] = val | |
141 | return d |
|
141 | return d | |
142 |
|
142 |
@@ -136,7 +136,7 b' class BaseModel(object):' | |||||
136 | # update with attributes from __json__ |
|
136 | # update with attributes from __json__ | |
137 | if callable(_json_attr): |
|
137 | if callable(_json_attr): | |
138 | _json_attr = _json_attr() |
|
138 | _json_attr = _json_attr() | |
139 |
for k, val in _json_attr. |
|
139 | for k, val in _json_attr.items(): | |
140 | d[k] = val |
|
140 | d[k] = val | |
141 | return d |
|
141 | return d | |
142 |
|
142 |
@@ -158,7 +158,7 b' class BaseModel(object):' | |||||
158 | # update with attributes from __json__ |
|
158 | # update with attributes from __json__ | |
159 | if callable(_json_attr): |
|
159 | if callable(_json_attr): | |
160 | _json_attr = _json_attr() |
|
160 | _json_attr = _json_attr() | |
161 |
for k, val in _json_attr. |
|
161 | for k, val in _json_attr.items(): | |
162 | d[k] = val |
|
162 | d[k] = val | |
163 | return d |
|
163 | return d | |
164 |
|
164 |
@@ -216,7 +216,7 b' class BaseModel(object):' | |||||
216 | # update with attributes from __json__ |
|
216 | # update with attributes from __json__ | |
217 | if callable(_json_attr): |
|
217 | if callable(_json_attr): | |
218 | _json_attr = _json_attr() |
|
218 | _json_attr = _json_attr() | |
219 |
for k, val in _json_attr. |
|
219 | for k, val in _json_attr.items(): | |
220 | d[k] = val |
|
220 | d[k] = val | |
221 | return d |
|
221 | return d | |
222 |
|
222 |
@@ -216,7 +216,7 b' class BaseModel(object):' | |||||
216 | # update with attributes from __json__ |
|
216 | # update with attributes from __json__ | |
217 | if callable(_json_attr): |
|
217 | if callable(_json_attr): | |
218 | _json_attr = _json_attr() |
|
218 | _json_attr = _json_attr() | |
219 |
for k, val in _json_attr. |
|
219 | for k, val in _json_attr.items(): | |
220 | d[k] = val |
|
220 | d[k] = val | |
221 | return d |
|
221 | return d | |
222 |
|
222 |
@@ -223,7 +223,7 b' class BaseModel(object):' | |||||
223 | # update with attributes from __json__ |
|
223 | # update with attributes from __json__ | |
224 | if callable(_json_attr): |
|
224 | if callable(_json_attr): | |
225 | _json_attr = _json_attr() |
|
225 | _json_attr = _json_attr() | |
226 |
for k, val in _json_attr. |
|
226 | for k, val in _json_attr.items(): | |
227 | d[k] = val |
|
227 | d[k] = val | |
228 | return d |
|
228 | return d | |
229 |
|
229 |
@@ -223,7 +223,7 b' class BaseModel(object):' | |||||
223 | # update with attributes from __json__ |
|
223 | # update with attributes from __json__ | |
224 | if callable(_json_attr): |
|
224 | if callable(_json_attr): | |
225 | _json_attr = _json_attr() |
|
225 | _json_attr = _json_attr() | |
226 |
for k, val in _json_attr. |
|
226 | for k, val in _json_attr.items(): | |
227 | d[k] = val |
|
227 | d[k] = val | |
228 | return d |
|
228 | return d | |
229 |
|
229 |
@@ -223,7 +223,7 b' class BaseModel(object):' | |||||
223 | # update with attributes from __json__ |
|
223 | # update with attributes from __json__ | |
224 | if callable(_json_attr): |
|
224 | if callable(_json_attr): | |
225 | _json_attr = _json_attr() |
|
225 | _json_attr = _json_attr() | |
226 |
for k, val in _json_attr. |
|
226 | for k, val in _json_attr.items(): | |
227 | d[k] = val |
|
227 | d[k] = val | |
228 | return d |
|
228 | return d | |
229 |
|
229 |
@@ -230,7 +230,7 b' class BaseModel(object):' | |||||
230 | # update with attributes from __json__ |
|
230 | # update with attributes from __json__ | |
231 | if callable(_json_attr): |
|
231 | if callable(_json_attr): | |
232 | _json_attr = _json_attr() |
|
232 | _json_attr = _json_attr() | |
233 |
for k, val in _json_attr. |
|
233 | for k, val in _json_attr.items(): | |
234 | d[k] = val |
|
234 | d[k] = val | |
235 | return d |
|
235 | return d | |
236 |
|
236 |
@@ -230,7 +230,7 b' class BaseModel(object):' | |||||
230 | # update with attributes from __json__ |
|
230 | # update with attributes from __json__ | |
231 | if callable(_json_attr): |
|
231 | if callable(_json_attr): | |
232 | _json_attr = _json_attr() |
|
232 | _json_attr = _json_attr() | |
233 |
for k, val in _json_attr. |
|
233 | for k, val in _json_attr.items(): | |
234 | d[k] = val |
|
234 | d[k] = val | |
235 | return d |
|
235 | return d | |
236 |
|
236 |
@@ -230,7 +230,7 b' class BaseModel(object):' | |||||
230 | # update with attributes from __json__ |
|
230 | # update with attributes from __json__ | |
231 | if callable(_json_attr): |
|
231 | if callable(_json_attr): | |
232 | _json_attr = _json_attr() |
|
232 | _json_attr = _json_attr() | |
233 |
for k, val in _json_attr. |
|
233 | for k, val in _json_attr.items(): | |
234 | d[k] = val |
|
234 | d[k] = val | |
235 | return d |
|
235 | return d | |
236 |
|
236 |
@@ -235,7 +235,7 b' class BaseModel(object):' | |||||
235 | # update with attributes from __json__ |
|
235 | # update with attributes from __json__ | |
236 | if callable(_json_attr): |
|
236 | if callable(_json_attr): | |
237 | _json_attr = _json_attr() |
|
237 | _json_attr = _json_attr() | |
238 |
for k, val in _json_attr. |
|
238 | for k, val in _json_attr.items(): | |
239 | d[k] = val |
|
239 | d[k] = val | |
240 | return d |
|
240 | return d | |
241 |
|
241 |
@@ -179,7 +179,7 b' class BaseModel(object):' | |||||
179 | # update with attributes from __json__ |
|
179 | # update with attributes from __json__ | |
180 | if callable(_json_attr): |
|
180 | if callable(_json_attr): | |
181 | _json_attr = _json_attr() |
|
181 | _json_attr = _json_attr() | |
182 |
for k, val in _json_attr. |
|
182 | for k, val in _json_attr.items(): | |
183 | d[k] = val |
|
183 | d[k] = val | |
184 | return d |
|
184 | return d | |
185 |
|
185 |
@@ -180,7 +180,7 b' class BaseModel(object):' | |||||
180 | # update with attributes from __json__ |
|
180 | # update with attributes from __json__ | |
181 | if callable(_json_attr): |
|
181 | if callable(_json_attr): | |
182 | _json_attr = _json_attr() |
|
182 | _json_attr = _json_attr() | |
183 |
for k, val in _json_attr. |
|
183 | for k, val in _json_attr.items(): | |
184 | d[k] = val |
|
184 | d[k] = val | |
185 | return d |
|
185 | return d | |
186 |
|
186 |
@@ -179,7 +179,7 b' class BaseModel(object):' | |||||
179 | # update with attributes from __json__ |
|
179 | # update with attributes from __json__ | |
180 | if callable(_json_attr): |
|
180 | if callable(_json_attr): | |
181 | _json_attr = _json_attr() |
|
181 | _json_attr = _json_attr() | |
182 |
for k, val in _json_attr. |
|
182 | for k, val in _json_attr.items(): | |
183 | d[k] = val |
|
183 | d[k] = val | |
184 | return d |
|
184 | return d | |
185 |
|
185 |
@@ -181,7 +181,7 b' class BaseModel(object):' | |||||
181 | # update with attributes from __json__ |
|
181 | # update with attributes from __json__ | |
182 | if callable(_json_attr): |
|
182 | if callable(_json_attr): | |
183 | _json_attr = _json_attr() |
|
183 | _json_attr = _json_attr() | |
184 |
for k, val in _json_attr. |
|
184 | for k, val in _json_attr.items(): | |
185 | d[k] = val |
|
185 | d[k] = val | |
186 | return d |
|
186 | return d | |
187 |
|
187 |
@@ -181,7 +181,7 b' class BaseModel(object):' | |||||
181 | # update with attributes from __json__ |
|
181 | # update with attributes from __json__ | |
182 | if callable(_json_attr): |
|
182 | if callable(_json_attr): | |
183 | _json_attr = _json_attr() |
|
183 | _json_attr = _json_attr() | |
184 |
for k, val in _json_attr. |
|
184 | for k, val in _json_attr.items(): | |
185 | d[k] = val |
|
185 | d[k] = val | |
186 | return d |
|
186 | return d | |
187 |
|
187 |
@@ -177,7 +177,7 b' class BaseModel(object):' | |||||
177 | # update with attributes from __json__ |
|
177 | # update with attributes from __json__ | |
178 | if callable(_json_attr): |
|
178 | if callable(_json_attr): | |
179 | _json_attr = _json_attr() |
|
179 | _json_attr = _json_attr() | |
180 |
for k, val in _json_attr. |
|
180 | for k, val in _json_attr.items(): | |
181 | d[k] = val |
|
181 | d[k] = val | |
182 | return d |
|
182 | return d | |
183 |
|
183 |
@@ -177,7 +177,7 b' class BaseModel(object):' | |||||
177 | # update with attributes from __json__ |
|
177 | # update with attributes from __json__ | |
178 | if callable(_json_attr): |
|
178 | if callable(_json_attr): | |
179 | _json_attr = _json_attr() |
|
179 | _json_attr = _json_attr() | |
180 |
for k, val in _json_attr. |
|
180 | for k, val in _json_attr.items(): | |
181 | d[k] = val |
|
181 | d[k] = val | |
182 | return d |
|
182 | return d | |
183 |
|
183 |
@@ -175,7 +175,7 b' class BaseModel(object):' | |||||
175 | # update with attributes from __json__ |
|
175 | # update with attributes from __json__ | |
176 | if callable(_json_attr): |
|
176 | if callable(_json_attr): | |
177 | _json_attr = _json_attr() |
|
177 | _json_attr = _json_attr() | |
178 |
for k, val in _json_attr. |
|
178 | for k, val in _json_attr.items(): | |
179 | d[k] = val |
|
179 | d[k] = val | |
180 | return d |
|
180 | return d | |
181 |
|
181 |
@@ -446,7 +446,7 b' class MarkupRenderer(object):' | |||||
446 | 'syntax_highlight': 'short', |
|
446 | 'syntax_highlight': 'short', | |
447 | }) |
|
447 | }) | |
448 |
|
448 | |||
449 |
for k, v in docutils_settings. |
|
449 | for k, v in docutils_settings.items(): | |
450 | directives.register_directive(k, v) |
|
450 | directives.register_directive(k, v) | |
451 |
|
451 | |||
452 | parts = publish_parts(source=source, |
|
452 | parts = publish_parts(source=source, |
@@ -40,7 +40,7 b' def _get_clean_environ(environ):' | |||||
40 | :rtype: dict |
|
40 | :rtype: dict | |
41 | """ |
|
41 | """ | |
42 | clean_environ = dict( |
|
42 | clean_environ = dict( | |
43 |
(k, v) for k, v in environ. |
|
43 | (k, v) for k, v in environ.items() | |
44 | if type(v) == str and type(k) == str and not k.startswith('wsgi.') |
|
44 | if type(v) == str and type(k) == str and not k.startswith('wsgi.') | |
45 | ) |
|
45 | ) | |
46 |
|
46 |
@@ -1802,7 +1802,7 b' class Config(object):' | |||||
1802 | len(self._values), hex(id(self))) |
|
1802 | len(self._values), hex(id(self))) | |
1803 |
|
1803 | |||
1804 | def items(self, section): |
|
1804 | def items(self, section): | |
1805 |
return self._values.get(section, {}). |
|
1805 | return self._values.get(section, {}).items() | |
1806 |
|
1806 | |||
1807 | def get(self, section, option): |
|
1807 | def get(self, section, option): | |
1808 | return self._values.get(section, {}).get(option) |
|
1808 | return self._values.get(section, {}).get(option) |
@@ -144,14 +144,14 b' class GitCommit(base.BaseCommit):' | |||||
144 | @LazyProperty |
|
144 | @LazyProperty | |
145 | def tags(self): |
|
145 | def tags(self): | |
146 | tags = [safe_unicode(name) for name, |
|
146 | tags = [safe_unicode(name) for name, | |
147 |
commit_id in self.repository.tags. |
|
147 | commit_id in self.repository.tags.items() | |
148 | if commit_id == self.raw_id] |
|
148 | if commit_id == self.raw_id] | |
149 | return tags |
|
149 | return tags | |
150 |
|
150 | |||
151 | @LazyProperty |
|
151 | @LazyProperty | |
152 | def commit_branches(self): |
|
152 | def commit_branches(self): | |
153 | branches = [] |
|
153 | branches = [] | |
154 |
for name, commit_id in self.repository.branches. |
|
154 | for name, commit_id in self.repository.branches.items(): | |
155 | if commit_id == self.raw_id: |
|
155 | if commit_id == self.raw_id: | |
156 | branches.append(name) |
|
156 | branches.append(name) | |
157 | return branches |
|
157 | return branches |
@@ -317,7 +317,7 b' class GitRepository(BaseRepository):' | |||||
317 | return OrderedDict() |
|
317 | return OrderedDict() | |
318 |
|
318 | |||
319 | result = [] |
|
319 | result = [] | |
320 |
for ref, sha in self._refs. |
|
320 | for ref, sha in self._refs.items(): | |
321 | if ref.startswith(prefix): |
|
321 | if ref.startswith(prefix): | |
322 | ref_name = ref |
|
322 | ref_name = ref | |
323 | if strip_prefix: |
|
323 | if strip_prefix: | |
@@ -412,7 +412,7 b' class GitRepository(BaseRepository):' | |||||
412 | @property |
|
412 | @property | |
413 | def _ref_tree(self): |
|
413 | def _ref_tree(self): | |
414 | node = tree = {} |
|
414 | node = tree = {} | |
415 |
for ref, sha in self._refs. |
|
415 | for ref, sha in self._refs.items(): | |
416 | path = ref.split('/') |
|
416 | path = ref.split('/') | |
417 | for bit in path[:-1]: |
|
417 | for bit in path[:-1]: | |
418 | node = node.setdefault(bit, {}) |
|
418 | node = node.setdefault(bit, {}) |
@@ -87,7 +87,7 b' class MercurialCommit(base.BaseCommit):' | |||||
87 |
|
87 | |||
88 | @LazyProperty |
|
88 | @LazyProperty | |
89 | def tags(self): |
|
89 | def tags(self): | |
90 |
tags = [name for name, commit_id in self.repository.tags. |
|
90 | tags = [name for name, commit_id in self.repository.tags.items() | |
91 | if commit_id == self.raw_id] |
|
91 | if commit_id == self.raw_id] | |
92 | return tags |
|
92 | return tags | |
93 |
|
93 | |||
@@ -98,7 +98,7 b' class MercurialCommit(base.BaseCommit):' | |||||
98 | @LazyProperty |
|
98 | @LazyProperty | |
99 | def bookmarks(self): |
|
99 | def bookmarks(self): | |
100 | bookmarks = [ |
|
100 | bookmarks = [ | |
101 |
name for name, commit_id in self.repository.bookmarks. |
|
101 | name for name, commit_id in self.repository.bookmarks.items() | |
102 | if commit_id == self.raw_id] |
|
102 | if commit_id == self.raw_id] | |
103 | return bookmarks |
|
103 | return bookmarks | |
104 |
|
104 | |||
@@ -302,7 +302,7 b' class MercurialCommit(base.BaseCommit):' | |||||
302 | if os.path.dirname(d) == path] |
|
302 | if os.path.dirname(d) == path] | |
303 |
|
303 | |||
304 | alias = self.repository.alias |
|
304 | alias = self.repository.alias | |
305 |
for k, vals in self._submodules. |
|
305 | for k, vals in self._submodules.items(): | |
306 | if vcspath.dirname(k) == path: |
|
306 | if vcspath.dirname(k) == path: | |
307 | loc = vals[0] |
|
307 | loc = vals[0] | |
308 | commit = vals[1] |
|
308 | commit = vals[1] |
@@ -659,8 +659,8 b' class CommentsModel(BaseModel):' | |||||
659 | def get_inline_comments_as_list(self, inline_comments, skip_outdated=True, |
|
659 | def get_inline_comments_as_list(self, inline_comments, skip_outdated=True, | |
660 | version=None): |
|
660 | version=None): | |
661 | inline_comms = [] |
|
661 | inline_comms = [] | |
662 |
for fname, per_line_comments in inline_comments. |
|
662 | for fname, per_line_comments in inline_comments.items(): | |
663 |
for lno, comments in per_line_comments. |
|
663 | for lno, comments in per_line_comments.items(): | |
664 | for comm in comments: |
|
664 | for comm in comments: | |
665 | if not comm.outdated_at_version(version) and skip_outdated: |
|
665 | if not comm.outdated_at_version(version) and skip_outdated: | |
666 | inline_comms.append(comm) |
|
666 | inline_comms.append(comm) |
@@ -236,7 +236,7 b' class BaseModel(object):' | |||||
236 | # update with attributes from __json__ |
|
236 | # update with attributes from __json__ | |
237 | if callable(_json_attr): |
|
237 | if callable(_json_attr): | |
238 | _json_attr = _json_attr() |
|
238 | _json_attr = _json_attr() | |
239 |
for k, val in _json_attr. |
|
239 | for k, val in _json_attr.items(): | |
240 | d[k] = val |
|
240 | d[k] = val | |
241 | return d |
|
241 | return d | |
242 |
|
242 |
@@ -749,7 +749,7 b" def ValidPerms(localizer, type_='repo'):" | |||||
749 | # them by they IDs |
|
749 | # them by they IDs | |
750 | new_perms_group = collections.defaultdict(dict) |
|
750 | new_perms_group = collections.defaultdict(dict) | |
751 | del_perms_group = collections.defaultdict(dict) |
|
751 | del_perms_group = collections.defaultdict(dict) | |
752 |
for k, v in value.copy(). |
|
752 | for k, v in value.copy().items(): | |
753 | if k.startswith('perm_del_member'): |
|
753 | if k.startswith('perm_del_member'): | |
754 | # delete from org storage so we don't process that later |
|
754 | # delete from org storage so we don't process that later | |
755 | del value[k] |
|
755 | del value[k] | |
@@ -792,7 +792,7 b" def ValidPerms(localizer, type_='repo'):" | |||||
792 | # (read the existing radio button states) |
|
792 | # (read the existing radio button states) | |
793 | default_user_id = User.get_default_user_id() |
|
793 | default_user_id = User.get_default_user_id() | |
794 |
|
794 | |||
795 |
for k, update_value in value. |
|
795 | for k, update_value in value.items(): | |
796 | if k.startswith('u_perm_') or k.startswith('g_perm_'): |
|
796 | if k.startswith('u_perm_') or k.startswith('g_perm_'): | |
797 | obj_type = k[0] |
|
797 | obj_type = k[0] | |
798 | obj_id = k[7:] |
|
798 | obj_id = k[7:] | |
@@ -1072,7 +1072,7 b' def ValidPattern(localizer):' | |||||
1072 | patterns = [] |
|
1072 | patterns = [] | |
1073 |
|
1073 | |||
1074 | prefix = 'new_pattern' |
|
1074 | prefix = 'new_pattern' | |
1075 |
for name, v in value. |
|
1075 | for name, v in value.items(): | |
1076 | pattern_name = '_'.join((prefix, 'pattern')) |
|
1076 | pattern_name = '_'.join((prefix, 'pattern')) | |
1077 | if name.startswith(pattern_name): |
|
1077 | if name.startswith(pattern_name): | |
1078 | new_item_id = name[len(pattern_name)+1:] |
|
1078 | new_item_id = name[len(pattern_name)+1:] |
@@ -12,7 +12,7 b'' | |||||
12 |
|
12 | |||
13 | <%def name="diff_block_changeset_table(change)"> |
|
13 | <%def name="diff_block_changeset_table(change)"> | |
14 | <div class="diff-container" id="${'diff-container-%s' % (id(change))}"> |
|
14 | <div class="diff-container" id="${'diff-container-%s' % (id(change))}"> | |
15 |
%for FID,(cs1, cs2, change, filenode_path, diff, stats, file_data) in change. |
|
15 | %for FID,(cs1, cs2, change, filenode_path, diff, stats, file_data) in change.items(): | |
16 | <div id="${h.FID('',filenode_path)}_target" ></div> |
|
16 | <div id="${h.FID('',filenode_path)}_target" ></div> | |
17 | <div id="${h.FID('',filenode_path)}" class="diffblock margined comm"> |
|
17 | <div id="${h.FID('',filenode_path)}" class="diffblock margined comm"> | |
18 | <div class="code-body"> |
|
18 | <div class="code-body"> |
@@ -43,7 +43,7 b' BASE_ENVIRON = {' | |||||
43 |
|
43 | |||
44 | def assert_all_values_are_str(environ): |
|
44 | def assert_all_values_are_str(environ): | |
45 | """Checks that all values of a dict are str.""" |
|
45 | """Checks that all values of a dict are str.""" | |
46 |
for key, value in environ. |
|
46 | for key, value in environ.items(): | |
47 | assert isinstance(value, str), ( |
|
47 | assert isinstance(value, str), ( | |
48 | "Value for key %s: has type %s but 'str' was expected. Value: %s" % |
|
48 | "Value for key %s: has type %s but 'str' was expected. Value: %s" % | |
49 | (key, type(value), repr(value))) |
|
49 | (key, type(value), repr(value))) | |
@@ -51,7 +51,7 b' def assert_all_values_are_str(environ):' | |||||
51 |
|
51 | |||
52 | def assert_all_keys_are_str(environ): |
|
52 | def assert_all_keys_are_str(environ): | |
53 | """Checks that all keys of a dict are str.""" |
|
53 | """Checks that all keys of a dict are str.""" | |
54 |
for key, value in environ. |
|
54 | for key, value in environ.items(): | |
55 | assert isinstance(value, str), ( |
|
55 | assert isinstance(value, str), ( | |
56 | "Key %s: has type %s but 'str' was expected. " % |
|
56 | "Key %s: has type %s but 'str' was expected. " % | |
57 | (repr(key), type(key))) |
|
57 | (repr(key), type(key))) |
@@ -181,11 +181,11 b' class TestCommitsInNonEmptyRepo(BackendT' | |||||
181 | assert idx == self.repo.get_commit(commit_idx=idx).idx |
|
181 | assert idx == self.repo.get_commit(commit_idx=idx).idx | |
182 |
|
182 | |||
183 | def test_get_commit_by_branch(self): |
|
183 | def test_get_commit_by_branch(self): | |
184 |
for branch, commit_id in self.repo.branches. |
|
184 | for branch, commit_id in self.repo.branches.items(): | |
185 | assert commit_id == self.repo.get_commit(branch).raw_id |
|
185 | assert commit_id == self.repo.get_commit(branch).raw_id | |
186 |
|
186 | |||
187 | def test_get_commit_by_tag(self): |
|
187 | def test_get_commit_by_tag(self): | |
188 |
for tag, commit_id in self.repo.tags. |
|
188 | for tag, commit_id in self.repo.tags.items(): | |
189 | assert commit_id == self.repo.get_commit(tag).raw_id |
|
189 | assert commit_id == self.repo.get_commit(tag).raw_id | |
190 |
|
190 | |||
191 | def test_get_commit_parents(self): |
|
191 | def test_get_commit_parents(self): |
General Comments 0
You need to be logged in to leave comments.
Login now