Exemplo n.º 1
0
    def handle(self, *args, **options):

        if len(args) == 0:
            varnishutil.purge_urls([
                reverse('index'),
                reverse('projects'),
                reverse('help')])

            # Ban all project pages
            varnishutil.ban_cache_groups(Project)
        else:
            # Ban all given cache groups

            varnishutil.ban_cache_groups(list(args))
Exemplo n.º 2
0
    def handle(self, *args, **options):

        if len(args) == 0:
            varnishutil.purge_urls(
                [reverse('index'),
                 reverse('projects'),
                 reverse('help')])

            # Ban all project pages
            varnishutil.ban_cache_groups(Project)
        else:
            # Ban all given cache groups

            varnishutil.ban_cache_groups(list(args))
Exemplo n.º 3
0
    def handle(self, *args, **options):

        changed = False
        for project in Project.objects.filter(deleted = False):

            #repo = get_repo(project.username, project.repository)

            #if(repo and 'description' in repo and
            #        repo['description']):
            #    project.description = repo['description']
            #
            #    self.stdout.write(str(project) + ': ' +\
            #            project.description)
            #else:
            #    self.stdout.write('No description found: ' + str(project))


            # Check for Cargo.toml in root of project

            headers = {
                'User-Agent': 'Rust CI'
            }

            url = 'https://api.github.com/repos/%s/%s/contents/Cargo.toml?client_id=%s&client_secret=%s' \
                    % (project.username, project.repository, private_settings.GITHUB_CLIENT_ID,
                            private_settings.GITHUB_CLIENT_SECRET)
            req = urllib2.Request(url, headers = headers)

            try:
                response = urllib2.urlopen(req)

                if project.cargo_support == False:
                    changed = True
                    # Cargo.toml added, ban all project pages
                    varnishutil.ban_cache_groups(Project)

                project.cargo_support = True
                self.stdout.write('Found Cargo.toml: ' + str(project))
            except URLError, e:                
                self.stdout.write('No Cargo.toml found: ' +\
                        str(project) + ' ' + str(e.code))
                #if e.code == 404:
                #    project.cargo_support = False
            
            project.save()
Exemplo n.º 4
0
    def handle(self, *args, **options):

        changed = False
        for project in Project.objects.filter(deleted=False):

            #repo = get_repo(project.username, project.repository)

            #if(repo and 'description' in repo and
            #        repo['description']):
            #    project.description = repo['description']
            #
            #    self.stdout.write(str(project) + ': ' +\
            #            project.description)
            #else:
            #    self.stdout.write('No description found: ' + str(project))

            # Check for Cargo.toml in root of project

            headers = {'User-Agent': 'Rust CI'}

            url = 'https://api.github.com/repos/%s/%s/contents/Cargo.toml?client_id=%s&client_secret=%s' \
                    % (project.username, project.repository, private_settings.GITHUB_CLIENT_ID,
                            private_settings.GITHUB_CLIENT_SECRET)
            req = urllib2.Request(url, headers=headers)

            try:
                response = urllib2.urlopen(req)

                if project.cargo_support == False:
                    changed = True
                    # Cargo.toml added, ban all project pages
                    varnishutil.ban_cache_groups(Project)

                project.cargo_support = True
                self.stdout.write('Found Cargo.toml: ' + str(project))
            except URLError, e:
                self.stdout.write('No Cargo.toml found: ' +\
                        str(project) + ' ' + str(e.code))
                #if e.code == 404:
                #    project.cargo_support = False

            project.save()
Exemplo n.º 5
0
def project_docs_handler(sender, instance, **kwargs):
    # Ban all project docs from varnish
    varnishutil.ban_cache_groups(instance.get_cache_groups())
Exemplo n.º 6
0
def project_docs_handler(sender, instance, **kwargs):
    # Ban all project docs from varnish
    varnishutil.ban_cache_groups(instance.get_cache_groups())