~rashi007/mailman/docsfix

« back to all changes in this revision

Viewing changes to src/mailman/utilities/importer.py

  • Committer: Barry Warsaw
  • Date: 2014-11-08 15:27:56 UTC
  • mfrom: (7255 3.0)
  • mto: This revision was merged to the branch mainline in revision 7260.
  • Revision ID: barry@list.org-20141108152756-p37fhmb0z2dtl7hx
Trunk merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
308
308
        'digest_header': 'digest_header_uri',
309
309
        'digest_footer': 'digest_footer_uri',
310
310
        }
311
 
    # The best we can do is convert only the most common ones.
312
 
    convert_placeholders = {
313
 
        '%(real_name)s': '$display_name',
314
 
        '%(real_name)s@%(host_name)s': '$fqdn_listname',
315
 
        '%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s':
316
 
            '$listinfo_uri',
317
 
    }
 
311
    # The best we can do is convert only the most common ones.  These are
 
312
    # order dependent; the longer substitution with the common prefix must
 
313
    # show up earlier.
 
314
    convert_placeholders = [
 
315
        ('%(real_name)s@%(host_name)s', '$fqdn_listname'),
 
316
        ('%(real_name)s', '$display_name'),
 
317
        ('%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s',
 
318
         '$listinfo_uri'),
 
319
        ]
318
320
    # Collect defaults.
319
321
    defaults = {}
320
322
    for oldvar, newvar in convert_to_uri.items():
339
341
            continue
340
342
        text = config_dict[oldvar]
341
343
        text = text.decode('utf-8', 'replace')
342
 
        for oldph, newph in convert_placeholders.items():
 
344
        for oldph, newph in convert_placeholders:
343
345
            text = text.replace(oldph, newph)
344
346
        default_value, default_text  = defaults.get(newvar, (None, None))
345
347
        if not text and not (default_value or default_text):