ProjectDjango/Project.py

changeset 96
8ecf7b5a134a
parent 94
85efbaa3f2e3
child 102
7e2351e4d729
diff -r e1033dff0bd8 -r 8ecf7b5a134a ProjectDjango/Project.py
--- a/ProjectDjango/Project.py	Fri Jan 20 19:03:48 2017 +0100
+++ b/ProjectDjango/Project.py	Tue Mar 28 19:24:25 2017 +0200
@@ -47,7 +47,7 @@
     """
     Class transforming the call arguments in case of gnome-terminal.
     """
-    def start(self, cmd, args=[], mode=QProcessPyQt.ReadWrite):
+    def start(self, cmd, args=None, mode=QProcessPyQt.ReadWrite):
         """
         Public method to start the given program (cmd) in a new process, if
         none is already running, passing the command line arguments in args.
@@ -56,6 +56,9 @@
         @keyparam args list of parameters (list of strings)
         @keyparam mode access mode (QIODevice.OpenMode)
         """
+        if args is None:
+            args = []
+        
         if cmd.endswith(('gnome-terminal', 'konsole', 'xfce4-terminal',
                          'mate-terminal')):
             if '-e' in args:
@@ -66,7 +69,7 @@
         super(QProcess, self).start(cmd, args, mode)
     
     @staticmethod
-    def startDetached(cmd, args=[], path=''):
+    def startDetached(cmd, args=None, path=''):
         """
         Public static method to start the given program (cmd) in a new process,
         if none is already running, passing the command line arguments in args.
@@ -76,6 +79,9 @@
         @keyparam path new working directory (string)
         @return tuple of successful start and process id (boolean, integer)
         """
+        if args is None:
+            args = []
+        
         if cmd.endswith(('gnome-terminal', 'konsole', 'xfce4-terminal',
                          'mate-terminal')):
             if '-e' in args:
@@ -1208,8 +1214,8 @@
         # environment variable not defined
         if path is not None:
             dirs = path.split(os.pathsep)
-            for dir in dirs:
-                exe = os.path.join(dir, file)
+            for directory in dirs:
+                exe = os.path.join(directory, file)
                 if os.access(exe, os.X_OK) and exe not in paths:
                     paths.append(exe)
         
@@ -2611,23 +2617,23 @@
         from .DjangoDumpdataDataDialog import DjangoDumpdataDataDialog
         dlg = DjangoDumpdataDataDialog(self, self.__ui)
         if dlg.exec_() == QDialog.Accepted:
-            appls, excls, format, indent = dlg.getData()
+            appls, excls, dumpFormat, indent = dlg.getData()
             
             args = []
             args.append(self.__getPythonExecutable())
             args.append("manage.py")
             args.append("dumpdata")
-            args.append("--format={0}".format(format))
+            args.append("--format={0}".format(dumpFormat))
             args.append("--indent={0}".format(indent))
             for excl in excls:
                 args.append("--exclude={0}".format(excl))
             args += appls
             
-            if format == "json":
+            if dumpFormat == "json":
                 fileFilters = self.tr("JSON Files (*.json)")
-            elif format == "xml":
+            elif dumpFormat == "xml":
                 fileFilters = self.tr("XML Files (*.xml)")
-            elif format == "yaml":
+            elif dumpFormat == "yaml":
                 fileFilters = self.tr("YAML Files (*.yaml)")
             
             dia = DjangoDialog(

eric ide

mercurial