X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils.py;h=81454d4435cbb188386499c2bb8bd2a23a165313;hb=f22f57084bb5a6c4b30cd2dfcd138c9976db7fbf;hp=43da83968a555de36fb77adbfdc1d0a236aa2612;hpb=7f688a39fbe2022378ae3db9019bb2e74de7621e;p=dak.git diff --git a/utils.py b/utils.py index 43da8396..81454d44 100644 --- a/utils.py +++ b/utils.py @@ -1,6 +1,6 @@ # Utility functions -# Copyright (C) 2000, 2001 James Troup -# $Id: utils.py,v 1.41 2002-04-21 15:39:06 troup Exp $ +# Copyright (C) 2000, 2001, 2002 James Troup +# $Id: utils.py,v 1.42 2002-05-08 11:13:44 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -379,10 +379,13 @@ def regex_safe (s): ###################################################################################### # Perform a substition of template -def TemplateSubst(Map,Template): - for x in Map.keys(): - Template = string.replace(Template,x,Map[x]); - return Template; +def TemplateSubst(map,filename): + file = open_file(filename); + template = file.read(); + for x in map.keys(): + template = string.replace(template,x,map[x]); + file.close(); + return template; ######################################################################################