0004-misc-fix-super-with-arguments-pylint-error-62099.patch
passerelle/apps/arcgis/models.py | ||
---|---|---|
230 | 230 |
return query.q(request, q=None, full=full, **kwargs) |
231 | 231 | |
232 | 232 |
def export_json(self): |
233 |
d = super(ArcGIS, self).export_json()
|
|
233 |
d = super().export_json() |
|
234 | 234 |
d['queries'] = [query.export_json() for query in self.queries.all()] |
235 | 235 |
return d |
236 | 236 | |
... | ... | |
256 | 256 |
def format_field(self, value, format_spec): |
257 | 257 |
if format_spec and format_spec[-1].isalpha() and format_spec[-1] == 'd': |
258 | 258 |
value = int(value) |
259 |
formatted = super(SqlFormatter, self).format_field(value, format_spec)
|
|
259 |
formatted = super().format_field(value, format_spec) |
|
260 | 260 |
if not format_spec or not format_spec[-1].isalpha() or format_spec[-1] == 's': |
261 | 261 |
formatted = "'%s'" % formatted.replace("'", "''") |
262 | 262 |
return formatted |
... | ... | |
349 | 349 |
return self.resource.mapservice_query(request, q=q, full=full, **kwargs) |
350 | 350 | |
351 | 351 |
def as_endpoint(self): |
352 |
endpoint = super(Query, self).as_endpoint(path=self.resource.q.endpoint_info.name)
|
|
352 |
endpoint = super().as_endpoint(path=self.resource.q.endpoint_info.name) |
|
353 | 353 | |
354 | 354 |
mapservice_endpoint = self.resource.mapservice_query.endpoint_info |
355 | 355 |
endpoint.func = mapservice_endpoint.func |
passerelle/apps/arcgis/views.py | ||
---|---|---|
27 | 27 |
form_class = QueryForm |
28 | 28 | |
29 | 29 |
def get_form_kwargs(self): |
30 |
kwargs = super(QueryNew, self).get_form_kwargs()
|
|
30 |
kwargs = super().get_form_kwargs() |
|
31 | 31 |
kwargs['instance'] = self.model(resource=self.resource) |
32 | 32 |
return kwargs |
33 | 33 |
passerelle/apps/base_adresse/models.py | ||
---|---|---|
566 | 566 |
self.add_job('update_streets_data') |
567 | 567 | |
568 | 568 |
def hourly(self): |
569 |
super(BaseAdresse, self).hourly()
|
|
569 |
super().hourly() |
|
570 | 570 |
self.clean_addresses_cache() |
571 | 571 | |
572 | 572 |
def daily(self): |
573 |
super(BaseAdresse, self).daily()
|
|
573 |
super().daily() |
|
574 | 574 |
self.update_streets_data() |
575 | 575 |
self.update_api_geo_data() |
576 | 576 | |
... | ... | |
578 | 578 |
class UnaccentNameMixin(object): |
579 | 579 |
def save(self, *args, **kwargs): |
580 | 580 |
self.unaccent_name = simplify(self.name) |
581 |
super(UnaccentNameMixin, self).save(*args, **kwargs)
|
|
581 |
super().save(*args, **kwargs) |
|
582 | 582 | |
583 | 583 | |
584 | 584 |
@six.python_2_unicode_compatible |
passerelle/apps/cartads_cs/models.py | ||
---|---|---|
136 | 136 |
return self.wsdl_base_url + service_type + '.svc?singleWsdl' |
137 | 137 | |
138 | 138 |
def save(self, *args, **kwargs): |
139 |
super(AbstractCartaDSCS, self).save(*args, **kwargs)
|
|
139 |
super().save(*args, **kwargs) |
|
140 | 140 |
if CartaDSDataCache.objects.count() == 0: |
141 | 141 |
# don't wait for daily job to get initial data |
142 | 142 |
self.add_job('update_data_cache') |
143 | 143 | |
144 | 144 |
def soap_client(self, **kwargs): |
145 |
client = super(AbstractCartaDSCS, self).soap_client(**kwargs)
|
|
145 |
client = super().soap_client(**kwargs) |
|
146 | 146 |
# fix URL that should have been changed by reverse proxy |
147 | 147 |
parsed_wsdl_address = urlparse.urlparse(client.service._binding_options['address']) |
148 | 148 |
parsed_real_address = urlparse.urlparse(self.wsdl_base_url) |
... | ... | |
358 | 358 |
self.sync_subscribers_role(dossier) |
359 | 359 | |
360 | 360 |
def hourly(self): |
361 |
super(AbstractCartaDSCS, self).hourly()
|
|
361 |
super().hourly() |
|
362 | 362 |
self.update_dossier_cache() |
363 | 363 | |
364 | 364 |
def daily(self): |
365 |
super(AbstractCartaDSCS, self).daily()
|
|
365 |
super().daily() |
|
366 | 366 |
self.update_data_cache() |
367 | 367 | |
368 | 368 |
@endpoint(description=_('Get list of collectivities')) |
passerelle/apps/cityweb/cityweb.py | ||
---|---|---|
198 | 198 |
sequence = ('nomDeFamille', 'nomUsgae', 'typeUsage') |
199 | 199 | |
200 | 200 |
def __init__(self, data): |
201 |
super(Names, self).__init__(data)
|
|
201 |
super().__init__(data) |
|
202 | 202 |
if self.data.get('lastname'): |
203 | 203 |
self.nomDeFamille = self.data['lastname'] |
204 | 204 |
self.nomUsage = self.data.get('usual_name', '') |
... | ... | |
210 | 210 |
sequence = ('ville', 'province', 'pays') |
211 | 211 | |
212 | 212 |
def __init__(self, data): |
213 |
super(Place, self).__init__(data)
|
|
213 |
super().__init__(data) |
|
214 | 214 |
if self.data.get('city'): |
215 | 215 |
self.ville = self.data['city'] |
216 | 216 |
self.province = self.data.get('county', '') |
... | ... | |
223 | 223 |
pattern = 'address_' |
224 | 224 | |
225 | 225 |
def __init__(self, data): |
226 |
super(Address, self).__init__(data)
|
|
226 |
super().__init__(data) |
|
227 | 227 |
self.ligneAdr1 = self.data.get('street', '') |
228 | 228 |
self.ligneAdr2 = self.data.get('complement', '') |
229 | 229 |
self.codePostal = self.data.get('zipcode', '') |
... | ... | |
238 | 238 |
pattern = 'birth_' |
239 | 239 | |
240 | 240 |
def __init__(self, data): |
241 |
super(Birth, self).__init__(data)
|
|
241 |
super().__init__(data) |
|
242 | 242 |
birthdate = self.data.get('date', None) |
243 | 243 |
if birthdate: |
244 | 244 |
self.date = BirthDate(birthdate) |
... | ... | |
250 | 250 |
sequence = ('dateDebut', 'dateFin') |
251 | 251 | |
252 | 252 |
def __init__(self, data): |
253 |
super(EventDate, self).__init__(data)
|
|
253 |
super().__init__(data) |
|
254 | 254 |
self.dateDebut = StartDate(self.data['event_date_start']) |
255 | 255 |
if data.get('event_date_end', None): |
256 | 256 |
self.dateFin = EndDate(self.data['event_date_end']) |
... | ... | |
265 | 265 |
sequence = ('noms', 'prenoms', 'genre', 'adresse', 'sexe', 'pere', 'mere', 'naissance') |
266 | 266 | |
267 | 267 |
def __init__(self, data): |
268 |
super(Person, self).__init__(data)
|
|
268 |
super().__init__(data) |
|
269 | 269 |
self.noms = Names(self.data) |
270 | 270 |
self.prenoms = self.data.get('firstnames', '') |
271 | 271 |
if self.data.get('title', None): |
... | ... | |
287 | 287 | |
288 | 288 |
def __init__(self, data, pattern): |
289 | 289 |
self.pattern = pattern |
290 |
super(Parent, self).__init__(data)
|
|
290 |
super().__init__(data) |
|
291 | 291 |
sex = self.data.get('sex') |
292 | 292 |
if sex: |
293 | 293 |
if sex == 'M': |
... | ... | |
305 | 305 |
sequence = ('noms', 'prenoms', 'genre', 'sexe', 'parent1', 'parent2', 'naissance') |
306 | 306 | |
307 | 307 |
def __init__(self, data): |
308 |
super(ConcernedCommon, self).__init__(data)
|
|
308 |
super().__init__(data) |
|
309 | 309 |
self.parent1 = Parent(self.data, 'parent1_') |
310 | 310 |
self.parent2 = Parent(self.data, 'parent2_') |
311 | 311 |
passerelle/apps/cmis/views.py | ||
---|---|---|
41 | 41 |
raise Http404(_('Cmis type not found.')) |
42 | 42 |
else: |
43 | 43 |
self.current_type = None |
44 |
return super(CmisTypeView, self).get(request, *args, **kwargs)
|
|
44 |
return super().get(request, *args, **kwargs) |
|
45 | 45 | |
46 | 46 |
def get_context_data(self, **kwargs): |
47 |
ctx = super(CmisTypeView, self).get_context_data(**kwargs)
|
|
47 |
ctx = super().get_context_data(**kwargs) |
|
48 | 48 |
ctx['object'] = self.connector |
49 | 49 |
if self.current_type: |
50 | 50 |
ctx['current_type'] = self.current_type |
passerelle/apps/csvdatasource/models.py | ||
---|---|---|
167 | 167 |
self.get_rows() |
168 | 168 |
except Exception as e: |
169 | 169 |
raise ValidationError(_('Invalid CSV file: %s') % e) |
170 |
return super(CsvDataSource, self).clean(*args, **kwargs)
|
|
170 |
return super().clean(*args, **kwargs) |
|
171 | 171 | |
172 | 172 |
def _detect_dialect_options(self): |
173 | 173 |
content = self.get_content_without_bom() |
... | ... | |
176 | 176 | |
177 | 177 |
def save(self, *args, **kwargs): |
178 | 178 |
cache = kwargs.pop('cache', True) |
179 |
result = super(CsvDataSource, self).save(*args, **kwargs)
|
|
179 |
result = super().save(*args, **kwargs) |
|
180 | 180 |
if cache: |
181 | 181 |
self.cache_data() |
182 | 182 |
return result |
... | ... | |
469 | 469 |
return {'data': list(data[0].values())[0]} |
470 | 470 | |
471 | 471 |
def export_json(self): |
472 |
d = super(CsvDataSource, self).export_json()
|
|
472 |
d = super().export_json() |
|
473 | 473 |
d['queries'] = [query.export_json() for query in Query.objects.filter(resource=self)] |
474 | 474 |
return d |
475 | 475 |
passerelle/apps/csvdatasource/views.py | ||
---|---|---|
30 | 30 |
template_name = 'csvdatasource/query_form.html' |
31 | 31 | |
32 | 32 |
def get_context_data(self, **kwargs): |
33 |
ctx = super(NewQueryView, self).get_context_data(**kwargs)
|
|
33 |
ctx = super().get_context_data(**kwargs) |
|
34 | 34 |
ctx['resource'] = CsvDataSource.objects.get(slug=self.kwargs['connector_slug']) |
35 | 35 |
return ctx |
36 | 36 | |
... | ... | |
47 | 47 |
template_name = 'csvdatasource/query_form.html' |
48 | 48 | |
49 | 49 |
def get_context_data(self, **kwargs): |
50 |
ctx = super(UpdateQueryView, self).get_context_data(**kwargs)
|
|
50 |
ctx = super().get_context_data(**kwargs) |
|
51 | 51 |
ctx['resource'] = CsvDataSource.objects.get(slug=self.kwargs['connector_slug']) |
52 | 52 |
return ctx |
53 | 53 | |
... | ... | |
59 | 59 |
model = Query |
60 | 60 | |
61 | 61 |
def get_context_data(self, **kwargs): |
62 |
ctx = super(DeleteQueryView, self).get_context_data(**kwargs)
|
|
62 |
ctx = super().get_context_data(**kwargs) |
|
63 | 63 |
ctx['resource'] = CsvDataSource.objects.get(slug=self.kwargs['connector_slug']) |
64 | 64 |
return ctx |
65 | 65 |
passerelle/apps/family/models.py | ||
---|---|---|
183 | 183 |
module = sys.modules[modname] |
184 | 184 |
module.Loader(self).clean(archive) |
185 | 185 | |
186 |
return super(GenericFamily, self).clean()
|
|
186 |
return super().clean() |
|
187 | 187 | |
188 | 188 |
@transaction.atomic |
189 | 189 |
def save(self, *args, **kwargs): |
190 |
super(GenericFamily, self).save(*args, **kwargs)
|
|
190 |
super().save(*args, **kwargs) |
|
191 | 191 |
if not zipfile.is_zipfile(self.archive.path): |
192 | 192 |
return |
193 | 193 |
passerelle/apps/gdc/views.py | ||
---|---|---|
192 | 192 |
template_name = 'gdc/gdc_detail.html' |
193 | 193 | |
194 | 194 |
def get_context_data(self, **kwargs): |
195 |
context = super(GdcDetailView, self).get_context_data(**kwargs)
|
|
195 |
context = super().get_context_data(**kwargs) |
|
196 | 196 |
if phpserialize is None: |
197 | 197 |
context['missing_phpserialize'] = True |
198 | 198 |
return context |
passerelle/apps/gesbac/models.py | ||
---|---|---|
253 | 253 |
form.save() |
254 | 254 | |
255 | 255 |
def hourly(self): |
256 |
super(Gesbac, self).hourly()
|
|
256 |
super().hourly() |
|
257 | 257 |
self.get_responses() |
258 | 258 | |
259 | 259 |
def send_demand(self, form_id): |
passerelle/apps/jsondatastore/models.py | ||
---|---|---|
61 | 61 |
template = Template(text_value_template) |
62 | 62 |
context = Context(self.content) |
63 | 63 |
self.text = template.render(context).strip() |
64 |
return super(JsonData, self).save(*args, **kwargs)
|
|
64 |
return super().save(*args, **kwargs) |
|
65 | 65 | |
66 | 66 |
def to_json(self): |
67 | 67 |
return { |
passerelle/apps/mdel/mdel.py | ||
---|---|---|
66 | 66 |
self.flow_type = args[0] |
67 | 67 |
self.num = args[1] |
68 | 68 |
self.doc = kwargs.get('doc') |
69 |
super(Common, self).__init__()
|
|
69 |
super().__init__() |
|
70 | 70 | |
71 | 71 |
def save(self, folder): |
72 |
return super(Common, self).save(folder, self.filename)
|
|
72 |
return super().save(folder, self.filename) |
|
73 | 73 | |
74 | 74 |
@property |
75 | 75 |
def code(self): |
... | ... | |
158 | 158 |
doc=None, |
159 | 159 |
): |
160 | 160 | |
161 |
super(Message, self).__init__(flow_type, num, doc=doc)
|
|
161 |
super().__init__(flow_type, num, doc=doc) |
|
162 | 162 | |
163 | 163 |
etree._namespace_map[self.ns_uri] = self.ns_prefix |
164 | 164 | |
... | ... | |
221 | 221 |
user_comment=None, |
222 | 222 |
): |
223 | 223 | |
224 |
super(Description, self).__init__( |
|
225 |
flow_type, num, zip_code, date, platform_id, form_files, attached_files, doc=doc |
|
226 |
) |
|
224 |
super().__init__(flow_type, num, zip_code, date, platform_id, form_files, attached_files, doc=doc) |
|
227 | 225 |
self.step = step |
228 | 226 | |
229 | 227 |
root = ElementFactory('EnteteMetierEnveloppe', attrib={'xmlns': self.xmlns}) |
... | ... | |
277 | 275 |
return '%s-doc-.xml' % self.demand_id |
278 | 276 | |
279 | 277 |
def save(self, folder): |
280 |
return super(Data, self).save(folder, self.filename)
|
|
278 |
return super().save(folder, self.filename) |
|
281 | 279 | |
282 | 280 |
def data_validator(self, data): |
283 | 281 |
"""Checks if required keys are present""" |
... | ... | |
375 | 373 |
# only possible value : vol as 'Inscription Volontaire' |
376 | 374 |
data['inscription_type'] = 'vol' |
377 | 375 | |
378 |
super(ILEData, self).__init__(demand_id, data)
|
|
376 |
super().__init__(demand_id, data) |
|
379 | 377 | |
380 | 378 | |
381 | 379 |
class AECData(Data): |
... | ... | |
463 | 461 |
self.root_element = 'EnveloppeMetierType' |
464 | 462 |
self.root_attributes = {'canal_utilise': '0'} |
465 | 463 | |
466 |
super(AECData, self).__init__(demand_id, data, demand_num)
|
|
464 |
super().__init__(demand_id, data, demand_num) |
|
467 | 465 | |
468 | 466 | |
469 | 467 |
def json_to_xml(path, value, parent): |
passerelle/apps/mdel/models.py | ||
---|---|---|
212 | 212 | |
213 | 213 |
def save(self, *args, **kwargs): |
214 | 214 |
self.demand_id = '%s-%s' % (self.num, self.flow_type) |
215 |
super(Demand, self).save(*args, **kwargs)
|
|
215 |
super().save(*args, **kwargs) |
|
216 | 216 | |
217 | 217 |
@property |
218 | 218 |
def name(self): |
passerelle/apps/mdel/utils.py | ||
---|---|---|
38 | 38 |
text = kwargs.pop('text', None) |
39 | 39 |
namespace = kwargs.pop('namespace', None) |
40 | 40 |
if namespace: |
41 |
super(ElementFactory, self).__init__(etree.QName(namespace, args[0]), **kwargs)
|
|
41 |
super().__init__(etree.QName(namespace, args[0]), **kwargs) |
|
42 | 42 |
self.namespace = namespace |
43 | 43 |
else: |
44 |
super(ElementFactory, self).__init__(*args, **kwargs)
|
|
44 |
super().__init__(*args, **kwargs) |
|
45 | 45 |
if text: |
46 | 46 |
self.text = text |
47 | 47 | |
... | ... | |
56 | 56 |
if found is not None: |
57 | 57 |
return self |
58 | 58 | |
59 |
super(ElementFactory, self).append(element)
|
|
59 |
super().append(element) |
|
60 | 60 |
return self |
61 | 61 | |
62 | 62 |
def extend(self, elements): |
63 |
super(ElementFactory, self).extend(elements)
|
|
63 |
super().extend(elements) |
|
64 | 64 |
return self |
65 | 65 | |
66 | 66 |
passerelle/apps/mdel_ddpacs/utils.py | ||
---|---|---|
38 | 38 |
self.text = kwargs.pop('text', None) |
39 | 39 |
namespace = kwargs.pop('namespace', None) |
40 | 40 |
if namespace: |
41 |
super(ElementFactory, self).__init__(etree.QName(namespace, args[0]), **kwargs)
|
|
41 |
super().__init__(etree.QName(namespace, args[0]), **kwargs) |
|
42 | 42 |
self.namespace = namespace |
43 | 43 |
else: |
44 |
super(ElementFactory, self).__init__(*args, **kwargs)
|
|
44 |
super().__init__(*args, **kwargs) |
|
45 | 45 | |
46 | 46 |
def append(self, element, allow_new=True): |
47 | 47 | |
... | ... | |
54 | 54 |
if found is not None: |
55 | 55 |
return self |
56 | 56 | |
57 |
super(ElementFactory, self).append(element)
|
|
57 |
super().append(element) |
|
58 | 58 |
return self |
59 | 59 | |
60 | 60 |
def extend(self, elements): |
61 |
super(ElementFactory, self).extend(elements)
|
|
61 |
super().extend(elements) |
|
62 | 62 |
return self |
63 | 63 | |
64 | 64 |
passerelle/apps/opendatasoft/models.py | ||
---|---|---|
47 | 47 |
verbose_name = _('OpenDataSoft Web Service') |
48 | 48 | |
49 | 49 |
def export_json(self): |
50 |
data = super(OpenDataSoft, self).export_json()
|
|
50 |
data = super().export_json() |
|
51 | 51 |
data['queries'] = [query.export_json() for query in self.queries.all()] |
52 | 52 |
return data |
53 | 53 | |
... | ... | |
201 | 201 |
) |
202 | 202 | |
203 | 203 |
def as_endpoint(self): |
204 |
endpoint = super(Query, self).as_endpoint(path=self.resource.q.endpoint_info.name)
|
|
204 |
endpoint = super().as_endpoint(path=self.resource.q.endpoint_info.name) |
|
205 | 205 | |
206 | 206 |
search_endpoint = self.resource.search.endpoint_info |
207 | 207 |
endpoint.func = search_endpoint.func |
passerelle/apps/opendatasoft/views.py | ||
---|---|---|
28 | 28 |
template_name = "passerelle/manage/resource_child_form.html" |
29 | 29 | |
30 | 30 |
def get_form_kwargs(self): |
31 |
kwargs = super(QueryNew, self).get_form_kwargs()
|
|
31 |
kwargs = super().get_form_kwargs() |
|
32 | 32 |
kwargs['instance'] = self.model(resource=self.resource) |
33 | 33 |
return kwargs |
34 | 34 |
passerelle/apps/opengis/models.py | ||
---|---|---|
438 | 438 |
return query.q(request, bbox, q, circle, **kwargs) |
439 | 439 | |
440 | 440 |
def export_json(self): |
441 |
d = super(OpenGIS, self).export_json()
|
|
441 |
d = super().export_json() |
|
442 | 442 |
d['queries'] = [query.export_json() for query in self.queries.all()] |
443 | 443 |
return d |
444 | 444 | |
... | ... | |
457 | 457 |
return instance |
458 | 458 | |
459 | 459 |
def daily(self): |
460 |
super(OpenGIS, self).daily()
|
|
460 |
super().daily() |
|
461 | 461 |
self.update_queries() |
462 | 462 | |
463 | 463 |
def update_queries(self, query_id=None): |
... | ... | |
474 | 474 |
return reverse('opengis-query-new', kwargs={'slug': self.slug}) |
475 | 475 | |
476 | 476 |
def save(self, *args, **kwargs): |
477 |
super(OpenGIS, self).save(*args, **kwargs)
|
|
477 |
super().save(*args, **kwargs) |
|
478 | 478 |
if self.queries.exists(): |
479 | 479 |
self.add_job('update_queries') |
480 | 480 | |
... | ... | |
498 | 498 | |
499 | 499 |
def as_endpoint(self): |
500 | 500 |
resource_endpoint = self.resource.query.endpoint_info |
501 |
endpoint = super(Query, self).as_endpoint(path=resource_endpoint.name)
|
|
501 |
endpoint = super().as_endpoint(path=resource_endpoint.name) |
|
502 | 502 |
# use parameters added by resource endpoint |
503 | 503 |
endpoint.func = resource_endpoint.func |
504 | 504 |
endpoint.show_undocumented_params = False |
... | ... | |
687 | 687 |
FeatureCache.objects.bulk_create(features) |
688 | 688 | |
689 | 689 |
def save(self, *args, **kwargs): |
690 |
super(Query, self).save(*args, **kwargs)
|
|
690 |
super().save(*args, **kwargs) |
|
691 | 691 |
self.resource.add_job('update_queries', query_id=self.pk) |
692 | 692 | |
693 | 693 |
passerelle/apps/opengis/views.py | ||
---|---|---|
61 | 61 |
return context |
62 | 62 | |
63 | 63 |
def get_form_kwargs(self): |
64 |
kwargs = super(QueryNew, self).get_form_kwargs()
|
|
64 |
kwargs = super().get_form_kwargs() |
|
65 | 65 |
kwargs['instance'] = self.model(resource=self.resource) |
66 | 66 |
return kwargs |
67 | 67 |
passerelle/apps/phonecalls/models.py | ||
---|---|---|
130 | 130 |
} |
131 | 131 | |
132 | 132 |
def hourly(self): |
133 |
super(PhoneCalls, self).hourly()
|
|
133 |
super().hourly() |
|
134 | 134 |
# close unfinished long calls |
135 | 135 |
maximal_time = now() - timedelta(minutes=self.max_call_duration) |
136 | 136 |
Call.objects.filter(resource=self, end_timestamp=None, start_timestamp__lt=maximal_time).update( |
... | ... | |
138 | 138 |
) |
139 | 139 | |
140 | 140 |
def daily(self): |
141 |
super(PhoneCalls, self).daily()
|
|
141 |
super().daily() |
|
142 | 142 |
# remove finished old calls |
143 | 143 |
maximal_time = now() - timedelta(days=self.data_retention_period) |
144 | 144 |
Call.objects.filter( |
passerelle/apps/plone_restapi/models.py | ||
---|---|---|
72 | 72 |
verbose_name = _('Plone REST API Web Service') |
73 | 73 | |
74 | 74 |
def export_json(self): |
75 |
data = super(PloneRestApi, self).export_json()
|
|
75 |
data = super().export_json() |
|
76 | 76 |
data['queries'] = [query.export_json() for query in self.queries.all()] |
77 | 77 |
return data |
78 | 78 | |
... | ... | |
431 | 431 |
) |
432 | 432 | |
433 | 433 |
def as_endpoint(self): |
434 |
endpoint = super(Query, self).as_endpoint(path=self.resource.q.endpoint_info.name)
|
|
434 |
endpoint = super().as_endpoint(path=self.resource.q.endpoint_info.name) |
|
435 | 435 | |
436 | 436 |
search_endpoint = self.resource.search.endpoint_info |
437 | 437 |
endpoint.func = search_endpoint.func |
passerelle/apps/plone_restapi/views.py | ||
---|---|---|
28 | 28 |
template_name = "passerelle/manage/resource_child_form.html" |
29 | 29 | |
30 | 30 |
def get_form_kwargs(self): |
31 |
kwargs = super(QueryNew, self).get_form_kwargs()
|
|
31 |
kwargs = super().get_form_kwargs() |
|
32 | 32 |
kwargs['instance'] = self.model(resource=self.resource) |
33 | 33 |
return kwargs |
34 | 34 |
passerelle/apps/sp_fr/fields.py | ||
---|---|---|
34 | 34 |
forms.Select, |
35 | 35 |
forms.TextInput, |
36 | 36 |
] |
37 |
super(VariableAndExpressionWidget, self).__init__(widgets=widgets, **kwargs)
|
|
37 |
super().__init__(widgets=widgets, **kwargs) |
|
38 | 38 | |
39 | 39 |
def decompress(self, value): |
40 | 40 |
if not value: |
... | ... | |
58 | 58 |
forms.ChoiceField(choices=choices, required=required), |
59 | 59 |
forms.CharField(required=False, validators=[validate_django_template]), |
60 | 60 |
] |
61 |
super(VariableAndExpressionField, self).__init__(
|
|
61 |
super().__init__( |
|
62 | 62 |
fields=fields, |
63 | 63 |
required=required, |
64 | 64 |
widget=widget, |
passerelle/apps/sp_fr/forms.py | ||
---|---|---|
21 | 21 | |
22 | 22 |
class MappingForm(forms.ModelForm): |
23 | 23 |
def __init__(self, *args, **kwargs): |
24 |
super(MappingForm, self).__init__(*args, **kwargs)
|
|
24 |
super().__init__(*args, **kwargs) |
|
25 | 25 |
if self.instance.procedure and self.instance and self.instance.formdef: |
26 | 26 |
choices = [('', '--------')] + [(v, v) for v in self.instance.variables] |
27 | 27 |
for i, field in enumerate(self.schema_fields()): |
... | ... | |
56 | 56 |
value['label'] = self.fields[key].label |
57 | 57 |
fields[real_key] = value |
58 | 58 |
self.instance.rules['fields'] = fields |
59 |
return super(MappingForm, self).save(commit=commit)
|
|
59 |
return super().save(commit=commit) |
|
60 | 60 | |
61 | 61 |
class Meta: |
62 | 62 |
model = models.Mapping |
passerelle/apps/sp_fr/models.py | ||
---|---|---|
690 | 690 |
self.archive.delete() |
691 | 691 |
except Exception: |
692 | 692 |
self.resource.logger.error('could not delete %s', self.archive) |
693 |
return super(Request, self).delete(*args, **kwargs)
|
|
693 |
return super().delete(*args, **kwargs) |
|
694 | 694 | |
695 | 695 |
@property |
696 | 696 |
def message_xml(self): |
passerelle/apps/sp_fr/views.py | ||
---|---|---|
29 | 29 |
def form_valid(self, form): |
30 | 30 |
if set(form.changed_data) & set(['procedure', 'formdef']): |
31 | 31 |
self.has_changed = True |
32 |
return super(StayIfChanged, self).form_valid(form)
|
|
32 |
return super().form_valid(form) |
|
33 | 33 | |
34 | 34 |
def get_success_url(self): |
35 | 35 |
if self.has_changed: |
36 | 36 |
return self.get_changed_url() |
37 |
return super(StayIfChanged, self).get_success_url()
|
|
37 |
return super().get_success_url() |
|
38 | 38 | |
39 | 39 |
def get_changed_url(self): |
40 | 40 |
return '' |
... | ... | |
46 | 46 | |
47 | 47 |
def form_valid(self, form): |
48 | 48 |
form.instance.resource = self.resource |
49 |
return super(MappingNew, self).form_valid(form)
|
|
49 |
return super().form_valid(form) |
|
50 | 50 | |
51 | 51 |
def get_changed_url(self): |
52 | 52 |
return self.object.get_absolute_url() |
passerelle/base/mixins.py | ||
---|---|---|
38 | 38 |
return self.resource_class.objects.get(slug=self.kwargs['slug']) |
39 | 39 | |
40 | 40 |
def get_queryset(self): |
41 |
qs = super(ResourceChildViewMixin, self).get_queryset()
|
|
41 |
qs = super().get_queryset() |
|
42 | 42 |
return qs.filter(resource=self.resource) |
43 | 43 | |
44 | 44 |
def get_success_url(self): |
passerelle/base/models.py | ||
---|---|---|
162 | 162 |
pass |
163 | 163 | |
164 | 164 |
def __init__(self, *args, **kwargs): |
165 |
super(BaseResource, self).__init__(*args, **kwargs)
|
|
165 |
super().__init__(*args, **kwargs) |
|
166 | 166 |
self.logger = ProxyLogger(connector=self, transaction_id=str(uuid.uuid4())) |
167 | 167 | |
168 | 168 |
def __str__(self): |
... | ... | |
767 | 767 |
class SkipJob(Exception): |
768 | 768 |
def __init__(self, after_timestamp=None): |
769 | 769 |
self.after_timestamp = after_timestamp |
770 |
super(SkipJob, self).__init__()
|
|
770 |
super().__init__() |
|
771 | 771 | |
772 | 772 | |
773 | 773 |
class Job(models.Model): |
passerelle/base/views.py | ||
---|---|---|
51 | 51 |
raise PermissionDenied |
52 | 52 | |
53 | 53 |
def get_context_data(self, slug=None, **kwargs): |
54 |
context = super(ResourceView, self).get_context_data(**kwargs)
|
|
54 |
context = super().get_context_data(**kwargs) |
|
55 | 55 |
context['site_base_uri'] = '%s://%s' % ( |
56 | 56 |
'https' if self.request.is_secure() else 'http', |
57 | 57 |
self.request.get_host(), |
... | ... | |
93 | 93 |
ordering = 'id' |
94 | 94 | |
95 | 95 |
def get_context_data(self, slug=None, **kwargs): |
96 |
context = super(ApiUserListView, self).get_context_data(**kwargs)
|
|
96 |
context = super().get_context_data(**kwargs) |
|
97 | 97 |
context['trusted_services'] = get_trusted_services() |
98 | 98 |
return context |
99 | 99 | |
... | ... | |
103 | 103 |
template_name = 'passerelle/manage/accessright_confirm_delete.html' |
104 | 104 | |
105 | 105 |
def get_object(self): |
106 |
object = super(AccessRightDeleteView, self).get_object()
|
|
106 |
object = super().get_object() |
|
107 | 107 |
self.resource = object.resource |
108 | 108 |
return object |
109 | 109 | |
... | ... | |
127 | 127 |
if not form.cleaned_data['apiuser'].key and not form.allow_open_access: |
128 | 128 |
form.add_confirmation_checkbox() |
129 | 129 |
return self.form_invalid(form) |
130 |
return super(AccessRightCreateView, self).form_valid(form)
|
|
130 |
return super().form_valid(form) |
|
131 | 131 | |
132 | 132 |
def get_success_url(self): |
133 | 133 |
return self.object.resource.get_absolute_url() |
... | ... | |
137 | 137 |
template_name = 'passerelle/manage/logging_parameters_form.html' |
138 | 138 | |
139 | 139 |
def get_context_data(self, **kwargs): |
140 |
context = super(LoggingParametersUpdateView, self).get_context_data(**kwargs)
|
|
140 |
context = super().get_context_data(**kwargs) |
|
141 | 141 |
context['connector'] = self.get_resource() |
142 | 142 |
return context |
143 | 143 | |
... | ... | |
182 | 182 |
parameters.responses_max_size = form.cleaned_data['responses_max_size'] |
183 | 183 |
parameters.log_retention_days = form.cleaned_data['log_retention_days'] |
184 | 184 |
parameters.save() |
185 |
return super(LoggingParametersUpdateView, self).form_valid(form)
|
|
185 |
return super().form_valid(form) |
|
186 | 186 | |
187 | 187 | |
188 | 188 |
class ManageAvailabilityView(UpdateView): |
... | ... | |
199 | 199 |
return self.get_resource().availability_parameters |
200 | 200 | |
201 | 201 |
def get_context_data(self, **kwargs): |
202 |
context = super(ManageAvailabilityView, self).get_context_data(**kwargs)
|
|
202 |
context = super().get_context_data(**kwargs) |
|
203 | 203 |
context['connector'] = self.get_resource() |
204 | 204 |
context['availability_status'] = self.get_resource().get_availability_status() |
205 | 205 |
return context |
... | ... | |
229 | 229 |
if form.instance.run_check: |
230 | 230 |
resource.availability() |
231 | 231 | |
232 |
return super(ManageAvailabilityView, self).form_valid(form)
|
|
232 |
return super().form_valid(form) |
|
233 | 233 | |
234 | 234 | |
235 | 235 |
class GenericViewJobsConnectorView(GenericConnectorMixin, ListView): |
... | ... | |
237 | 237 |
paginate_by = 25 |
238 | 238 | |
239 | 239 |
def get_context_data(self, **kwargs): |
240 |
context = super(GenericViewJobsConnectorView, self).get_context_data(**kwargs)
|
|
240 |
context = super().get_context_data(**kwargs) |
|
241 | 241 |
connector = self.get_object() |
242 | 242 |
context['object'] = connector |
243 | 243 |
context['query'] = self.request.GET.get('q') or '' |
... | ... | |
299 | 299 |
template_name = 'passerelle/manage/job.html' |
300 | 300 | |
301 | 301 |
def get_context_data(self, **kwargs): |
302 |
context = super(GenericJobView, self).get_context_data(**kwargs)
|
|
302 |
context = super().get_context_data(**kwargs) |
|
303 | 303 |
try: |
304 | 304 |
context['job'] = Job.objects.get(pk=self.kwargs['job_pk']) |
305 | 305 |
except Job.DoesNotExist: |
... | ... | |
343 | 343 |
except ImportSiteError as e: |
344 | 344 |
form.add_error('site_json', e) |
345 | 345 |
return self.form_invalid(form) |
346 |
return super(ImportSiteView, self).form_valid(form)
|
|
346 |
return super().form_valid(form) |
|
347 | 347 | |
348 | 348 | |
349 | 349 |
class ExportSiteView(View): |
passerelle/contrib/fake_family/models.py | ||
---|---|---|
35 | 35 |
def save(self, *args, **kwargs): |
36 | 36 |
if not self.jsondatabase: |
37 | 37 |
self.jsondatabase = default_database() |
38 |
super(FakeFamily, self).save(*args, **kwargs)
|
|
38 |
super().save(*args, **kwargs) |
|
39 | 39 | |
40 | 40 |
@classmethod |
41 | 41 |
def get_verbose_name(cls): |
passerelle/contrib/grandlyon_streetsections/models.py | ||
---|---|---|
118 | 118 |
return {'err': 1} |
119 | 119 | |
120 | 120 |
def daily(self): |
121 |
super(GrandLyonStreetSections, self).daily()
|
|
121 |
super().daily() |
|
122 | 122 |
update_start = timezone.now() |
123 | 123 |
sections = self.requests.get( |
124 | 124 |
'https://download.data.grandlyon.com/ws/grandlyon/adr_voie_lieu.adraxevoie/all.json?maxfeatures=1000000' |
... | ... | |
171 | 171 |
def save(self, *args, **kwargs): |
172 | 172 |
if self.nom: |
173 | 173 |
self.normalized_name = normalize_street(self.nom) |
174 |
return super(StreetSection, self).save(*args, **kwargs) |
|
174 |
return super().save(*args, **kwargs) |
passerelle/contrib/solis_apa/views.py | ||
---|---|---|
103 | 103 | |
104 | 104 |
@method_decorator(csrf_exempt) |
105 | 105 |
def dispatch(self, request, *args, **kwargs): |
106 |
return super(IntegrationView, self).dispatch(request, *args, **kwargs)
|
|
106 |
return super().dispatch(request, *args, **kwargs) |
|
107 | 107 | |
108 | 108 |
@utils.protected_api('can_access') |
109 | 109 |
@utils.to_json() |
passerelle/contrib/tcl/models.py | ||
---|---|---|
122 | 122 |
self.stop(None, stop_object.id) |
123 | 123 | |
124 | 124 |
def daily(self): |
125 |
super(Tcl, self).daily()
|
|
125 |
super().daily() |
|
126 | 126 |
start_update = timezone.now() |
127 | 127 | |
128 | 128 |
with transaction.atomic(): |
... | ... | |
255 | 255 |
else: |
256 | 256 |
raise Exception('unknown TCL line %r' % self.code_titan) |
257 | 257 | |
258 |
return super(Line, self).save(*args, **kwargs)
|
|
258 |
return super().save(*args, **kwargs) |
|
259 | 259 | |
260 | 260 | |
261 | 261 |
class Stop(models.Model): |
passerelle/contrib/utils/axel.py | ||
---|---|---|
113 | 113 |
self.message = message |
114 | 114 |
self.xml_request = xml_request |
115 | 115 |
self.xml_response = xml_response |
116 |
super(AxelError, self).__init__(message, *args)
|
|
116 |
super().__init__(message, *args) |
|
117 | 117 | |
118 | 118 |
def __str__(self): |
119 | 119 |
return self.message |
passerelle/forms.py | ||
---|---|---|
23 | 23 |
def save(self, commit=True): |
24 | 24 |
if not self.instance.slug: |
25 | 25 |
self.instance.slug = slugify(self.instance.title) |
26 |
return super(GenericConnectorForm, self).save(commit=commit)
|
|
26 |
return super().save(commit=commit) |
|
27 | 27 | |
28 | 28 | |
29 | 29 |
class ResourceLogSearchForm(forms.Form): |
passerelle/sms/forms.py | ||
---|---|---|
29 | 29 |
def __init__(self, *args, **kwargs): |
30 | 30 |
from passerelle.sms.models import SMSResource |
31 | 31 | |
32 |
super(SMSConnectorForm, self).__init__(*args, **kwargs)
|
|
32 |
super().__init__(*args, **kwargs) |
|
33 | 33 |
self.fields['authorized'] = forms.MultipleChoiceField( |
34 | 34 |
choices=SMSResource.AUTHORIZED, |
35 | 35 |
widget=forms.CheckboxSelectMultiple, |
passerelle/sms/models.py | ||
---|---|---|
131 | 131 |
return ', '.join(result) |
132 | 132 | |
133 | 133 |
def __init__(self, *args, **kwargs): |
134 |
super(SMSResource, self).__init__(*args, **kwargs)
|
|
134 |
super().__init__(*args, **kwargs) |
|
135 | 135 |
self.get_authorized_display = self._get_authorized_display |
136 | 136 | |
137 | 137 |
def clean_numbers(self, destinations): |
passerelle/sms/views.py | ||
---|---|---|
43 | 43 |
messages.error(self.request, _('Sending SMS fails: %s' % exc)) |
44 | 44 |
else: |
45 | 45 |
messages.success(self.request, _('An SMS was just sent')) |
46 |
return super(SmsTestSendView, self).form_valid(form)
|
|
46 |
return super().form_valid(form) |
|
47 | 47 | |
48 | 48 | |
49 | 49 |
class SmsStatisticsView(View): |
passerelle/urls_utils.py | ||
---|---|---|
20 | 20 | |
21 | 21 |
class DecoratedURLPattern(URLPattern): |
22 | 22 |
def resolve(self, *args, **kwargs): |
23 |
result = super(DecoratedURLPattern, self).resolve(*args, **kwargs)
|
|
23 |
result = super().resolve(*args, **kwargs) |
|
24 | 24 |
if result: |
25 | 25 |
result.func = self._decorate_with(result.func) |
26 | 26 |
return result |
... | ... | |
28 | 28 | |
29 | 29 |
class DecoratedURLResolver(URLResolver): |
30 | 30 |
def resolve(self, *args, **kwargs): |
31 |
result = super(DecoratedURLResolver, self).resolve(*args, **kwargs)
|
|
31 |
result = super().resolve(*args, **kwargs) |
|
32 | 32 |
if result: |
33 | 33 |
result.func = self._decorate_with(result.func) |
34 | 34 |
return result |
passerelle/utils/__init__.py | ||
---|---|---|
258 | 258 |
self.logger = kwargs.pop('logger') |
259 | 259 |
self.resource = kwargs.pop('resource', None) |
260 | 260 |
timeout = kwargs.pop('timeout', None) |
261 |
super(Request, self).__init__(*args, **kwargs)
|
|
261 |
super().__init__(*args, **kwargs) |
|
262 | 262 |
if self.resource: |
263 | 263 |
timeout = timeout if timeout is not None else getattr(self.resource, 'requests_timeout', None) |
264 | 264 |
http_adapter_init_kwargs = {} |
... | ... | |
321 | 321 |
if kwargs.get('verify') is False: |
322 | 322 |
# disable urllib3 warnings |
323 | 323 |
warnings.simplefilter(action='ignore', category=InsecureRequestWarning) |
324 |
response = super(Request, self).request(method, url, **kwargs)
|
|
324 |
response = super().request(method, url, **kwargs) |
|
325 | 325 | |
326 | 326 |
if method == 'GET' and cache_duration and (response.status_code // 100 == 2): |
327 | 327 |
cache.set( |
... | ... | |
339 | 339 |
def send(self, request, **kwargs): |
340 | 340 |
start_time = time.time() |
341 | 341 |
try: |
342 |
response = super(Request, self).send(request, **kwargs)
|
|
342 |
response = super().send(request, **kwargs) |
|
343 | 343 |
duration = time.time() - start_time |
344 | 344 |
except Exception as exc: |
345 | 345 |
duration = time.time() - start_time |
passerelle/utils/jsonresponse.py | ||
---|---|---|
37 | 37 |
self.log_error = kwargs.pop('log_error', False) |
38 | 38 |
self.http_status = kwargs.pop('http_status', 200) |
39 | 39 |
self.__dict__.update(kwargs) |
40 |
super(APIError, self).__init__(*args)
|
|
40 |
super().__init__(*args) |
|
41 | 41 | |
42 | 42 | |
43 | 43 |
class JSONEncoder(DjangoJSONEncoder): |
44 | 44 |
def default(self, o): |
45 | 45 |
if isinstance(o, time.struct_time): |
46 | 46 |
o = datetime.datetime(*tuple(o)[:6]) |
47 |
return super(JSONEncoder, self).default(o)
|
|
47 |
return super().default(o) |
|
48 | 48 | |
49 | 49 | |
50 | 50 |
class to_json(object): |
passerelle/utils/sftp.py | ||
---|---|---|
155 | 155 |
forms.Textarea, |
156 | 156 |
forms.TextInput, |
157 | 157 |
] |
158 |
super(SFTPWidget, self).__init__(widgets=widgets, **kwargs)
|
|
158 |
super().__init__(widgets=widgets, **kwargs) |
|
159 | 159 | |
160 | 160 |
def decompress(self, value): |
161 | 161 |
if not value: |
... | ... | |
186 | 186 |
forms.CharField(required=False), |
187 | 187 |
forms.CharField(required=False), |
188 | 188 |
] |
189 |
super(SFTPFormField, self).__init__(fields=fields, require_all_fields=False, **kwargs)
|
|
189 |
super().__init__(fields=fields, require_all_fields=False, **kwargs) |
|
190 | 190 | |
191 | 191 |
def compress(self, data_list): |
192 | 192 |
if not data_list: |
... | ... | |
211 | 211 | |
212 | 212 |
def __init__(self, **kwargs): |
213 | 213 |
kwargs.setdefault('default', None) |
214 |
super(SFTPField, self).__init__(**kwargs)
|
|
214 |
super().__init__(**kwargs) |
|
215 | 215 | |
216 | 216 |
def get_internal_type(self): |
217 | 217 |
return 'TextField' |
... | ... | |
236 | 236 |
'form_class': SFTPFormField, |
237 | 237 |
} |
238 | 238 |
defaults.update(**kwargs) |
239 |
return super(SFTPField, self).formfield(**defaults) |
|
239 |
return super().formfield(**defaults) |
passerelle/utils/soap.py | ||
---|---|---|
40 | 40 |
transport = transport_class( |
41 | 41 |
resource, wsdl_url, session=resource.requests, cache=InMemoryCache(), **transport_kwargs |
42 | 42 |
) |
43 |
super(SOAPClient, self).__init__(wsdl_url, transport=transport, **kwargs)
|
|
43 |
super().__init__(wsdl_url, transport=transport, **kwargs) |
|
44 | 44 | |
45 | 45 | |
46 | 46 |
class ResponseFixContentWrapper: |
... | ... | |
74 | 74 |
self.wsdl_host = urlparse.urlparse(wsdl_url).netloc |
75 | 75 |
# fix content for servers returning unexpected characters before XML document start |
76 | 76 |
self.remove_first_bytes_for_xml = remove_first_bytes_for_xml |
77 |
super(SOAPTransport, self).__init__(**kwargs)
|
|
77 |
super().__init__(**kwargs) |
|
78 | 78 | |
79 | 79 |
def _load_remote_data(self, url): |
80 | 80 |
try: |
... | ... | |
82 | 82 |
response = self.session.get(url, timeout=self.load_timeout, auth=None, cert=None) |
83 | 83 |
response.raise_for_status() |
84 | 84 |
return response.content |
85 |
return super(SOAPTransport, self)._load_remote_data(url)
|
|
85 |
return super()._load_remote_data(url) |
|
86 | 86 |
except RequestException as e: |
87 | 87 |
raise SOAPError( |
88 | 88 |
'SOAP service is down, location %r cannot be loaded: %s' % (url, e), exception=e, url=url |
passerelle/utils/wcs.py | ||
---|---|---|
87 | 87 |
fields = None |
88 | 88 | |
89 | 89 |
def __init__(self, wcs_api, **kwargs): |
90 |
super(FormDataWorkflow, self).__init__(wcs_api, **kwargs)
|
|
90 |
super().__init__(wcs_api, **kwargs) |
|
91 | 91 |
if self.status is not None: |
92 | 92 |
self.status = BaseObject(wcs_api, **self.status) |
93 | 93 |
self.fields = self.fields or {} |
... | ... | |
106 | 106 |
parts = None |
107 | 107 | |
108 | 108 |
def __init__(self, wcs_api, **kwargs): |
109 |
super(Evolution, self).__init__(wcs_api, **kwargs)
|
|
109 |
super().__init__(wcs_api, **kwargs) |
|
110 | 110 |
self.time = isodate.parse_datetime(self.time) |
111 | 111 |
if self.parts: |
112 | 112 |
self.parts = [BaseObject(wcs_api, **part) for part in self.parts] |
... | ... | |
125 | 125 | |
126 | 126 |
def __init__(self, wcs_api, forms, **kwargs): |
127 | 127 |
self.forms = forms |
128 |
super(FormData, self).__init__(wcs_api, **kwargs)
|
|
128 |
super().__init__(wcs_api, **kwargs) |
|
129 | 129 |
self.receipt_time = isodate.parse_datetime(self.receipt_time) |
130 | 130 |
if self.submissions: |
131 | 131 |
self.submission = BaseObject(wcs_api, **self.submission) |
... | ... | |
198 | 198 |
fields = None |
199 | 199 | |
200 | 200 |
def __init__(self, wcs_api, **kwargs): |
201 |
super(Workflow, self).__init__(wcs_api, **kwargs)
|
|
201 |
super().__init__(wcs_api, **kwargs) |
|
202 | 202 |
self.statuses = [BaseObject(wcs_api, **v) for v in (self.statuses or [])] |
203 | 203 |
assert not hasattr(self.statuses[0], 'startpoint'), 'startpoint is exported by w.c.s. FIXME' |
204 | 204 |
for status in self.statuses: |
... | ... | |
222 | 222 |
geolocations = None |
223 | 223 | |
224 | 224 |
def __init__(self, wcs_api, **kwargs): |
225 |
super(Schema, self).__init__(wcs_api, **kwargs)
|
|
225 |
super().__init__(wcs_api, **kwargs) |
|
226 | 226 |
self.workflow = Workflow(wcs_api, **self.workflow) |
227 | 227 |
self.fields = [Field(wcs_api, **f) for f in self.fields] |
228 | 228 |
self.geolocations = sorted((k, v) for k, v in (self.geolocations or {}).items()) |
... | ... | |
691 | 691 | |
692 | 692 |
class FormDefFormField(forms.TypedChoiceField): |
693 | 693 |
def __init__(self, **kwargs): |
694 |
super(FormDefFormField, self).__init__(choices=self.get_formdef_choices, coerce=FormDefRef, **kwargs)
|
|
694 |
super().__init__(choices=self.get_formdef_choices, coerce=FormDefRef, **kwargs) |
|
695 | 695 | |
696 | 696 |
def get_formdef_choices(self): |
697 | 697 |
requests = getattr(self, 'requests', None) |
... | ... | |
722 | 722 |
'form_class': FormDefFormField, |
723 | 723 |
} |
724 | 724 |
defaults.update(kwargs) |
725 |
return super(FormDefField, self).formfield(**defaults) |
|
725 |
return super().formfield(**defaults) |
passerelle/utils/xml.py | ||
---|---|---|
105 | 105 |
class TransformConverter(xmlschema.UnorderedConverter): |
106 | 106 |
def __init__(self, *args, **kwargs): |
107 | 107 |
self.transformer = kwargs.pop('transformer', None) |
108 |
super(TransformConverter, self).__init__(*args, **kwargs)
|
|
108 |
super().__init__(*args, **kwargs) |
|
109 | 109 | |
110 | 110 |
def copy(self, **kwargs): |
111 | 111 |
transformer = kwargs.pop('transformer', self.transformer) |
112 |
new = super(TransformConverter, self).copy(**kwargs)
|
|
112 |
new = super().copy(**kwargs) |
|
113 | 113 |
new.transformer = transformer |
114 | 114 |
return new |
115 | 115 | |
... | ... | |
119 | 119 |
mapped = self.transformer.type_map[xsd_element.type.name] |
120 | 120 |
if hasattr(self.transformer, 'decode_%s' % mapped): |
121 | 121 |
data = getattr(self.transformer, 'decode_%s' % mapped)(data) |
122 |
return super(TransformConverter, self).element_decode(data, xsd_element, *args)
|
|
122 |
return super().element_decode(data, xsd_element, *args) |
|
123 | 123 | |
124 | 124 |
def element_encode(self, obj, xsd_element, *args): |
125 | 125 |
if self.transformer: |
... | ... | |
127 | 127 |
mapped = self.transformer.type_map[xsd_element.type.name] |
128 | 128 |
if hasattr(self.transformer, 'encode_%s' % mapped): |
129 | 129 |
obj = getattr(self.transformer, 'encode_%s' % mapped)(obj) |
130 |
return super(TransformConverter, self).element_encode(obj, xsd_element, *args)
|
|
130 |
return super().element_encode(obj, xsd_element, *args) |
|
131 | 131 | |
132 | 132 | |
133 | 133 |
class JSONSchemaFromXMLSchema(object): |
passerelle/views.py | ||
---|---|---|
82 | 82 |
return HttpResponseRedirect( |
83 | 83 |
resolve_url('mellon_login') + '?next=' + quote(request.GET.get('next')) |
84 | 84 |
) |
85 |
return super(LoginView, self).dispatch(request, *args, **kwargs)
|
|
85 |
return super().dispatch(request, *args, **kwargs) |
|
86 | 86 | |
87 | 87 | |
88 | 88 |
login = LoginView.as_view() |
... | ... | |
130 | 130 |
template_name = 'passerelle/manage.html' |
131 | 131 | |
132 | 132 |
def get_context_data(self, **kwargs): |
133 |
context = super(ManageView, self).get_context_data(**kwargs)
|
|
133 |
context = super().get_context_data(**kwargs) |
|
134 | 134 |
# get all app instances |
135 | 135 |
context['apps'] = [] |
136 | 136 |
for app in get_all_apps(): |
... | ... | |
143 | 143 |
template_name = 'passerelle/manage_add.html' |
144 | 144 | |
145 | 145 |
def get_context_data(self, **kwargs): |
146 |
context = super(ManageAddView, self).get_context_data(**kwargs)
|
|
146 |
context = super().get_context_data(**kwargs) |
|
147 | 147 |
context['apps'] = [x for x in get_all_apps() if not x.is_legacy()] |
148 | 148 |
context['apps'].sort(key=lambda x: x.get_verbose_name()) |
149 | 149 |
return context |
... | ... | |
172 | 172 | |
173 | 173 |
def dispatch(self, request, *args, **kwargs): |
174 | 174 |
self.init_stuff(request, *args, **kwargs) |
175 |
return super(GenericConnectorMixin, self).dispatch(request, *args, **kwargs)
|
|
175 |
return super().dispatch(request, *args, **kwargs) |
|
176 | 176 | |
177 | 177 | |
178 | 178 |
class GenericConnectorView(GenericConnectorMixin, DetailView): |
179 | 179 |
def get_context_data(self, slug=None, **kwargs): |
180 |
context = super(GenericConnectorView, self).get_context_data(**kwargs)
|
|
180 |
context = super().get_context_data(**kwargs) |
|
181 | 181 |
context['has_check_status'] = not hasattr(context['object'].check_status, 'not_implemented') |
182 | 182 |
return context |
183 | 183 | |
... | ... | |
195 | 195 | |
196 | 196 |
def form_valid(self, form): |
197 | 197 |
with transaction.atomic(): |
198 |
response = super(GenericCreateConnectorView, self).form_valid(form)
|
|
198 |
response = super().form_valid(form) |
|
199 | 199 |
self.object.availability() |
200 | 200 |
return response |
201 | 201 | |
202 | 202 |
def init_stuff(self, request, *args, **kwargs): |
203 |
super(GenericCreateConnectorView, self).init_stuff(request, *args, **kwargs)
|
|
203 |
super().init_stuff(request, *args, **kwargs) |
|
204 | 204 |
# tell JS to prepopulate 'slug' field using the 'title' field |
205 | 205 |
self.get_form_class().base_fields['title'].widget.attrs['data-slug-sync'] = 'slug' |
206 | 206 | |
... | ... | |
210 | 210 | |
211 | 211 |
def form_valid(self, form): |
212 | 212 |
with transaction.atomic(): |
213 |
response = super(GenericEditConnectorView, self).form_valid(form)
|
|
213 |
response = super().form_valid(form) |
|
214 | 214 |
self.object.availability() |
215 | 215 |
return response |
216 | 216 | |
... | ... | |
228 | 228 |
paginator_class = InfinitePaginator |
229 | 229 | |
230 | 230 |
def get_context_data(self, **kwargs): |
231 |
context = super(GenericViewLogsConnectorView, self).get_context_data(**kwargs)
|
|
231 |
context = super().get_context_data(**kwargs) |
|
232 | 232 |
context['object'] = self.get_object() |
233 | 233 |
context['form'] = self.form |
234 | 234 |
if self.request.GET.get('log_id'): |
... | ... | |
287 | 287 |
template_name = 'passerelle/manage/log.html' |
288 | 288 | |
289 | 289 |
def get_context_data(self, **kwargs): |
290 |
context = super(GenericLogView, self).get_context_data(**kwargs)
|
|
290 |
context = super().get_context_data(**kwargs) |
|
291 | 291 |
try: |
292 | 292 |
context['logline'] = ResourceLog.objects.get( |
293 | 293 |
pk=self.kwargs['log_pk'], appname=self.kwargs['connector'], slug=self.kwargs['slug'] |
... | ... | |
445 | 445 |
if kwargs.get('endpoint') == 'up' and hasattr(self.connector.check_status, 'not_implemented'): |
446 | 446 |
# hide automatic up endpoint if check_status method is not implemented |
447 | 447 |
raise Http404() |
448 |
return super(GenericEndpointView, self).dispatch(request, *args, **kwargs)
|
|
448 |
return super().dispatch(request, *args, **kwargs) |
|
449 | 449 | |
450 | 450 |
def _allowed_methods(self): |
451 | 451 |
return [x.upper() for x in self.endpoint.endpoint_info.methods] |
tests/test_dpark.py | ||
---|---|---|
75 | 75 |
class ReplyDataClass(dict): |
76 | 76 |
def __init__(self, **kwargs): |
77 | 77 |
self.__dict__.update(kwargs) |
78 |
super(ReplyDataClass, self).__init__(**kwargs)
|
|
78 |
super().__init__(**kwargs) |
|
79 | 79 | |
80 | 80 | |
81 | 81 |
class WebFaultHavingLatin1(WebFault): |
tests/test_generic_endpoint.py | ||
---|---|---|
371 | 371 |
BAR_SCHEMA = copy.deepcopy(FOO_SCHEMA) |
372 | 372 | |
373 | 373 |
def __init__(self, *args, **kwargs): |
374 |
super(FakeJSONConnector, self).__init__(*args, **kwargs)
|
|
374 |
super().__init__(*args, **kwargs) |
|
375 | 375 |
self.logger = ProxyLogger(connector=self) |
376 | 376 | |
377 | 377 |
@property |
378 |
- |