示例#1
0
 def get_default(self):
     """Convenience method to get the default currency"""
     code, name = config_choice_values('CURRENCIES','CURRENCY_DEAULT')[0]
     try:
         return self.get(currency__iso3_code = code, active=True)
     except Currency.DoesNotExist:
         log.error('is not set default currency')
示例#2
0
文件: __init__.py 项目: tcv1/satchmo
def get_methods():
  '''
    Fires off shipper.Shipper() for each choice that's
    enabled in /settings/
  '''

  return [shipper.Shipper(service_type=value) for value in config_choice_values('shipping.modules.canadapost', 'CANADAPOST_SHIPPING_CHOICES')]
示例#3
0
def get_methods():
    settings = config_get_group('shipping.modules.fedex_web_services')
    if not settings.ACCOUNT.value:
        log.warn("No fedex account found in settings")
        return

    if not settings.METER_NUMBER.value:
        log.warn("No fedex meter number found in settings")
        return

    if not settings.AUTHENTICATION_KEY.value:
        log.warn("No fedex authentication key found in settings")
        return

    if not settings.AUTHENTICATION_PASSWORD.value:
        log.warn("No fedex authentication password found in settings")
        return
        
    CONFIG_OBJ = get_config_obj(settings)
    packaging = settings.PACKAGING.value or "YOUR_PACKAGING"
    default_weight = settings.DEFAULT_ITEM_WEIGHT.value or 0.5
    default_weight_units = settings.DEFAULT_WEIGHT_UNITS.value
    single_box = settings.SINGLE_BOX.value
    verbose_log = settings.VERBOSE_LOG.value
    dropoff_type = settings.DROPOFF_TYPE.value

    return [
        shipper.Shipper(
            service_type=value, config=CONFIG_OBJ, packaging=packaging,
            default_weight=default_weight, default_weight_units=default_weight_units,
            single_box=single_box, verbose_log=verbose_log,
            dropoff_type=dropoff_type)
        for value in config_choice_values(
            'shipping.modules.fedex_web_services', 'SHIPPING_CHOICES')
        ]
示例#4
0
def get_methods():
    settings = config_get_group('shipping.modules.fedex_web_services')
    if not settings.ACCOUNT.value:
        log.warn("No fedex account found in settings")
        return

    if not settings.METER_NUMBER.value:
        log.warn("No fedex meter number found in settings")
        return

    if not settings.AUTHENTICATION_KEY.value:
        log.warn("No fedex authentication key found in settings")
        return

    if not settings.AUTHENTICATION_PASSWORD.value:
        log.warn("No fedex authentication password found in settings")
        return

    CONFIG_OBJ = get_config_obj(settings)
    packaging = settings.PACKAGING.value or "YOUR_PACKAGING"
    default_weight = settings.DEFAULT_ITEM_WEIGHT.value or 0.5
    default_weight_units = settings.DEFAULT_WEIGHT_UNITS.value
    single_box = settings.SINGLE_BOX.value
    verbose_log = settings.VERBOSE_LOG.value
    dropoff_type = settings.DROPOFF_TYPE.value

    return [
        shipper.Shipper(service_type=value,
                        config=CONFIG_OBJ,
                        packaging=packaging,
                        default_weight=default_weight,
                        default_weight_units=default_weight_units,
                        single_box=single_box,
                        verbose_log=verbose_log,
                        dropoff_type=dropoff_type)
        for value in config_choice_values(
            'shipping.modules.fedex_web_services', 'SHIPPING_CHOICES')
    ]
示例#5
0
def satchmo_language_selection_form():
    """
    Display the set language form, if enabled in shop settings.
    """
    enabled = config_value('LANGUAGE', 'ALLOW_TRANSLATION')
    languages = []
    if enabled:
        try:
            url = urlresolvers.reverse('satchmo_set_language')
            languages = config_choice_values('LANGUAGE', 'LANGUAGES_AVAILABLE')
            
        except urlresolvers.NoReverseMatch:
            url = ""
            log.warning('No url found for satchmo_set_language (OK if running tests)')

    else:
        url = ""
        
    return {
        'enabled' : enabled,
        'set_language_url' : url,
        'languages' : languages,
    }
示例#6
0
def get_methods():
    return [
        shipper.Shipper(service_type=value) for value in config_choice_values("satchmo_indiapost", "SHIPPING_CHOICES")
    ]
示例#7
0
def shipping_choices():
    try:
        return config_choice_values('SHIPPING','MODULES')
    except SettingNotSet:
        return ()
def get_shipping_choices(free_shipping=False):
    if free_shipping:
        return config_choice_values(CONFIG_KEY, 'FREE_SHIPPING_CHOICE')

    return config_choice_values(CONFIG_KEY, 'SHIPPING_CHOICES')
示例#9
0
文件: fields.py 项目: kidaa30/pops
def shipping_choices():
    try:
        return config_choice_values("SHIPPING", "MODULES")
    except SettingNotSet:
        return ()
示例#10
0
def get_methods():
    return [
        shipper.Shipper(service_type=value) for value in config_choice_values(
            'satchmo_indiapost', 'SHIPPING_CHOICES')
    ]
示例#11
0
文件: __init__.py 项目: 34/T
def get_methods():
    return [shipper.Shipper(service_type=value) for value in config_choice_values('shipping.modules.usps', 'USPS_SHIPPING_CHOICES')]
示例#12
0
文件: __init__.py 项目: tcv1/satchmo
def get_methods():
    return [shipper.Shipper(service_type=value) for value in config_choice_values('shipping.modules.ups', 'UPS_SHIPPING_CHOICES')]
    
示例#13
0
文件: fields.py 项目: 34/T
def shipping_choices():
    try:
        return config_choice_values('SHIPPING','MODULES')
    except SettingNotSet:
        return ()
示例#14
0
def get_shipping_choices(free_shipping=False):
    if free_shipping:
        return config_choice_values(CONFIG_KEY, 'FREE_SHIPPING_CHOICE')

    return config_choice_values(CONFIG_KEY, 'SHIPPING_CHOICES')