Пример #1
0
    def setUp(self):
        # clear out cache from previous runs
        caching.cache_delete()

        g1 = ConfigurationGroup("req2", "Requirements 2", ordering=1000)

        self.g1 = g1

        choices1 = config_register(
            MultipleStringValue(SHOP_GROUP, "rc1", ordering=1))

        self.g1c1 = config_register(
            IntegerValue(g1, "c1", requires=choices1, ordering=3))
        self.g1c2 = config_register(
            IntegerValue(g1, "c2", requires=choices1, ordering=4))
        self.g1c3 = config_register(IntegerValue(g1, "c3", ordering=5))

        choices1.update("c1")

        g2 = ConfigurationGroup("req3", "Requirements 3", ordering=1000)

        self.g2 = g2

        choices2 = config_register(
            StringValue(SHOP_GROUP, "choices2", ordering=1))

        self.g2c1 = config_register(
            IntegerValue(g2, "c1", requires=choices2, ordering=3))
        self.g2c2 = config_register(
            IntegerValue(g2, "c2", requires=choices2, ordering=4))
        self.g2c3 = config_register(
            IntegerValue(g2, "c3", requires=choices2, ordering=5))

        choices2.update("c1")
Пример #2
0
    def setUp(self):
        # clear out cache from previous runs
        caching.cache_delete()

        g1 = ConfigurationGroup("reqval", "Requirements 3", ordering=1000)

        self.g1 = g1

        choices1 = config_register(
            MultipleStringValue(SHOP_GROUP, "valchoices", ordering=1))

        self.g1c1 = config_register(
            IntegerValue(g1,
                         "c1",
                         requires=choices1,
                         requiresvalue="foo",
                         ordering=3))
        self.g1c2 = config_register(
            IntegerValue(g1,
                         "c2",
                         requires=choices1,
                         requiresvalue="bar",
                         ordering=4))
        self.g1c3 = config_register(IntegerValue(g1, "c3", ordering=5))

        choices1.update("foo")

        g2 = ConfigurationGroup("reqval2", "Requirements 4", ordering=1000)

        self.g2 = g2

        choices2 = config_register(
            StringValue(
                SHOP_GROUP,
                "valchoices2",
                ordering=1,
                choices=(("a", "test a"), ("b", "test b"), ("c", "test c")),
            ))

        self.g2c1 = config_register(
            IntegerValue(g2,
                         "c1",
                         requires=choices2,
                         requiresvalue="a",
                         ordering=3))
        self.g2c2 = config_register(
            IntegerValue(g2,
                         "c2",
                         requires=choices2,
                         requiresvalue="b",
                         ordering=4))
        self.g2c3 = config_register(
            IntegerValue(g2,
                         "c3",
                         requires=choices2,
                         requiresvalue="c",
                         ordering=5))

        choices2.update("a")
Пример #3
0
    def setUp(self):
        # clear out cache from previous runs
        caching.cache_delete()

        g1 = ConfigurationGroup("mv2", "Multiple Group 2", ordering=1000)
        self.g1 = g1

        self.g1c1 = config_register(
            MultipleStringValue(g1,
                                "c1",
                                choices=((1, "one"), (2, "two"), (3, "three")),
                                default=[1, 2]))
Пример #4
0
    def setUp(self):
        # clear out cache from previous runs
        caching.cache_delete()

        choices1 = config_register(
            MultipleStringValue(SHOP_GROUP, "groupchoice", ordering=1))
        choices2 = config_register(
            MultipleStringValue(SHOP_GROUP, "groupchoice2", ordering=1))

        g1 = ConfigurationGroup("groupreq",
                                "Requirements 4",
                                ordering=1000,
                                requires=choices1)
        self.g1 = g1

        self.g1c1 = config_register(IntegerValue(g1, "c1", ordering=3))
        self.g1c2 = config_register(
            IntegerValue(g1,
                         "c2",
                         requires=choices2,
                         requiresvalue="bar",
                         ordering=4))
        self.g1c3 = config_register(IntegerValue(g1, "c3", ordering=5))
Пример #5
0
    def setUp(self):
        caching.cache_delete()
        choices = config_register(
            MultipleStringValue(SHOP_GROUP, "collect", ordering=1))
        self.choices = choices

        g1 = ConfigurationGroup("coll1", "Collection 1")
        g2 = ConfigurationGroup("coll2", "Collection 2")
        g3 = ConfigurationGroup("coll3", "Collection 3")

        g1c1 = config_register(StringValue(g1, "test"))
        g1c2 = config_register(StringValue(g1, "test1"))
        g2c1 = config_register(StringValue(g2, "test"))
        g3c1 = config_register(StringValue(g3, "test"))

        g1c1.update("set a")
        g1c2.update("set b")
        g2c1.update("set a")
        g3c1.update("set d")

        choices.update(["coll1", "coll3"])
