def setUp(self): # clear out cache from previous runs keyedcache.cache_delete() choices1 = config_register(MultipleStringValue(BASE_GROUP, 'groupchoice', ordering=1)) choices2 = config_register(MultipleStringValue(BASE_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))
def setUp(self): # clear out cache from previous runs keyedcache.cache_delete() g1 = ConfigurationGroup('req2', 'Requirements 2', ordering=1000) self.g1 = g1 choices1 = config_register( MultipleStringValue(BASE_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(BASE_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')
def setUp(self): # clear out cache from previous runs keyedcache.cache_delete() g1 = ConfigurationGroup('reqval', 'Requirements 3', ordering=1000) self.g1 = g1 choices1 = config_register(MultipleStringValue(BASE_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(BASE_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')
def setUp(self): # clear out cache from previous runs keyedcache.cache_delete() g1 = ConfigurationGroup('m1', 'Multiple Group 1', ordering=1000) self.g1 = g1 self.g1c1 = config_register(MultipleStringValue(g1, 'c1', choices=((1, 'one'), (2, 'two'), (3, 'three'))))
def setUp(self): keyedcache.cache_delete() choices = config_register(MultipleStringValue(BASE_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'])
def setUp(self): # clear out cache from previous runs keyedcache.cache_delete() djangosettings.LIVESETTINGS_OPTIONS = { 1: { 'DB': False, 'SETTINGS': { 'overgroup': { 's2': '100', 'choices': '["one","two","three"]' } } } } g = ConfigurationGroup('overgroup', 'Override Group') self.g = g config_register(StringValue(g, 's1')) config_register(IntegerValue(g, 's2', default=10)) config_register(IntegerValue(g, 's3', default=10)) config_register(MultipleStringValue(g, 'choices'))
StringValue( PAYMENT_GROUP, 'LABEL', description=_('English name for this group on the checkout screens'), default='Sage Pay Secure Payments', dummy=_( 'Sage Pay Secure Payments'), # Force this to appear on po-files help_text=_('This will be passed to the translation utility')), MultipleStringValue( PAYMENT_GROUP, 'CREDITCHOICES', description=_('Available credit cards'), choices=( (('VISA', 'Visa Credit/Debit')), (('UKE', 'Visa Electron')), (('DELTA', 'Delta')), #(('AMEX','American Express')), # not always available #(('DC','Diners Club')), # not always available (('MC', 'Mastercard')), (('MAESTRO', 'UK Maestro')), (('SOLO', 'Solo')), (('JCB', 'JCB')), ), default=('VISA', 'MC')), StringValue( PAYMENT_GROUP, 'VENDOR', description=_('Your Vendor Name'), default="", help_text= _("This is used for Live and Test transactions. Make sure to add your server IP address to VSP, or it won't work." )),
#http://sellonline.canadapost.ca/DevelopersResources/protocolV3/ProductID.html MultipleStringValue( SHIPPING_GROUP, 'CANADAPOST_SHIPPING_CHOICES', description=_("Canada Post shipping choices available to customers."), choices=( (('1010', 'Domestic - Regular')), (('1020', 'Domestic - Expedited')), (('1030', 'Domestic - Xpresspost')), (('1040', 'Domestic - Priority Courier')), (('2005', 'US - Small Packets Surface')), (('2015', 'US - Small Packets Air')), (('2020', 'US - Expedited US Business Contract')), (('2025', 'US - Expedited US Commercial')), (('2030', 'US - Xpress USA')), (('2040', 'US - Priority Worldwide USA')), (('2050', 'US - Priority Worldwide PAK USA')), (('3005', 'Int`l - Small Packets Surface')), (('3010', 'Int`l - Surface International')), (('3015', 'Int`l - Small Packets Air')), (('3020', 'Int`l - Air International')), (('3025', 'Int`l - Xpresspost International')), (('3040', 'Int`l - Priority Worldwide INTL')), (('3050', 'Int`l - Priority Worldwide PAK INTL')), ), default=( '1010', '1020', '1030', '1040', )), StringValue(SHIPPING_GROUP,
MultipleStringValue( SHIPPING_GROUP, 'USPS_SHIPPING_CHOICES', description=_("USPS Shipping Choices Available to customers."), choices=( (('0', 'First Class')), (('1', 'Priority Mail')), (('16', 'Priority Mail Flat-Rate Envelope')), (('17', 'Priority Mail Flat-Rate Box')), (('22', 'Priority Mail Large Flat-Rate Box')), (('3', 'Express Mail')), (('13', 'Express Mail Flat-Rate Envelope')), (('4', 'Parcel Post')), (('5', 'Bound Printed Matter')), (('6', 'Media Mail')), (('7', 'Library Mail')), # INTERNATIONAL CODES (('14', 'Int`l: First Class Mail International Large Envelope')), (('15', 'Int`l: First Class Mail International Package')), (('1', 'Int`l: Express Mail International (EMS)')), (('4', 'Int`l: Global Express Guaranteed')), (('6', 'Int`l: Global Express Guaranteed Non-Document Rectangular')), (('7', 'Int`l: Global Express Guaranteed Non-Document Non-Rectangular') ), (('10', 'Int`l: Express Mail International (EMS) Flat-Rate Envelope')), (('2', 'Int`l: Priority Mail International')), (('8', 'Int`l: Priority Mail International Flat-Rate Envelope')), (('9', 'Int`l: Priority Mail International Flat-Rate Box')), (('11', 'Int`l: Priority Mail International Large Flat-Rate Box')), (('12', 'Int`l: USPS GXG Envelopes')), ), default=('3', )),
description=_('English name for this group on the checkout screens'), default='Payment test module', dummy=_('Payment test module'), # Force this to appear on po-files 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')), BooleanValue( PAYMENT_GROUP, 'CAPTURE', description=_('Capture Payment immediately?'), default=True, help_text= _('IMPORTANT: If false, a capture attempt will be made when the order is marked as shipped.' )), BooleanValue( PAYMENT_GROUP, 'AUTH_EARLY',
), MultipleStringValue( SHIPPING_GROUP, 'SHIPPING_CHOICES', description=_('FedEx Shipping Choices Available to customers.'), choices=( ('EUROPE_FIRST_INTERNATIONAL_PRIORITY', 'Europe First International Priority'), ('FEDEX_1_DAY_FREIGHT', 'Fedex 1 Day Freight'), ('FEDEX_2_DAY', 'Fedex 2 Day'), ('FEDEX_2_DAY_FREIGHT', 'Fedex 2 Day Freight'), ('FEDEX_3_DAY_FREIGHT', 'Fedex 3 Day Freight'), ('FEDEX_EXPRESS_SAVER', 'Fedex Express Saver'), ('FEDEX_GROUND', 'Fedex Ground'), ('FIRST_OVERNIGHT', 'First Overnight'), ('GROUND_HOME_DELIVERY', 'Ground Home Delivery'), ('INTERNATIONAL_ECONOMY', 'International Economy'), ('INTERNATIONAL_ECONOMY_FREIGHT', 'International Economy Freight'), ('INTERNATIONAL_FIRST', 'International First'), ('INTERNATIONAL_PRIORITY', 'International Priority'), ('INTERNATIONAL_PRIORITY_FREIGHT', 'International Priority Freight'), ('PRIORITY_OVERNIGHT', 'Priority Overnight'), ('SMART_POST', 'Smart Post'), ('STANDARD_OVERNIGHT', 'Standard Overnight'), ('FEDEX_FREIGHT', 'Fedex Freight'), ('FEDEX_NATIONAL_FREIGHT', 'Fedex National Freight'), ('INTERNATIONAL_GROUND', 'International Ground'), ), default='FEDEX_GROUND'), StringValue(
from livesettings.values import StringValue, ConfigurationGroup, BooleanValue, MultipleStringValue from livesettings.functions import config_register, config_value from satchmo_store.shop import get_satchmo_setting from satchmo_utils import load_module import logging log = logging.getLogger('shipping.config') 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=["shipping.modules.per"], choices=[('shipping.modules.per', _('Per piece'))], ordering=0)) config_register( StringValue( SHIPPING_GROUP, 'HIDING', description=_("Hide if one?"), help_text=_( "Hide shipping form fields if there is only one choice available?" ), default='NO', ordering=10,
PositiveIntegerValue( PRODUCT_GROUP, 'NUM_DISPLAY', description=_("Total featured"), help_text=_("Total number of featured items to display"), default=20), PositiveIntegerValue( PRODUCT_GROUP, 'NUM_PAGINATED', description=_("Number featured"), help_text=_("Number of featured items to display on each page"), default=10), MultipleStringValue( PRODUCT_GROUP, 'MEASUREMENT_SYSTEM', description=_("Measurement System"), help_text=_("Default measurement system to use for products."), choices=[('metric', _('Metric')), ('imperial', _('Imperial'))], default="imperial"), BooleanValue( PRODUCT_GROUP, 'NO_STOCK_CHECKOUT', description=_("Allow checkout with 0 inventory?"), help_text= _("If yes, then customers can buy even if your inventory is 0 for a product." ), default=True), BooleanValue( PRODUCT_GROUP, 'RANDOM_FEATURED', description=_("Random Display"),
from django.utils.translation import ugettext_lazy as _ from livesettings.functions import config_register from livesettings.values import ConfigurationGroup, PositiveIntegerValue, MultipleStringValue # Config group to hold all the configs MYAPP_GROUP = ConfigurationGroup('PRODUCT', _('My App Settings'), ordering=0) # When ordering parameter is not passed, all inputs are sorted by name config_register(PositiveIntegerValue( MYAPP_GROUP, 'NUM_DISPLAY', description=_('Numero de produtos para aparecer na home'), help_text=_("Numero de produtos ao aparecer na home"), # if no help_text is given, Default falue is displayed default=5 )) # Another example of allowing the user to select from several values config_register(MultipleStringValue( MYAPP_GROUP, 'RANDOM_FEATURED', description=_("Measurement System"), help_text=_("Default measurement system to use."), choices=[('metric', _('Metric')), ('imperial', _('Imperial'))], default="imperial" ))
help_text=_("UPS Account Number."), default=""), StringValue(SHIPPING_GROUP, 'USER_PASSWORD', description=_("UPS User Password"), help_text=_("User password provided by UPS site."), default=""), MultipleStringValue(SHIPPING_GROUP, 'UPS_SHIPPING_CHOICES', description=_("UPS Shipping Choices Available to customers. These are valid domestic codes only."), choices = ( (('01', 'Next Day Air')), (('02', 'Second Day Air')), (('03', 'Ground')), (('12', '3 Day Select')), (('13', 'Next Day Air Saver')), (('14', 'Next Day Air Early AM')), (('59', '2nd Day Air AM')), ), default = ('03',)), DecimalValue(SHIPPING_GROUP, 'HANDLING_FEE', description=_("Handling Fee"), help_text=_("The cost of packaging and getting the package off"), default=Decimal('0.00')), StringValue(SHIPPING_GROUP, 'SHIPPING_CONTAINER',
_("Users will be required to authenticate (and create an account if neccessary) before checkout." ), default=False, )) config_register( MultipleStringValue( SHOP_GROUP, 'REQUIRED_BILLING_DATA', description=_("Required billing data"), help_text= _("Users may be required to provide some set of billing address. Other fields are optional. " "You may shorten the checkout process here, but be careful, as this may leave you orders " "with almost no customer data! Some payment modules may override this setting." ), default=('email', 'first_name', 'last_name', 'phone', 'street1', 'city', 'postal_code', 'country'), choices=(('email', _("Email")), ('title', _("Title")), ('first_name', _("First name")), ('last_name', _("Last name")), ('phone', _("Phone")), ('addressee', _("Addressee")), ('organization', _("Organization")), ('street1', _("Street")), ('street2', _("Street (second line)")), ('city', _("City")), ('state', _("State/Province")), ('postal_code', _("Postal code/ZIP")), ('country', _("Country"))))) config_register( MultipleStringValue( SHOP_GROUP, 'REQUIRED_SHIPPING_DATA', description=_("Required shipping data"),