Projet

Général

Profil

0001-py3-use-s.replace-instead-of-string.replace-46576.patch

Thomas Noël, 11 septembre 2020 12:10

Télécharger (3,63 ko)

Voir les différences:

Subject: [PATCH 1/3] py3: use s.replace instead of string.replace (#46576)

 passerelle_minint/minint_maarch/views.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
passerelle_minint/minint_maarch/views.py
18 18
from datetime import datetime
19 19
import logging
20 20
import re
21
import string
22 21

  
23 22
from django.views.generic import DetailView as GenericDetailView
24 23
from django.utils.decorators import method_decorator
......
147 146
                        m = regexp_filename_search_pattern_in_label.match(field['label'])
148 147
                        if m:
149 148
                            value['filename_original'] = value['filename']
150
                            value['filename'] = string.replace(filename_result_pattern, 'searchedPatternInLabel', m.group(1))
149
                            value['filename'] = filename_result_pattern.replace('searchedPatternInLabel', m.group(1))
151 150
                            if 'filename' in filename_result_pattern:
152
                                value['filename'] = string.replace(value['filename'], 'filename', value['filename_original'])
151
                                value['filename'] = value['filename'].replace('filename', value['filename_original'])
153 152
                    attachments.append(value)
154 153
                    value = '%s' % value['filename']
155 154
                elif field['type'] == 'date':
......
415 414
                        m = regexp_filename_search_pattern_in_label.match(field['label'])
416 415
                        if m:
417 416
                            value['filename_original'] = value['filename']
418
                            value['filename'] = string.replace(filename_result_pattern, 'searchedPatternInLabel', m.group(1))
417
                            value['filename'] = filename_result_pattern.replace('searchedPatternInLabel', m.group(1))
419 418
                            if 'filename' in filename_result_pattern:
420
                                value['filename'] = string.replace(value['filename'], 'filename', value['filename_original'])
419
                                value['filename'] = value['filename'].replace('filename', value['filename_original'])
421 420
                    attachments.append(value)
422 421
        #
423 422
        # get other Maarch variables (letterbox configuration by default)
......
548 547
                        m = regexp_filename_search_pattern_in_label.match(field['label'])
549 548
                        if m:
550 549
                            value['filename_original'] = value['filename']
551
                            value['filename'] = string.replace(filename_result_pattern, 'searchedPatternInLabel',
550
                            value['filename'] = filename_result_pattern.replace('searchedPatternInLabel',
552 551
                                                               m.group(1))
553 552
                            if 'filename' in filename_result_pattern:
554
                                value['filename'] = string.replace(value['filename'], 'filename',
553
                                value['filename'] = value['filename'].replace('filename',
555 554
                                                                   value['filename_original'])
556 555
                    attachments.append(value)
557 556
                    value = '%s' % value['filename']
558
-