]> git.nothing2do.fr Git - get-hack-src.git/commitdiff
Added fix to avoid putting in .py extension in __init__.py as part of erroneous call...
authorallfro <ndouba@gmail.com>
Thu, 14 Feb 2013 01:04:00 +0000 (20:04 -0500)
committerallfro <ndouba@gmail.com>
Thu, 14 Feb 2013 01:04:00 +0000 (20:04 -0500)
src/canari/commands/create_transform.py

index 9e2c39eaf7ea005b851bb40b7b6711943043509a..95e28d1e9d5c03a58ef6548fdc4f4835e01f8e06 100644 (file)
@@ -58,9 +58,17 @@ def run(args):
     opts = parse_args(args)
 
     initf = path.join(opts.transform_dir, '__init__.py')
-    transform = opts.transform
+    transform = opts.transform if not opts.transform.endswith('.py') else opts.transform[:-3]
+
+    if '.' in transform:
+        print "Transform name (%s) cannot have a dot ('.')." % repr(transform)
+        exit(-1)
+    elif not transform:
+        print "You must specify a valid transform name."
+        exit(-1)
+
     directory = opts.transform_dir
-    transformf = path.join(directory, transform if transform.endswith('.py') else '%s.py' % transform )
+    transformf = path.join(directory, opts.transform if opts.transform.endswith('.py') else '%s.py' % opts.transform )
 
     if not path.exists(initf):
         print ('Directory %s does not appear to be a python package directory... quitting!' % repr(opts.transform_dir))