コード例 #1
0
 def validate_city(value):
     city_l10n = get_l10n_field('city')
     state = sysparam.get_string('STATE_SUGGESTED')
     country = sysparam.get_string('COUNTRY_SUGGESTED')
     if not city_l10n.validate(value, state=state, country=country):
         return ValidationError(_("'%s' is not a valid %s.") %
                                (value, city_l10n.label.lower()))
コード例 #2
0
ファイル: parameters.py プロジェクト: sarkis89/stoq
 def validate_city(value):
     city_l10n = get_l10n_field('city')
     state = sysparam.get_string('STATE_SUGGESTED')
     country = sysparam.get_string('COUNTRY_SUGGESTED')
     if not city_l10n.validate(value, state=state, country=country):
         return ValidationError(_("'%s' is not a valid %s.") %
                                (value, city_l10n.label.lower()))
コード例 #3
0
ファイル: parameters.py プロジェクト: esosaja/stoq
 def validate_state(value):
     state_l10n = get_l10n_field('state')
     if not state_l10n.validate(value):
         return ValidationError(
             _("'%s' is not a valid %s.") % (
                 value,
                 state_l10n.label.lower(),
             ))
コード例 #4
0
 def validate_city(value):
     default_store = get_default_store()
     city_l10n = get_l10n_field(default_store, 'city')
     state = sysparam(default_store).STATE_SUGGESTED
     country = sysparam(default_store).COUNTRY_SUGGESTED
     if not city_l10n.validate(value, state=state, country=country):
         return ValidationError(_("'%s' is not a valid %s.") %
                                (value, city_l10n.label.lower()))
コード例 #5
0
ファイル: formatters.py プロジェクト: sarkis89/stoq
def get_full_date(date):
    """Return a date in it's full format taking l10n in consideration

    For example, for Brazil, it will return something like:
      01 de janeiro de 2012
    In the generic case, it will return something like:
      January 01, 2012

    """
    full_date_format = get_l10n_field("full_date_format")
    return date.strftime(full_date_format)
コード例 #6
0
ファイル: formatters.py プロジェクト: hackedbellini/stoq
def get_full_date(date):
    """Return a date in it's full format taking l10n in consideration

    For example, for Brazil, it will return something like:
      01 de janeiro de 2012
    In the generic case, it will return something like:
      January 01, 2012

    """
    full_date_format = get_l10n_field("full_date_format")
    return date.strftime(full_date_format)
コード例 #7
0
def test_api():
    store = api.get_default_store()

    assert store is get_default_store()
    assert api.get_current_user(store) is get_current_user(store)
    assert api.db_settings is db_settings
    assert api.user_settings is get_settings()
    assert isinstance(api.device_manager, DeviceManager)
    with pytest.raises(NotImplementedError):
        assert isinstance(api.config, IStoqConfig)
    assert api.is_developer_mode() is is_developer_mode()
    assert api.get_l10n_field('CPF') is get_l10n_field('CPF')
コード例 #8
0
 def is_valid_model(self):
     city_l10n = get_l10n_field('city', self.country)
     return bool(self.country and self.city and self.state
                 and city_l10n.validate(
                     self.city, state=self.state, country=self.country))
コード例 #9
0
ファイル: api.py プロジェクト: adrianoaguiar/stoq
 def get_l10n_field(self, field_name, country=None):
     return get_l10n_field(field_name, country=country)
コード例 #10
0
ファイル: formatters.py プロジェクト: tmaxter/stoq
def get_price_as_cardinal(value):
    function = get_cardinal_function('to_words_as_money')
    currency_names = get_l10n_field(get_default_store(),
                                    'currency_names')
    return function(value, currency_names)
コード例 #11
0
ファイル: parameters.py プロジェクト: rosalin/stoq
 def validate_state(value):
     state_l10n = get_l10n_field(get_default_store(), 'state')
     if not state_l10n.validate(value):
         return ValidationError(
             _("'%s' is not a valid %s.")
             % (value, state_l10n.label.lower(), ))
コード例 #12
0
ファイル: api.py プロジェクト: sarkis89/stoq
 def get_l10n_field(self, field_name, country=None):
     return get_l10n_field(field_name, country=country)
コード例 #13
0
ファイル: address.py プロジェクト: rosalin/stoq
 def is_valid_model(self):
     city_l10n = get_l10n_field(self.store, 'city', self.country)
     return bool(self.country and self.city and self.state and
                 city_l10n.validate(self.city,
                                    state=self.state, country=self.country))
コード例 #14
0
 def validate_state(value):
     state_l10n = get_l10n_field("state")
     if not state_l10n.validate(value):
         return ValidationError(_("'%s' is not a valid %s.") % (value, state_l10n.label.lower()))