Commits

Lukasz Balcerzak  committed 6d61e50

Fixed little bug with setup_project signal

  • Participants
  • Parent commits ae10536

Comments (0)

Files changed (5)

 recursive-include docs/theme *
 
 recursive-include example_project *.py *.html
+recursive-exclude example_project/projects *.py *.html
 
 recursive-include projector *.py *.png *.gif *.html *.json
 recursive-include projector/locale *.mo *.po

File projector/forms.py

         instance = super(ProjectCreateForm, self).save(commit=False)
         if commit:
             instance.save()
-            if not self.instance.pk:
-                setup_project.send(sender=Project, instance=instance,
-                    vcs_alias=self.cleaned_data['vcs_alias'])
-                vcs_alias = self.cleaned_data['vcs_alias']
-                instance.set_vcs_alias(vcs_alias)
+            setup_project.send(sender=Project, instance=instance,
+                vcs_alias=self.cleaned_data.get('vcs_alias', None))
             for team in self.cleaned_data.get('teams', ()):
                 team.project = instance
                 team.save()

File projector/listeners.py

     PostgreSQL).
     """
     try:
-        if not kwargs.get('created', False):
-            # This listener is aimed for newly created projects only
-            return
-        if projector_settings.PROJECTS_ROOT_DIR:
-            iter = 0
-            while True:
-                try:
-                    if iter > 10:
-                        raise Exception("Couldn't run post-save project script "
-                                "(tried %s times)" % iter)
-                    else:
-                        iter += 1
-                    instance = Project.objects.get(pk=instance.pk)
-                    project_created_listener(sender, instance, **kwargs)
-                except Project.DoesNotExist:
-                    secs = 1
-                    logging.info("Sleeping for %s second(s) while waiting for "
-                                 " '%s' project to be persisted" %
-                                 (secs, instance))
-                    time.sleep(secs)
+        iter = 0
+        while True:
+            try:
+                if iter > 10:
+                    raise Exception("Couldn't run post-save project script "
+                            "(tried %s times)" % iter)
                 else:
-                    break
-        else:
-            logging.debug("PROJECTOR_PROJECTS_ROOT_DIR is not set so we do NOT "
-                "create repository for this project.")
+                    iter += 1
+                instance = Project.objects.get(pk=instance.pk)
+                project_setup_listener(sender, instance,
+                    vcs_alias=vcs_alias, workflow=workflow, **kwargs)
+            except Project.DoesNotExist:
+                secs = 1
+                logging.info("Sleeping for %s second(s) while waiting for "
+                             " '%s' project to be persisted" %
+                             (secs, instance))
+                time.sleep(secs)
+            else:
+                break
     except (MemoryError, KeyboardInterrupt):
         pass
     except Exception, err:

File projector/models.py

     def get_vcs_alias(self):
         """
         Returns vcs_alias which should be already configured for this project.
-        Defaulting to :setting:`PROJECTOR_DEFAULT_VCS_BACKEND`. If repository
-        is already set at this instance, :error:`ProjectorError` is raised as
-        this method should be used before or during repository creation process.
-        If repository is already set, retrieve vcs_alias directly from it.
+        Defaulting to :setting:`PROJECTOR_DEFAULT_VCS_BACKEND`.
         """
         if self.repository is not None:
-            raise ProjectorError("Cannot retrieve vcs_alias for project with "
-            "repository already set")
+            return self.repository.alias
         default = get_config_value('DEFAULT_VCS_BACKEND')
         vcs_alias = getattr(self, PROJECT_VCS_ALIAS_FIELD, default)
         return vcs_alias

File requirements.txt

 Django>=1.2
-Djalog==0.9.3
+Djalog>=0.9.4
 Pygments==1.3.1
-Sphinx==0.6.5
-Sphinx-PyPI-upload==0.2.1
-django-admin-tools==0.2.0
-django-attachments==0.3.1
+django-admin-tools==0.3.0
 django-autoslug>=1.4.1
-django-devserver==0.0.3
-django-extensions==0.4.1
+django-extensions==0.5
 django-guardian==0.1.0
 django-keyedcache==1.4-1
 django-filter==0.5.3
 django-registration==0.7
 django-signals-ahoy
 -e git+git://github.com/lukaszb/django-sorting.git#egg=django_sorting-forked
-django-tagging==0.3.1
 django-treebeard==1.61
-docutils==0.6
+docutils==0.7
 mercurial>=1.5
 wsgiref==0.1.2