Projet

Général

Profil

0001-deploy-use-str.format-instead-of-string.Template.patch

Benjamin Dauvergne, 04 novembre 2013 10:37

Télécharger (2,66 ko)

Voir les différences:

Subject: [PATCH] deploy: use str.format instead of string.Template

 wcsinst/wcsinstd/deploy.py |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
wcsinst/wcsinstd/deploy.py
1
import string
2 1
import cPickle
3 2
import os
4 3
import zipfile
......
153 152
            idff_metadata_template = file(
154 153
                    os.path.join(self.skel_dir, 'idff-metadata-template')).read()
155 154
            file(os.path.join(self.collectivity_install_dir, 'metadata.xml'), 'w').write(
156
                    string.Template(idff_metadata_template).substitute({'url': url_stripped}))
155
                    idff_metadata_template.format(url=url_stripped))
157 156

  
158 157
        if os.path.exists(os.path.join(self.skel_dir, 'saml2-metadata-template')):
159 158
            # there's a SAMLv2 metadata template, so we do the SAMLv2 stuff
......
167 166
            saml2_metadata_template = file(
168 167
                    os.path.join(self.skel_dir, 'saml2-metadata-template')).read()
169 168
            file(os.path.join(self.collectivity_install_dir, 'saml2-metadata.xml'), 'w').write(
170
                    string.Template(saml2_metadata_template).substitute({'url': url_stripped}))
169
                    saml2_metadata_template.format(url=url_stripped))
171 170

  
172 171
        if has_idff or has_saml2:
173 172
            idp_metadata = ET.parse(file(os.path.join(self.skel_dir, 'idp-metadata.xml')))
......
207 206
            return
208 207
        options_template = file(options_template_path).read()
209 208
        file(os.path.join(self.collectivity_install_dir, 'site-options.cfg'), 'w').write(
210
                string.Template(options_template).substitute({
211
                    'domain': self.domain, 
212
                    'options': self.site_options_cfg
213
                })
214
        )
209
                options_template.format(domain=self.domain,
210
                    options=self.site_options_cfg))
215 211

  
216 212

  
217 213
    def make_apache_vhost(self):
......
223 219
        if not os.path.exists(apache_dir):
224 220
            os.mkdir(apache_dir)
225 221
        file(os.path.join(apache_dir, '%s.conf' % self.domain), 'w').write(
226
                string.Template(apache_vhost_template).substitute({'domain': self.domain}))
222
                apache_vhost_template.format(domain=self.domain))
227 223

  
228 224

  
229 225
    def reload_apache(self):
230
-