Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fix custom base project path #50

Closed
vshjxyz opened this Issue · 0 comments

2 participants

Luca Del Bianco Patrick Altman
Luca Del Bianco

Hey,
I've tried to use pinax with a custom-made base project using this command inside my virtualenv :

$ pinax-admin setup_project -b ../path/to/custom/project newprojectname

Ending with this exception :

Traceback (most recent call last):
  File "/home/vash/workspace/test/droid/droidware/ortodellacultura/bin/pinax-admin", line 8, in <module>
    load_entry_point('Pinax==0.9b1.dev10', 'console_scripts', 'pinax-admin')()
  File "/home/vash/workspace/test/droid/droidware/ortodellacultura/lib/python2.6/site-packages/pinax/core/management/__init__.py", line 105, in execute_from_command_line
    runner.execute()
  File "/home/vash/workspace/test/droid/droidware/ortodellacultura/lib/python2.6/site-packages/pinax/core/management/__init__.py", line 94, in execute
    self.loader.load(command).run_from_argv(argv)
  File "/home/vash/workspace/test/droid/droidware/ortodellacultura/lib/python2.6/site-packages/pinax/core/management/base.py", line 45, in run_from_argv
    self.handle(*args, **options.__dict__)
  File "/home/vash/workspace/test/droid/droidware/ortodellacultura/lib/python2.6/site-packages/pinax/core/management/commands/setup_project.py", line 66, in handle
    self.setup_project(args[0], options["base"], options)
  File "/home/vash/workspace/test/droid/droidware/ortodellacultura/lib/python2.6/site-packages/pinax/core/management/commands/setup_project.py", line 130, in setup_project
    installer = ProjectInstaller(source, destination, project_name, user_project_name)
UnboundLocalError: local variable 'source' referenced before assignment

So I managed to get pinax working using :

# pinax/core/management/commands/setup_project.py (lines 112-127)

# check the base value (we could later be much smarter about it and
# allow repos and such)
if base in [p.replace("_project", "") for p in self.project_list()]:
    project_name = "%s_project" % base
    source = os.path.join(PROJECTS_DIR, project_name)
else:
    if not os.path.exists(base):
        raise CommandError(
            "Project template does not exist the given "
            "path: %s" % base
        )
    else:
        project_name = os.path.basename(base)
        source = base #just add this line

installer = ProjectInstaller(source, destination, project_name, user_project_name)

Basically in this particular case the source variable was not passed to the ProjectInstaller() method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.