1. edgewall
  2. Trac

Commits

jonas  committed 345c0ed

0.11-stable: Move the subprocess import into the backup functions to avoid avoid a py23 incompatibility. (#8412).

  • Participants
  • Parent commits 009c860
  • Branches 0.11-stable

Comments (0)

Files changed (2)

File trac/db/mysql_backend.py

View file
 # history and logs, available at http://trac.edgewall.org/log/.
 
 import re, sys, os, time
-from subprocess import Popen, PIPE
 
 from trac.core import *
 from trac.config import Option
                   self._collist(table, index.columns))
 
     def backup(self, dest_file):
+        try:
+            from subprocess import Popen, PIPE
+        except ImportError:
+            raise TracError('Python >= 2.4 or the subprocess module '
+                            'is required for pre-upgrade backup support')
         db_url = self.env.config.get('trac', 'database')
         scheme, db_prop = _parse_db_str(db_url)
         db_name = os.path.basename(db_prop['path'])

File trac/db/postgres_backend.py

View file
 # Author: Christopher Lenz <cmlenz@gmx.de>
 
 import re, sys, os, time
-from subprocess import Popen, PIPE
 
 from trac.core import *
 from trac.config import Option
                      '","'.join(index.columns))
 
     def backup(self, dest_file):
+        try:
+            from subprocess import Popen, PIPE
+        except ImportError:
+            raise TracError('Python >= 2.4 or the subprocess module '
+                            'is required for pre-upgrade backup support')
         db_url = self.env.config.get('trac', 'database')
         scheme, db_prop = _parse_db_str(db_url)
         db_prop.setdefault('params', {})