Example #1
0
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')]
Example #2
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')
        ]
Example #3
0
    def testChoiceValues(self):
        self.g1c1.update([1, 2])

        self.assertEqual(self.g1c1.value, [1, 2])
        self.assertEqual(self.g1c1.choice_values, [(1, 'one'), (2, 'two')])

        choices = config_choice_values('m1', 'c1')
        self.assertEqual(choices, [(1, 'one'), (2, 'two')])
Example #4
0
    def testChoiceValues(self):
        self.g1c1.update([1, 2])

        self.assertEqual(self.g1c1.value, [1, 2])
        self.assertEqual(self.g1c1.choice_values, [(1, 'one'), (2, 'two')])

        choices = config_choice_values('m1', 'c1')
        self.assertEqual(choices, [(1, 'one'), (2, 'two')])
Example #5
0
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')
    ]
Example #6
0
def credit_choices(settings=None, include_module_if_no_choices=False):
    choices = []
    keys = []
    for module, group in active_gateways():
        vals = config_choice_values(group, 'CREDITCHOICES')
        for key, label in vals:
            if not key in keys:
                keys.append(key)
                pair = (key, ugettext(label))
                choices.append(pair)
        if include_module_if_no_choices and not vals:
            key = config_value(group, 'KEY')
            label = config_value(group, 'LABEL')
            pair = (key, ugettext(label))
            choices.append(pair)
    return choices
Example #7
0
def credit_choices(settings=None, include_module_if_no_choices=False):
    choices = []
    keys = []
    for module, group in active_gateways():
        vals = config_choice_values(group, 'CREDITCHOICES')
        for key, label in vals:
            if not key in keys:
                keys.append(key)
                pair = (key, ugettext(label))
                choices.append(pair)
        if include_module_if_no_choices and not vals:
            key = config_value(group, 'KEY')
            label = config_value(group, 'LABEL')
            pair = (key, ugettext(label))
            choices.append(pair)
    return choices
Example #8
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')
    ]
Example #9
0
def get_methods():
    return [shipper.Shipper(service_type=value) for value in config_choice_values('shipping.modules.ups', 'UPS_SHIPPING_CHOICES')]
    
def get_methods():
    import shipper
    return [
        shipper.Shipper(service_type=value) for value in config_choice_values(
            'canada_post_dp_shipping', 'SHIPPING_CHOICES')
    ]
Example #11
0
def get_methods():
    return [shipper.Shipper(service_type=value)
            for value in config_choice_values('canada_post_dp_shipping',
                                              'SHIPPING_CHOICES')]
Example #12
0
def shipping_choices():
    try:
        return config_choice_values('SHIPPING','MODULES')
    except SettingNotSet:
        return ()
Example #13
0
def get_methods():
    return [
        shipper.Shipper(service_type=value) for value in config_choice_values(
            'shipping.modules.usps', 'USPS_SHIPPING_CHOICES')
    ]