Commits

Gregory Petukhov  committed 6bd7115

Fix bug: impossible to use empty string in replace option

  • Participants
  • Parent commits 194a301

Comments (0)

Files changed (1)

  • +3 -3
    sr
             regexp = re.compile(item)
             config.exclude_list.append(regexp)
 
-    if opts.filenames and opts.replace:
+    if opts.filenames and not opts.replace is None:
         parser.error('Options --filenames and --replace can\'t be used simultaneously')
 
     if opts.filenames:
         config.mode = 'file-types'
     else:
         if not opts.search:
-            if opts.replace:
+            if not opts.replace is None:
                 parser.error('Replace option could be specified only with search option')
             if not args:
                 parser.error('No options for search')
             else:
                 config.targets = ['']
 
-        if opts.replace:
+        if not opts.replace is None:
             config.replace = opts.replace
             config.mode = 'replace'