Commits

Andrew Godwin committed 73b97f5

Fixing #364 - stdout name not being allowed as valid.

  • Participants
  • Parent commits 62819d3

Comments (0)

Files changed (2)

File south/management/commands/datamigration.py

 
 import sys
 import os
+import re
 from optparse import make_option
 
 try:
         # --stdout means name = -
         if stdout:
             name = "-"
+	
+        # Only allow valid names
+        if re.search('[^_\w]', name) and name != "-":
+            self.error("Migration names should contain only alphanumeric characters and underscores.")
         
         # if not name, there's an error
         if not name:

File south/management/commands/schemamigration.py

         if stdout:
             name = "-"
 	
-	if re.search('[^_\w]', name):
-	    self.error("Migration names should contain only alphanumeric characters and underscores.")
+        # Only allow valid names
+        if re.search('[^_\w]', name) and name != "-":
+            self.error("Migration names should contain only alphanumeric characters and underscores.")
         
         # Make sure options are compatable
         if initial and (added_model_list or added_field_list or auto):