Exemplo n.º 1
0
    def __show_list(self, query):
        if c.beta:
            query = query.order_by(PlateSetup.id)
            beta_project = get_beta_project()
            validation_project = get_validation_project()
            query = query.filter(and_(PlateSetup.project_id.in_((beta_project.id, validation_project.id)),
                                      PlateSetup.completed == False,
                                      PlateSetup.donotrun != True))
        else:
            query = query.order_by('time_updated desc')
            beta_project = get_beta_project()
            validation_project = get_validation_project()
            query = query.filter(not_(PlateSetup.project_id.in_((beta_project.id, validation_project.id))))
        c.paginator = paginate.Page(
            query,
            page=int(request.params.get('page', 1)),
            items_per_page = 20
        )

        # decorate items
        for setup in c.paginator:
            myItems = json.loads(setup.setup or '{}')
            if  ( type( myItems ) is not list ): 
                setup.stage = self.__check_progress(myItems)
            else:
                setup.stage =  self.__check_progress({})
            #setup.stage = self.__check_progress(json.loads(setup.setup or '{}'))

        c.pager_kwargs = {}
        if hasattr(c, 'project_id'):
            c.pager_kwargs['project_id'] = c.project_id
        if hasattr(c, 'author_id'):
            c.pager_kwargs['author_id'] = c.author_id
        
        return render('/setup/list.html')
Exemplo n.º 2
0
 def new(self):
 	"""
     Like name, but invalidates the other ones
     """
     self.__load_context()
     c.next_url = url(controller='setup', action='create', beta=c.beta)
     c.name_form = self.__plate_setup_name_form()
     # take out beta test project id
     beta = get_beta_project()
     for tup in c.name_form.option['project_id']:
         if tup[0] == beta.id:
             c.name_form.option['project_id'].remove(tup)
             break
     return render('/setup/new.html')