Projet

Général

Profil

0001-deploy-do-not-overwrite-formdefs-if-the-site-directo.patch

Benjamin Dauvergne, 30 avril 2014 11:34

Télécharger (2,02 ko)

Voir les différences:

Subject: [PATCH] deploy: do not overwrite formdefs if the site directory
 already exists

 wcsinst/wcsinstd/deploy.py |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
wcsinst/wcsinstd/deploy.py
46 46
        self.collectivity_install_dir = os.path.join(app_settings.WCS_APP_DIR, coldir)
47 47

  
48 48
        if os.path.exists(self.collectivity_install_dir):
49
            # site exists, let's update it
50
            pass
51
            anew = False
49
            new = False
52 50
        else:
53
            anew = True
51
            new = True
54 52
            os.mkdir(self.collectivity_install_dir, 0755)
55 53

  
56
        z = zipfile.ZipFile(os.path.join(self.skel_dir, 'export.wcs'), 'r')
57

  
58
        os.umask(0022)
59
        for f in z.namelist():
60
            path = os.path.join(self.collectivity_install_dir, f)
61
            data = z.read(f)
62
            if not os.path.exists(os.path.dirname(path)):
63
                os.mkdir(os.path.dirname(path), 0755)
64
            if not f.endswith('/'):
65
                open(path, 'w').write(data)
66
        z.close()
54
        if new:
55
            z = zipfile.ZipFile(os.path.join(self.skel_dir, 'export.wcs'), 'r')
56

  
57
            os.umask(0022)
58
            for f in z.namelist():
59
                path = os.path.join(self.collectivity_install_dir, f)
60
                data = z.read(f)
61
                if not os.path.exists(os.path.dirname(path)):
62
                    os.mkdir(os.path.dirname(path), 0755)
63
                if not f.endswith('/'):
64
                    open(path, 'w').write(data)
65
            z.close()
67 66

  
68 67
        config_file = os.path.join(self.collectivity_install_dir, 'config.pck')
69 68
        if os.path.exists(config_file):
70
-