Ejemplo n.º 1
0
 def load_module(self, module):
     """Load a child module"""
     value = self._value()
     if value == NOTSET:
         raise SettingNotSet("%s.%s", self.group.key, self.key)
     else:
         return load_module("%s.%s" % (value, module))
Ejemplo n.º 2
0
 def load_module(self, module):
     """Load a child module"""
     value = self._value()
     if value == NOTSET:
         raise SettingNotSet("%s.%s", self.group.key, self.key)
     else:
         return load_module("%s.%s" % (value, module))
Ejemplo n.º 3
0
def get_newsletter_module():
    try:
        modulename = config_value("NEWSLETTER", "MODULE")
    except AttributeError:
        modulename = "satchmo.newsletter.ignore"

    return load_module(modulename)
Ejemplo n.º 4
0
def shipping_methods():
    methods = []
    modules = config_value("SHIPPING", "MODULES")
    logger.debug("Getting shipping methods: %s", modules)
    for m in modules:
        module = load_module(m)
        methods.extend(module.get_methods())
    return methods
Ejemplo n.º 5
0
def shipping_methods():
    methods = []
    modules = config_value('SHIPPING', 'MODULES')
    log.debug('Getting shipping methods: %s', modules)
    for m in modules:
        module = load_module(m)
        methods.extend(module.get_methods())
    return methods
Ejemplo n.º 6
0
def shipping_methods():
    methods = []
    modules = config_value('SHIPPING', 'MODULES')
    logger.debug('Getting shipping methods: %s', modules)
    for m in modules:
        module = load_module(m)
        methods.extend(module.get_methods())
    return methods
Ejemplo n.º 7
0
        default=["satchmo.shipping.modules.per"],
        choices=[("satchmo.shipping.modules.per", _("Per piece"))],
    )
)

# --- Load default shipping modules.  Ignore import errors, user may have deleted them. ---
# DO NOT ADD 'tiered' or 'no' to this list.
# 'no' is used internally
# 'Tiered' is special, since it needs to be added as a module.  To enable it,
# just add satchmo.shipping.modules.tiered to your INSTALLED_APPS, you don't
# need to add it to CUSTOM_SHIPPING_MODULES either.
_default_modules = ("dummy", "fedex", "flat", "per", "ups", "usps", "royalmailcontract")

for module in _default_modules:
    try:
        load_module("satchmo.shipping.modules.%s.config" % module)
    except ImportError:
        logger.debug("Could not load default shipping module configuration: %s", module)

# --- Load any extra shipping modules. ---
extra_shipping = get_satchmo_setting("CUSTOM_SHIPPING_MODULES")

for extra in extra_shipping:
    try:
        load_module("%s.config" % extra)
    except ImportError:
        logger.warn("Could not load shipping module configuration: %s" % extra)


class ShippingModuleNotFound(Exception):
    def __init__(self, key):
Ejemplo n.º 8
0
        default="satchmo.tax.modules.no",
        choices=[("satchmo.tax.modules.no", _("No Tax"))],
    ))
DEFAULT_VIEW_TAX = config_register(
    BooleanValue(
        TAX_GROUP,
        "DEFAULT_VIEW_TAX",
        description=_("Show with tax included"),
        help_text=
        _("If yes, then all products and the cart will display with tax included."
          ),
        default=False,
    ))

# --- Load default tax modules.  Ignore import errors, user may have deleted them. ---
_default_modules = ("percent", "area")
for module in _default_modules:
    try:
        load_module("satchmo.tax.modules.%s.config" % module)
    except ImportError as ie:
        logger.debug("Could not load default tax module configuration: %s\n%s",
                     module, ie)

# --- Load any extra tax modules. ---
extra_tax = get_satchmo_setting("CUSTOM_TAX_MODULES")
for extra in extra_tax:
    try:
        load_module("%s.config" % extra)
    except ImportError:
        logger.warn("Could not load tax module configuration: %s" % extra)
Ejemplo n.º 9
0
def get_tax_processor(order=None, user=None):
    modulename = config_value('TAX','MODULE')
    mod = load_module(modulename + u'.tax')
    return mod.Processor(order=order,user=user)
Ejemplo n.º 10
0
    'MODULE',
    description=_("Active tax module"),
    help_text=_("Select a module, save and reload to set any module-specific settings."),
    default="satchmo.tax.modules.no",
    choices=[('satchmo.tax.modules.no', _('No Tax')),
    ]
))
DEFAULT_VIEW_TAX = config_register(BooleanValue(TAX_GROUP,
    'DEFAULT_VIEW_TAX',
    description=_("Show with tax included"),
    help_text=_("If yes, then all products and the cart will display with tax included."),
    default=False
))

