[Bug 788309] [NEW] Site configuration customization unnecessarily stored in tree
Public bug reported: The i18n templates for site customization are specified to be in <template_dir>/site/ etc., a part of the tree, rather than being placed in <var_dir> (outside the tree) Solution, move them to <var_dir>/templates/site/ ** Affects: mailman Importance: Undecided Status: New ** Tags: mailman3 -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/788309 Title: Site configuration customization unnecessarily stored in tree
** Patch added: "Patch i18n.py to move site template location." https://bugs.launchpad.net/bugs/788309/+attachment/2142692/+files/i18n_patch... -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/788309 Title: Site configuration customization unnecessarily stored in tree
I changed the subject of this bug because actually I think it's fine for the in-tree site templates to still be searched, just that if the template exists in $var_dir, it should override. And this should be true of the domain templates as well. Thanks for the patch, and the bug report. Perhaps you'd like to refine the patch to match the new description? Also, if you could include unittests that would be great. ** Summary changed: - Site configuration customization unnecessarily stored in tree + Site template search should look in var_dir ** Summary changed: - Site template search should look in var_dir + Allow $var_dir templates to override in-tree templates ** Description changed: - The i18n templates for site customization are specified to be in - <template_dir>/site/ etc., a part of the tree, rather than being placed - in <var_dir> (outside the tree) - - Solution, move them to <var_dir>/templates/site/ + mailman.utilities.i18n.find()'s search algorithm only allows for list- + specific templates in $var_dir. The search algorithm should be extended + so that any of the domain, site, and language templates may be + overridden by $var_dir templates. It can still fallback to in-tree + templates if the $var_dir version is missing. ** Changed in: mailman Status: New => Confirmed ** Changed in: mailman Importance: Undecided => Medium ** Changed in: mailman Importance: Medium => Wishlist -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/788309 Title: Allow $var_dir templates to override in-tree templates
From the NEWS file:
* Major redesign of the template search system, fixing LP: #788309. $var_dir is now used when search for all template overrides, site, domain, or mailing list. The in-tree English templates are used only as a last fallback. ** Changed in: mailman Assignee: (unassigned) => Barry Warsaw (barry) ** Changed in: mailman Milestone: None => 3.0.0b1 ** Changed in: mailman Status: Confirmed => In Progress -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/788309 Title: Allow $var_dir templates to override in-tree templates To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/788309/+subscriptions
def search(template_file, mlist=None, language=None): """Generator that provides file system search order. This is Mailman's internal template search algorithm. The first locations searched are within the $var_dir/templates directory, allowing a site to override a template for a specific mailing list, all the mailing lists in a domain, or site-wide. The <language> path component is variable, and described below. * The list-specific language directory <var_dir>/templates/lists/<mlist.fqdn_listname>/<language> * The domain-specific language directory <var_dir>/templates/domains/<mlist.mail_host>/<language> * The site-wide language directory <var_dir>/templates/site/<language> The <language> path component is calculated as follows, in this order: * The `language` parameter if given * `mlist.preferred_language` if given * The server's default language * English ('en') Languages are iterated after each of the four locations are searched. So for example, when searching for the 'foo.txt' template, where the server's default language is 'fr', the mailing list's (test@example.com) language is 'de' and the `language` parameter is 'it', these locations are searched in order: * <var_dir>/templates/lists/test@example.com/it/foo.txt * <var_dir>/templates/domains/example.com/it/foo.txt * <var_dir>/templates/site/it/foo.txt * <var_dir>/templates/lists/test@example.com/de/foo.txt * <var_dir>/templates/domains/example.com/de/foo.txt * <var_dir>/templates/site/de/foo.txt * <var_dir>/templates/lists/test@example.com/fr/foo.txt * <var_dir>/templates/domains/example.com/fr/foo.txt * <var_dir>/templates/site/fr/foo.txt * <var_dir>/templates/lists/test@example.com/en/foo.txt * <var_dir>/templates/domains/example.com/en/foo.txt * <var_dir>/templates/site/en/foo.txt After all those paths are searched, the final fallback is the English template within the Mailman source tree. * <source_dir>/templates/en/foo.txt """ ** Changed in: mailman Status: In Progress => Fix Committed -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/788309 Title: Allow $var_dir templates to override in-tree templates To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/788309/+subscriptions
** Changed in: mailman Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/788309 Title: Allow $var_dir templates to override in-tree templates To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/788309/+subscriptions
participants (2)
-
Barry Warsaw
-
Richard Wackerbarth