Exemple #1
0
    def test_ens_get_denominacio(self):
        self.assertEqual(
            u"Amnistía Internacional", get_denominacio(Mock(title=u"Amnistía Internacional", acronim=None))
        )

        self.assertEqual(
            u"Amnistía Internacional (AÍ)", get_denominacio(Mock(title=u"Amnistía Internacional", acronim=u"AÍ"))
        )
Exemple #2
0
 def list_identificacio(self, search_filters=None):
     """
     List all the ens(s)' identification info.
     """
     identificacio = []
     for ens in self.list(search_filters):
         ens_obj = ens.getObject()
         identificacio.append(Identificacio(
             codi=ens_obj.codi or "-",
             denominacio=get_denominacio(ens_obj),
             absolute_url=ens_obj.absolute_url,
             nif=ens_obj.nif or "-",
             estat=ens_obj.estat or "-",
             figura_juridica=ens_obj.figura_juridica or "-",
             adscripcio=ens_obj.adscripcio or "-",
             percentatge_participacio=get_percentatge_participacio(ens_obj),
             aportacio=get_aportacio(ens_obj),
             quota=get_quota(ens_obj),
             etiquetes=ens_obj.etiquetes or "-",
             web=ens_obj.web or "-"))
     return identificacio
Exemple #3
0
 def list_representacio(self, is_historic=None, search_filters=None):
     """
     List all the ens(s) along with the carrec_upc(s) related to their
     organs, only for those ens(s) having at least one carrec_upc
     associated. Return a list of Representacio objects where the elements
     are sorted alphabetically by (1st) ens.title, (2nd) organ.title and
     (3rd) carrec.carrec.
     """
     representacio = []
     for ens in self.list(search_filters):
         ens_obj = ens.getObject()
         for organ_tipus in ('Govern', 'Assessor'):
             for organ in self.list_organs_by_ens(ens, organ_tipus):
                 for carrec in self.list_carrecs_upc_by_organ(organ, False):
                     carrec_obj = carrec.getObject()
                     representacio.append(Representacio(
                         denominacio=get_denominacio(ens_obj),
                         absolute_url=ens_obj.absolute_url,
                         organ=organ.Title.decode('utf-8'),
                         persona=carrec_obj.title,
                         carrec=carrec_obj.carrec,
                         data_nomenament=carrec_obj.data_inici and
                         carrec_obj.data_inici.strftime('%d/%m/%Y') or "-"))
     return representacio