~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/browser/distroseries.py

[r=bac,
        julian-edwards][bug=862247] Initialization is not possible if the
        series has no publisher setup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
    LaunchpadDropdownWidget,
78
78
    LaunchpadRadioWidget,
79
79
    )
 
80
from lp.archivepublisher.interfaces.publisherconfig import IPublisherConfigSet
80
81
from lp.blueprints.browser.specificationtarget import (
81
82
    HasSpecificationsMenuMixin,
82
83
    )
758
759
    def submit(self, action, data):
759
760
        """Stub for the Javascript in the page to use."""
760
761
 
761
 
    @property
 
762
    @cachedproperty
762
763
    def is_derived_series_feature_enabled(self):
763
764
        return getFeatureFlag("soyuz.derived_series_ui.enabled") is not None
764
765
 
765
 
    @property
 
766
    @cachedproperty
766
767
    def show_derivation_not_yet_available(self):
767
768
        return not self.is_derived_series_feature_enabled
768
769
 
769
 
    @property
 
770
    @cachedproperty
770
771
    def show_derivation_form(self):
771
772
        return (
772
773
            self.is_derived_series_feature_enabled and
773
774
            not self.show_previous_series_empty_message and
774
 
            not self.context.isInitializing() and
775
 
            not self.context.isInitialized())
 
775
            not self.show_already_initializing_message and
 
776
            not self.show_already_initialized_message and
 
777
            not self.show_no_publisher_message
 
778
            )
776
779
 
777
 
    @property
 
780
    @cachedproperty
778
781
    def show_previous_series_empty_message(self):
779
782
        # There is a problem here:
780
783
        # The distribution already has initialized series and this
784
787
            self.context.distribution.has_published_sources and
785
788
            self.context.previous_series is None)
786
789
 
787
 
    @property
 
790
    @cachedproperty
788
791
    def show_already_initialized_message(self):
789
792
        return (
790
793
            self.is_derived_series_feature_enabled and
791
794
            self.context.isInitialized())
792
795
 
793
 
    @property
 
796
    @cachedproperty
794
797
    def show_already_initializing_message(self):
795
798
        return (
796
799
            self.is_derived_series_feature_enabled and
797
800
            self.context.isInitializing())
798
801
 
 
802
    @cachedproperty
 
803
    def show_no_publisher_message(self):
 
804
        distribution = self.context.distribution
 
805
        publisherconfigset = getUtility(IPublisherConfigSet)
 
806
        pub_config = publisherconfigset.getByDistribution(distribution)
 
807
        return (
 
808
            self.is_derived_series_feature_enabled and
 
809
            pub_config is None)
 
810
 
799
811
    @property
800
812
    def next_url(self):
801
813
        return canonical_url(self.context)