Exemple #1
0
    def test_ens_get_quota(self):
        self.assertEqual("-", get_quota(Mock(quota_sn=None)))

        self.assertEqual(_(u"No"), get_quota(Mock(quota_sn=False)))

        self.assertEqual(_(u"Sí"), get_quota(Mock(quota_sn=True, quota_import=None)))

        self.assertEqual(_(u"2.00"), get_quota(Mock(quota_sn=True, quota_import=2, quota_moneda=None)))

        self.assertEqual(u"2.00 €/any", get_quota(Mock(quota_sn=True, quota_import=2, quota_moneda=u"€/any")))

        self.assertEqual(u"2.35 €/any", get_quota(Mock(quota_sn=True, quota_import=2.35, quota_moneda=u"€/any")))
Exemple #2
0
def get_capital_social(ens):
    if ens.capital_social_sn is None:
        return "-"
    elif not ens.capital_social_sn:
        return _(u"No")
    else:
        if ens.capital_social_import:
            moneda = "" if ens.capital_social_moneda is None \
                else " " + ens.capital_social_moneda.encode("utf-8")
            return "{0:,.2f}{1}".format(
                ens.capital_social_import, moneda).decode('utf-8')
        else:
            return _(u"Sí")
Exemple #3
0
    def test_ens_get_aportacio(self):
        self.assertEqual("-", get_aportacio(Mock(aportacio_sn=None)))

        self.assertEqual(_(u"No"), get_aportacio(Mock(aportacio_sn=False)))

        self.assertEqual(_(u"Sí"), get_aportacio(Mock(aportacio_sn=True, aportacio_import=None)))

        self.assertEqual(_(u"2.00"), get_aportacio(Mock(aportacio_sn=True, aportacio_import=2, aportacio_moneda=None)))

        self.assertEqual(
            u"2.00 €/any", get_aportacio(Mock(aportacio_sn=True, aportacio_import=2, aportacio_moneda=u"€/any"))
        )

        self.assertEqual(
            u"2.35 €/any", get_aportacio(Mock(aportacio_sn=True, aportacio_import=2.35, aportacio_moneda=u"€/any"))
        )
Exemple #4
0
 def handleSave(self, action):
     data, errors = self.extractData()
     if errors:
         self.status = self.formErrorsMessage
         return
     self.fix_password_fields(data)
     self.applyChanges(data)
     IStatusMessage(self.request).addStatusMessage(
         _(u'Changes saved'), 'info')
     self.context.REQUEST.RESPONSE.redirect('@@ens-settings')
Exemple #5
0
    def test_ens_get_capital_social(self):
        self.assertEqual("-", get_capital_social(Mock(capital_social_sn=None)))

        self.assertEqual(_(u"No"), get_capital_social(Mock(capital_social_sn=False)))

        self.assertEqual(_(u"Sí"), get_capital_social(Mock(capital_social_sn=True, capital_social_import=None)))

        self.assertEqual(
            _(u"2.00"),
            get_capital_social(Mock(capital_social_sn=True, capital_social_import=2, capital_social_moneda=None)),
        )

        self.assertEqual(
            u"2.00 €/any",
            get_capital_social(Mock(capital_social_sn=True, capital_social_import=2, capital_social_moneda=u"€/any")),
        )

        self.assertEqual(
            u"2.35 €/any",
            get_capital_social(
                Mock(capital_social_sn=True, capital_social_import=2.35, capital_social_moneda=u"€/any")
            ),
        )
Exemple #6
0
 def estat_vocabulary(self):
     return [('', _(u"Qualsevol"))] + [
         (value, value) for value in ens.estat_values]
Exemple #7
0
 def figura_juridica_vocabulary(self):
     return [('', _(u"Qualsevol"))] + [
         (value, value) for value in ens.figura_juridica_values]
Exemple #8
0
 def prettify_organ_title(self, organ):
     return "{0}{1}".format(
         organ.Title,
         _(u" (Històric)").encode('utf-8') if organ.is_historic else u"")
Exemple #9
0
 def handleCancel(self, action):
     IStatusMessage(self.request).addStatusMessage(
         _(u'Edit cancelled'), 'info')
     self.request.response.redirect(
         '%s/%s' % (self.context.absolute_url(), self.control_panel_view))
Exemple #10
0
 def get_vocabulary(values):
     return SimpleVocabulary([
         SimpleTerm(title=_(value), value=value, token=token)
         for token, value in enumerate(values)])
Exemple #11
0
def title_constraint(value):
    if value in ("consell-de-direccio", "altres"):
        raise Invalid(_(u"Cal que introduïu cognoms i nom"))
    return True