Пример #6
0
config_register_list(
    BooleanValue(
        PAYMENT_GROUP,
        "COUNTRY_MATCH",
        description=_("Country match required?"),
        help_text=_(
            "If True, then customers may not have different countries for shipping and billing."
        ),
        default=True,
    ),
    MultipleStringValue(
        PAYMENT_GROUP,
        "MODULES",
        description=_("Enable payment modules"),
        help_text=_(
            """Select the payment modules you want to use with your shop.
                        If you are adding a new one, you should save and come back to this page,
                        as it may have enabled a new configuration section."""
        ),
        default=["PAYMENT_AUTOSUCCESS"],
    ),
    BooleanValue(
        PAYMENT_GROUP,
        "SSL",
        description=_("Enable SSL"),
        help_text=_(
            """This enables for generic pages like contact information capturing.
                 It does not set SSL for individual modules.
                 You must enable SSL for each payment module individually."""
        ),
        default=False,
Пример #7
0
from satchmo.shop.satchmo_settings import get_satchmo_setting
from satchmo.utils import load_module

import logging

logger = logging.getLogger(__name__)


SHIPPING_GROUP = ConfigurationGroup("SHIPPING", _("Shipping Settings"))

SHIPPING_ACTIVE = config_register(
    MultipleStringValue(
        SHIPPING_GROUP,
        "MODULES",
        description=_("Active shipping modules"),
        help_text=_(
            "Select the active shipping modules, save and reload to set any module-specific shipping settings."
        ),
        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:
Пример #8
0
from django.utils.translation import ugettext_lazy as _
from satchmo.configuration.functions import config_register
from satchmo.configuration.values import ConfigurationGroup, MultipleStringValue

import logging

log = logging.getLogger(__name__)

FULFILMENT_SETTINGS = ConfigurationGroup("FULFILMENT",
                                         _("Fulfilment Settings"))

ACTIVE_FULILMENT_HOUSE = config_register(
    MultipleStringValue(
        FULFILMENT_SETTINGS,
        "MODULES",
        description=_("Active fulfilment houses"),
        help_text=
        _("Select the active fulfilment house, save and reload to set any module-specific fulilment settings."
          ),
        default=[],
        choices=[],
    ))
Пример #9
0
from satchmo.utils import load_module

import logging

logger = logging.getLogger(__name__)

PRODUCT_GROUP = ConfigurationGroup("PRODUCT", _("Product Settings"))

PRODUCT_TYPES = config_register(
    MultipleStringValue(
        PRODUCT_GROUP,
        "PRODUCT_TYPES",
        description=_("Product Model Options"),
        default=["product::ConfigurableProduct", "product::ProductVariation"],
        choices=[
            ("product::ConfigurableProduct", _("Configurable Product")),
            ("product::ProductVariation", _("Product Variation")),
            ("product::CustomProduct", _("Custom Order")),
            ("product::SubscriptionProduct", _("Subscription Product")),
            ("product::DownloadableProduct", _("Downloadable Product")),
        ],
    ))

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."""),
Пример #10
0
        default="4.33",
    ),
    DecimalValue(
        SHIPPING_GROUP,
        "PER_RATE_ROW",
        description=_("Per item price R.o.W."),
        requires=SHIP_MODULES,
        requiresvalue="satchmo.shipping.modules.royalmailcontract",
        default="1.14",
    ),
    DecimalValue(
        SHIPPING_GROUP,
        "PER_KG_ROW",
        description=_("Per Kg price R.o.W."),
        requires=SHIP_MODULES,
        requiresvalue="satchmo.shipping.modules.royalmailcontract",
        default="6.65",
    ),
    MultipleStringValue(
        SHIPPING_GROUP,
        "EXCLUDE_COUNTRY",
        description=_("Countries excluded from Royal Mail Contract shipping."),
        help_text=_("Select the countries that you want to exclude."),
        requires=SHIP_MODULES,
        requiresvalue="satchmo.shipping.modules.royalmailcontract",
        default=[],
        choices=lambda: Country.objects.exclude(iso2_code="GB").values_list(
            "iso2_code", "printable_name"),
    ),
)
Пример #11
0
                hidden=True,
                default="DUMMY"),
    StringValue(
        PAYMENT_GROUP,
        "LABEL",
        description=_("English name for this group on the checkout screens"),
        default="Payment test module",
        help_text=_("This will be passed to the translation utility"),
    ),
    StringValue(
        PAYMENT_GROUP,
        "URL_BASE",
        description=
        _("The url base used for constructing urlpatterns which will use this module"
          ),
        default="dummy/",
    ),
    MultipleStringValue(
        PAYMENT_GROUP,
        "CREDITCHOICES",
        description=_("Available credit cards"),
        choices=(
            (("Visa", "Visa")),
            (("Mastercard", "Mastercard")),
            (("Discover", "Discover")),
            (("American Express", "American Express")),
        ),
        default=("Visa", "Mastercard", "Discover", "American Express"),
    ),
)
Пример #12
0
)

NUMBER_PAGINATED = config_register(
    PositiveIntegerValue(
        SHOP_GROUP,
        "NUM_PAGINATED",
        description=_("Number of featured items to display on each page"),
        default=10,
    )
)

MEASUREMENT_SYSTEM = config_register(
    MultipleStringValue(
        SHOP_GROUP,
        "MEASUREMENT_SYSTEM",
        description=_("Measurement system to use in store"),
        choices=[("metric", _("Metric")), ("imperial", _("Imperial"))],
        default="imperial",
    )
)

LOGO_URI = config_register(
    StringValue(
        SHOP_GROUP,
        "LOGO_URI",
        description=_("URI to the logo for the store"),
        help_text=_(
            (
                "For example http://www.example.com/images/logo.jpg or "
                "file:///var/www/html/images/logo.jpg"
            )