示例#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()

        g = ConfigurationGroup("modules", "module test")
        self.g = g
        self.c = config_register(ModuleValue(g, "test"))
示例#4
0
 def setUp(self):
     # clear out cache from previous runs
     caching.cache_delete()
     g = ConfigurationGroup("test2", "test2")
     self.g = g
     config_register(StringValue(g, "s1"))
     config_register(IntegerValue(g, "s2", default=10))
     config_register(IntegerValue(g, "s3", default=10))
示例#5
0
    def setUp(self):
        # clear out cache from previous runs
        caching.cache_delete()

        g = ConfigurationGroup("test3", "test3")
        self.g = g
        c1 = config_register(BooleanValue(g, "s1", default=True))
        c2 = config_register(IntegerValue(g, "s2", default=10))
        c2.update(100)
示例#6
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"])
示例#7
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]))
示例#8
0
    def testAddPreregisteredChoice(self):
        """Test that we can register choices before the config is actually set up."""
        config_add_choice("ctg1", "c1", ("a", "Item A"))
        config_add_choice("ctg1", "c1", ("b", "Item B"))
        config_add_choice("ctg1", "c1", ("c", "Item C"))

        g1 = ConfigurationGroup("ctg1", "Choice 1", ordering=1000)
        config_register(StringValue(g1, "c1"))

        c = config_get("ctg1", "c1")

        self.assertEqual(c.choices, [("a", "Item A"), ("b", "Item B"),
                                     ("c", "Item C")])
示例#9
0
    def setUp(self):
        # clear out cache from previous runs
        caching.cache_delete()

        g1 = ConfigurationGroup("group1", "Group 1", ordering=-1001)
        g2 = ConfigurationGroup("group2", "Group 2", ordering=-1002)
        g3 = ConfigurationGroup("group3", "Group 3", ordering=-1003)

        self.g1 = g1
        self.g2 = g2
        self.g3 = g3

        self.g1c1 = config_register(IntegerValue(g1, "c1"))
        self.g1c2 = config_register(IntegerValue(g1, "c2"))
        self.g1c3 = config_register(IntegerValue(g1, "c3"))

        self.g2c1 = config_register(IntegerValue(g2, "c1"))
        self.g2c2 = config_register(IntegerValue(g2, "c2"))
        self.g2c3 = config_register(IntegerValue(g2, "c3"))

        self.g3c1 = config_register(IntegerValue(g3, "c1"))
        self.g3c2 = config_register(IntegerValue(g3, "c2"))
        self.g3c3 = config_register(IntegerValue(g3, "c3"))
示例#10
0
    def setUp(self):
        # clear out cache from previous runs
        caching.cache_delete()

        g1 = ConfigurationGroup("req1", "Requirements 1", ordering=1000)

        self.g1 = g1

        bool1 = config_register(
            BooleanValue(g1, "bool1", default=False, ordering=1))
        bool2 = config_register(BooleanValue(g1, "bool2", ordering=2))

        self.g1c1 = config_register(
            IntegerValue(g1, "c1", requires=bool1, ordering=3))

        self.g1c2 = config_register(
            IntegerValue(g1, "c2", requires=bool2, ordering=4))
        self.g1c3 = config_register(IntegerValue(g1, "c3", ordering=5))

        bool2.update(True)
示例#11
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))
示例#12
0
from satchmo.configuration.functions import config_register_list, config_get
from satchmo.configuration.values import (
    BooleanValue,
    ConfigurationGroup,
    ModuleValue,
    StringValue,
)

PAYMENT_MODULES = config_get("PAYMENT", "MODULES")
PAYMENT_MODULES.add_choice(("PAYMENT_GIFTCERTIFICATE", "Gift Certificates"))

PRODUCTS = config_get("PRODUCT", "PRODUCT_TYPES")
PRODUCTS.add_choice(("giftcertificate::GiftCertificateProduct", _("Gift Certificate")))

PAYMENT_GROUP = ConfigurationGroup(
    "PAYMENT_GIFTCERTIFICATE", _("Gift Certificate Settings"), requires=PAYMENT_MODULES
)

