Exemple #1
0
    def clean_site_packages(self):
        """
        Convert from SeoSite or network sites to a SitePackage.

        """
        sites = self.cleaned_data.get('site_packages')
        site_packages = []
        for site in sites:
            if not hasattr(site, 'site_package') or not site.site_package:
                # If a site doesn't already have a site_package specific
                # to it create one.
                package = SitePackage(name=site.domain)
                package.make_unique_for_site(site)
            site_packages.append(site.site_package)

        return site_packages
Exemple #2
0
    def clean_site_packages(self):
        """
        Convert from SeoSite or network sites to a SitePackage.

        """
        if self.cleaned_data.get('post_to') == 'network':
            company = self.cleaned_data.get('owner', self.company)
            if not hasattr(company,
                           'site_package') or not company.site_package:
                package = SitePackage()
                package.make_unique_for_company(company)
            site_packages = [company.site_package]
        else:
            sites = self.cleaned_data.get('site_packages')
            site_packages = []
            for site in sites:
                if not hasattr(site, 'site_package') or not site.site_package:
                    # If a site doesn't already have a site_package specific
                    # to it create one.
                    package = SitePackage(name=site.domain)
                    package.make_unique_for_site(site)
                site_packages.append(site.site_package)

        return site_packages
Exemple #3
0
    def clean_site_packages(self):
        """
        Convert from SeoSite or network sites to a SitePackage.

        """
        if self.cleaned_data.get("post_to") == "network":
            company = self.cleaned_data.get("owner", self.company)
            if not hasattr(company, "site_package") or not company.site_package:
                package = SitePackage()
                package.make_unique_for_company(company)
            site_packages = [company.site_package]
        else:
            sites = self.cleaned_data.get("site_packages")
            site_packages = []
            for site in sites:
                if not hasattr(site, "site_package") or not site.site_package:
                    # If a site doesn't already have a site_package specific
                    # to it create one.
                    package = SitePackage(name=site.domain)
                    package.make_unique_for_site(site)
                site_packages.append(site.site_package)

        return site_packages