Permalink
Browse files

Prepare a pip project by creating the db model when it's created.

  • Loading branch information...
1 parent 5a2216f commit e66fe00205d4585bd2348e5b15e25737c15e2a56 Dusty Phillips committed Sep 6, 2010
Showing with 12 additions and 3 deletions.
  1. +11 −0 greatbigcrane/project/models.py
  2. +1 −3 greatbigcrane/project/views.py
@@ -75,6 +75,12 @@ def github_url(self):
url = ""
return url
+ def prep_project(self):
+ if self.project_type == "buildout":
+ self.prep_buildout_project()
+ elif self.project_type == "pip":
+ self.prep_pip_project()
+
def prep_buildout_project(self):
if not os.path.isdir(self.base_directory):
os.makedirs(self.base_directory)
@@ -86,6 +92,11 @@ def prep_buildout_project(self):
if not os.path.isfile(dest):
copyfile(source, dest)
+ def prep_pip_project(self):
+ if not os.path.isdir(self.base_directory):
+ os.makedirs(self.base_directory)
+ PipProject.objects.create(project=self)
+
def __unicode__(self):
return self.name
@@ -77,11 +77,9 @@ def add_project(request):
queue_job("GITCLONE", project_id=instance.id)
else:
instance = form.save()
+ instance.prep_project()
if instance.project_type == "buildout":
- instance.prep_buildout_project()
queue_job("BOOTSTRAP", project_id=instance.id)
- elif instance.project_type == "pip":
- PipProject.objects.create(project=instance)
return redirect(instance.get_absolute_url())

0 comments on commit e66fe00

Please sign in to comment.