config_register_list(
    BooleanValue(
        PAYMENT_GROUP,
        "SSL",
        description=_("Use SSL for the checkout pages?"),
        default=False,
    ),
    StringValue(
        PAYMENT_GROUP,
        "CHARSET",
        description=_("Character Set"),
        default="BCDFGHKPRSTVWXYZbcdfghkprstvwxyz23456789",
        help_text=_(
示例#13
0
from django.utils.translation import ugettext_lazy as _
from satchmo.configuration.functions import config_register
from satchmo.configuration.values import ConfigurationGroup, StringValue, BooleanValue
from satchmo.utils import load_module
from satchmo.shop.satchmo_settings import get_satchmo_setting

import logging

logger = logging.getLogger(__name__)

TAX_GROUP = ConfigurationGroup("TAX", _("Tax Settings"))
TAX_MODULE = config_register(
    StringValue(
        TAX_GROUP,
        "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,
示例#14
0
ENFORCE_STATE = config_register(
    BooleanValue(
        SHOP_GROUP,
        "ENFORCE_STATE",
        description=_("State required?"),
        help_text=_(
            "Require a state during registration/checkout for countries that have states?"
        ),
        default=True,
    )
)

# Google Group

GOOGLE_GROUP = ConfigurationGroup("GOOGLE", _("Google Settings"))

GOOGLE_ANALYTICS = config_register(
    BooleanValue(
        GOOGLE_GROUP,
        "ANALYTICS",
        description=_("Enable Analytics"),
        default=False,
        ordering=0,
    )
)

GOOGLE_USE_URCHIN = config_register(
    BooleanValue(
        GOOGLE_GROUP,
        "USE_URCHIN",
示例#15
0
    MultipleStringValue,
    StringValue,
)


# this is so that the translation utility will pick up the string
def gettext(s):
    return s


PAYMENT_MODULES = config_get("PAYMENT", "MODULES")
PAYMENT_MODULES.add_choice(("PAYMENT_DUMMY", _("Payment Test Module")))

PAYMENT_GROUP = ConfigurationGroup(
    "PAYMENT_DUMMY",
    _("Payment Test Module Settings"),
    requires=PAYMENT_MODULES,
    ordering=100,
)

config_register_list(
    BooleanValue(
        PAYMENT_GROUP,
        "SSL",
        description=_("Use SSL for the module checkout pages?"),
        default=False,
    ),
    BooleanValue(
        PAYMENT_GROUP,
        "LIVE",
        description=_("Accept real payments"),
        help_text=_("False if you want to be in test mode"),
示例#16
0
 def testSetGroup(self):
     g1 = ConfigurationGroup("test1", "test1")
     value = IntegerValue(g1, "SingleGroupedItem")
     config_register(value)
     self.assertFalse(config_exists(SHOP_GROUP, "SingleGroupedItem"))
     self.assertTrue(config_exists(g1, "SingleGroupedItem"))
示例#17
0
from django.utils.translation import ugettext_lazy as _
from satchmo.configuration.function import config_get, config_register_list
from satchmo.configuration.values import (
    ConfigurationGroup,
    DecimalValue,
    MultipleStringValue,
)
from satchmo.l10n.models import Country

SHIP_MODULES = config_get("SHIPPING", "MODULES")
SHIP_MODULES.add_choice(
    ("satchmo.shipping.modules.royalmailcontract", _("Royal Mail Contract")))

SHIPPING_GROUP = ConfigurationGroup(
    "satchmo.shipping.modules.royalmailcontract",
    _("Royal Mail Contract Shipping Settings"),
    requires=SHIP_MODULES,
    ordering=101,
)

config_register_list(
    DecimalValue(
        SHIPPING_GROUP,
        "PACKING_FEE",
        description=_("Packing Fee"),
        requires=SHIP_MODULES,
        requiresvalue="satchmo.shipping.modules.royalmailcontract",
        default="0.30",
    ),
    DecimalValue(
        SHIPPING_GROUP,
        "MAX_WEIGHT_PER_ITEM",
示例#18
0
from django.utils.translation import ugettext_lazy as _
from satchmo.configuration.functions import config_register
from satchmo.configuration.values import (
    ConfigurationGroup,
    MultipleStringValue,
    StringValue,
)
from satchmo.shop.satchmo_settings import get_satchmo_setting
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")),
        ],
    ))
示例#19
0
from django.utils.translation import ugettext_lazy as _

from satchmo.configuration.functions import config_get, config_register_list
from satchmo.configuration.values import (
    BooleanValue,
    ConfigurationGroup,
    ModuleValue,
    StringValue,
)

PAYMENT_MODULES = config_get("PAYMENT", "MODULES")
PAYMENT_MODULES.add_choice(("PAYMENT_AUTOSUCCESS", _("Auto Success Module")))

PAYMENT_GROUP = ConfigurationGroup(
    "PAYMENT_AUTOSUCCESS",
    _("Payment Auto Success Module Settings"),
    requires=PAYMENT_MODULES,
    ordering=100,
)

config_register_list(
    BooleanValue(
        PAYMENT_GROUP,
        "LIVE",
        description=_("Accept real payments"),
        help_text=_("False if you want to be in test mode"),
        default=False,
    ),
    ModuleValue(
        PAYMENT_GROUP,
        "MODULE",
        description=_("Implementation module"),
示例#20
0
from satchmo.configuration.functions import config_get, config_register_list
from satchmo.configuration.values import (
    BooleanValue,
    ConfigurationGroup,
    ModuleValue,
    StringValue,
)
from django.utils.translation import ugettext_lazy as _

PAYMENT_MODULES = config_get("PAYMENT", "MODULES")
PAYMENT_MODULES.add_choice(("PAYMENT_INGENICO", _("Ingenico")))

PAYMENT_GROUP = ConfigurationGroup(
    "PAYMENT_INGENICO",
    _("Ingenico Payment Settings"),
    requires=PAYMENT_MODULES,
    ordering=101,
)

config_register_list(
    StringValue(
        PAYMENT_GROUP,
        "CONNECTION",
        description=_("URL to submit live transactions."),
        hidden=True,
        default="https://secure.ogone.com/ncol/prod/orderstandard_utf8.asp",
    ),
    StringValue(
        PAYMENT_GROUP,
        "CONNECTION_TEST",
        description=_("URL to submit test transactions."),
示例#21
0
from django.utils.translation import ugettext_lazy as _
from satchmo.configuration.functions import config_register, config_value
from satchmo.configuration.values import ConfigurationGroup, MultipleStringValue
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
示例#22
0
from django.utils.translation import ugettext_lazy as _

from satchmo.configuration.functions import config_register_list
from satchmo.configuration.values import ConfigurationGroup, StringValue, BooleanValue
from satchmo.fulfilment.config import ACTIVE_FULILMENT_HOUSE

import logging

log = logging.getLogger(__name__)

ACTIVE_FULILMENT_HOUSE.add_choice(("satchmo.fulfilment.modules.six", _("Six")))

FULILMENT_HOUSE = ConfigurationGroup(
    "satchmo.fulfilment.modules.six",
    _("Six Fulfilment Settings"),
    requires=ACTIVE_FULILMENT_HOUSE,
    ordering=101,
)

config_register_list(
    StringValue(
        FULILMENT_HOUSE,
        "API_KEY",
        description=_("API Key"),
        help_text=_("Client's API key, provided by fulfiller."),
        default="",
    ),
    BooleanValue(
        FULILMENT_HOUSE,
        "TEST_MODE",
        description=_("Test mode"),
示例#23
0
from satchmo.configuration.functions import config_get, config_register_list
from satchmo.configuration.values import (
    BooleanValue,
    ConfigurationGroup,
    ModuleValue,
    StringValue,
)
from django.utils.translation import ugettext_lazy as _

PAYMENT_MODULES = config_get("PAYMENT", "MODULES")
PAYMENT_MODULES.add_choice(("PAYMENT_PAYPAL", _("Paypal Payment Settings")))

PAYMENT_GROUP = ConfigurationGroup(
    "PAYMENT_PAYPAL",
    _("Paypal Payment Settings"),
    requires=PAYMENT_MODULES,
    ordering=101,
)

config_register_list(
    BooleanValue(
        PAYMENT_GROUP,
        "LIVE",
        description=_("Accept real payments"),
        help_text=_("False if you want to be in test mode"),
        default=False,
    ),
    StringValue(PAYMENT_GROUP,
                "WEBHOOK_ID",
                description=_("Live Webhook ID"),
                default="xxx"),
示例#24
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=[],
    ))
示例#25
0
    BooleanValue,
    ConfigurationGroup,
    DecimalValue,
    MultipleStringValue,
    SettingNotSet,
    StringValue,
)
from satchmo.shop.satchmo_settings import get_satchmo_setting
from satchmo.utils import load_module
from . import signals

import logging

log = logging.getLogger(__name__)

PAYMENT_GROUP = ConfigurationGroup("PAYMENT", _("Payment Settings"))

CRON_KEY = config_register(
    StringValue(
        PAYMENT_GROUP,
        "CRON_KEY",
        description=_("Cron Passkey"),
        help_text=_(
            "Enter an authentication passkey to secure your recurring billing cron url."
        ),
        default="x1234replace_me",
    )
)

ALLOW_URL_CRON = config_register(
    BooleanValue(
示例#26
0
# -*- coding: utf-8 -*-

from django.utils.translation import ugettext_lazy as _

from satchmo.configuration.functions import config_register_list
from satchmo.configuration.values import BooleanValue, ConfigurationGroup, DecimalValue


CURRENCY_GROUP = ConfigurationGroup("CURRENCY", _("Currency Settings"), ordering=1)

CURRENCY = config_register_list(
    DecimalValue(
        CURRENCY_GROUP,
        "BUFFER",
        description=_("Exchange Rate Buffer"),
        help_text=_(
            "Add a small buffer before calculating the exchange rate (to cover exchange fees etc.)"
        ),
        default="0.20",
    ),
    BooleanValue(
        CURRENCY_GROUP,
        "ROUND_UP",
        description=_("Round up"),
        help_text=_("Round currency exchanged prices up to the nearest whole unit"),
    ),
    BooleanValue(
        CURRENCY_GROUP,
        "PSYCHOLOGICAL_PRICING",
        description=_("Psychological pricing"),
        help_text=_(