# --- Load default tax modules.  Ignore import errors, user may have deleted them. ---
_default_modules = ('percent','area')
for module in _default_modules:
    try:
        load_module("satchmo.tax.modules.%s.config" % module)
    except ImportError, ie:
        log.debug('Could not load default tax module configuration: %s\n%s', module, ie)

    
# --- Load any extra tax modules. ---
extra_tax = get_satchmo_setting('CUSTOM_TAX_MODULES')
for extra in extra_tax:
    try:
        load_module("%s.config" % extra)
    except ImportError:
        log.warn('Could not load tax module configuration: %s' % extra)
Ejemplo n.º 11
0
def get_tax_processor(order=None, user=None):
    modulename = config_value("TAX", "MODULE")
    mod = load_module(modulename + ".tax")
    return mod.Processor(order=order, user=user)
Ejemplo n.º 12
0
def get_tax_processor(order=None, user=None):
    modulename = config_value('TAX', 'MODULE')
    mod = load_module(modulename + u'.tax')
    return mod.Processor(order=order, user=user)
Ejemplo n.º 13
0
        PRODUCT_GROUP,
        "IMAGE_DIR",
        description=_("Upload Image Dir"),
        help_text=_("""Directory name for storing uploaded images.
    This value will be appended to MEDIA_ROOT.  Do not worry about slashes.
    We can handle it any which way."""),
        default="images",
    ))

config_register(
    StringValue(
        PRODUCT_GROUP,
        "PROTECTED_DIR",
        description=_("Protected dir"),
        help_text=_("""This is only used if you use Downloadable Products.
This value will be appended to MEDIA_ROOT.  Do not worry about slashes.
We can handle it any which way."""),
        default="protected",
        requires=PRODUCT_TYPES,
        requiresvalue="product::DownloadableProduct",
    ))

# --- Load any extra product modules. ---
extra_product = get_satchmo_setting("CUSTOM_PRODUCT_MODULES")

for extra in extra_product:
    try:
        load_module("%s.config" % extra)
    except ImportError:
        logger.warn("Could not load product module configuration: %s" % extra)
Ejemplo n.º 14
0
 def to_python(self, value):
     if value == NOTSET:
         v = {}
     else:
         v = load_module(value)
     return v
Ejemplo n.º 15
0
    ),
    DecimalValue(
        PAYMENT_GROUP,
        "MINIMUM_ORDER",
        description=_("Minimum Order"),
        help_text=_("""The minimum cart total before checkout is allowed."""),
        default="0.00",
    ),
)

# --- Load default payment modules.  Ignore import errors. ---
_default_modules = ("dummy", "autosuccess", "ingenico", "paypal", "worldpay")

for module in _default_modules:
    try:
        load_module("satchmo.payment.modules.%s.config" % module)
    except ImportError as e:
        log.warning("Could not load default payment module configuration: %s", module)
        log.exception(e)

# --- Load any extra payment modules. ---
extra_payment = get_satchmo_setting("CUSTOM_PAYMENT_MODULES")

for extra in extra_payment:
    try:
        load_module("%s.config" % extra)
    except ImportError:
        log.warn("Could not load payment module configuration: %s" % extra)


# --- helper functions ---
Ejemplo n.º 16
0
config_register(
    StringValue(PRODUCT_GROUP,
        'IMAGE_DIR',
        description=_("Upload Image Dir"),
        help_text=_("""Directory name for storing uploaded images.
    This value will be appended to MEDIA_ROOT.  Do not worry about slashes.
    We can handle it any which way."""),
        default="images")
)

config_register(
    StringValue(PRODUCT_GROUP,
        'PROTECTED_DIR',
        description=_("Protected dir"),
        help_text=_("""This is only used if you use Downloadable Products.
This value will be appended to MEDIA_ROOT.  Do not worry about slashes.
We can handle it any which way."""),
        default="protected",
        requires=PRODUCT_TYPES,
        requiresvalue='product::DownloadableProduct')
)

# --- Load any extra product modules. ---
extra_product = get_satchmo_setting('CUSTOM_PRODUCT_MODULES')

for extra in extra_product:
    try:
        load_module("%s.config" % extra)
    except ImportError:
        log.warn('Could not load product module configuration: %s' % extra)
Ejemplo n.º 17
0
 def to_python(self, value):
     if value == NOTSET:
         v = {}            
     else:
         v = load_module(value)
     return v