|
/
Zope
/
gocept svn checkins
/
Archive
/
2006
/
2006-01
/
SVN: r3802 - glome/trunk/Extensions
[
SVN: r3796 - AlphaFlow/tags/AlphaFlow-1_0_3rc1-rel... ]
[
SVN: r3805 - in Vendo/trunk: . i18n ... ]
SVN: r3802 - glome/trunk/Extensions
Christian Zagrodnick <cz(at)gocept.com> |
2006-01-23 16:00:33 |
[ FULL ]
|
Author: zagy
Date: Mon Jan 23 16:00:30 2006
New Revision: 3802
Modified:
glome/trunk/Extensions/Install.py
Log:
- compatibility for plone 2.1: no kupu config, versions, no alphaflow required
to be *installed* ,
it needs to be present though
Modified: glome/trunk/Extensions/Install.py
==============================================================================
--- glome/trunk/Extensions/Install.py (original)
+++ glome/trunk/Extensions/Install.py Mon Jan 23 16:00:30 2006
(at)(at) -17,19 +17,20 (at)(at)
requirements = [
('CMFPlone', ('2.0.5',)),
- ('Archetypes', ('1.3.3-final','1.3.4-final')),
- ('CMFMember', ('1.0 rc3', '1.0 final')),
+ ('Archetypes', ('1.3.3-final','1.3.4-final', '1.3.5-final',
'1.3.7-final')),
+ ('CMFMember', ('1.0 rc3', '1.0 final', '1.1-beta2')),
('ExtFile', ('1.4.4',)),
('UserTrack', ('1.0',)),
('CMFUserTrackTool', ('1.1',)),
('ATCountryWidget', ('0.2', '0.2.1')),
- ('AlphaFlow', ('1.0.1', '1.0.2', '1.0.3 (unreleased)')),
- ('ATContentTypes', ('0.2.0-final (CVS/Unreleased)', '1.0.0-final')),
+ ('AlphaFlow', ('1.0.1', '1.0.2', '1.0.3rc1')),
+ ('ATContentTypes', ('0.2.0-final (CVS/Unreleased)', '1.0.0-final',
+ '1.0.3-final')),
]
required_to_be_already_installed_via_quickinstaller = [
'Archetypes',
- 'AlphaFlow',
+ #'AlphaFlow',
'ATContentTypes',
]
(at)(at) -397,9 +398,10 (at)(at)
print >>out, 'Configuring actions ...'
configure_actions(self, out)
-
- print >>out, 'Configuring kupu for GlomeTypes ...'
- configure_kupu(self, out)
+
+ if not plone21:
+ print >>out, 'Configuring kupu for GlomeTypes ...'
+ configure_kupu(self, out)
print >>out, 'Configuring caching policies ...'
configure_caching(self, out)
|
SVN: r3803 - glome/trunk
Christian Zagrodnick <cz(at)gocept.com> |
2006-01-23 16:00:56 |
[ FULL ]
|
Author: zagy
Date: Mon Jan 23 16:00:52 2006
New Revision: 3803
Modified:
glome/trunk/patch.py
Log:
moved most patches out of the plone 2.1 -- if you encounter problems chefkm the
patches
Modified: glome/trunk/patch.py
==============================================================================
--- glome/trunk/patch.py (original)
+++ glome/trunk/patch.py Mon Jan 23 16:00:52 2006
(at)(at) -557,22 +557,24 (at)(at)
global _already_patched
if _already_patched:
return
-
- patch_webdav()
+
patch_transforms()
- patch_httplogger()
- patch_atbase()
- patch_queuecatalog()
- patch_pts()
- patch_txng()
- patch_atct()
- patch_mimetypes()
- patch_complex_marshal()
- patch_plone_translate()
- patch_memberdata()
- patch_catalog_tool()
if not plone21:
+ # we assume at first that everything is fine with plone21. If that is
+ # not the case we can move/miegrate the patches
+ patch_webdav()
+ patch_httplogger()
+ patch_atbase()
+ patch_queuecatalog()
+ patch_pts()
+ patch_txng()
+ patch_atct()
+ patch_mimetypes()
+ patch_complex_marshal()
+ patch_plone_translate()
+ patch_memberdata()
+ patch_catalog_tool()
patch_cmf_local_role_support() # only for CMF 1.4
|
SVN: r3804 - in Vendo/trunk: . Extensions tests
Christian Zagrodnick <cz(at)gocept.com> |
2006-01-23 16:01:39 |
[ FULL ]
|
Author: zagy
Date: Mon Jan 23 16:01:34 2006
New Revision: 3804
Modified:
Vendo/trunk/Extensions/Install.py
Vendo/trunk/order.py
Vendo/trunk/permission.py
Vendo/trunk/tests/common.py
Vendo/trunk/tests/test_cart.py
Vendo/trunk/tests/test_shop.py
Log:
plone 2.1 compatibiliby -- not yet finished but an intermediate step
Modified: Vendo/trunk/Extensions/Install.py
==============================================================================
--- Vendo/trunk/Extensions/Install.py (original)
+++ Vendo/trunk/Extensions/Install.py Mon Jan 23 16:01:34 2006
(at)(at) -18,8 +18,6 (at)(at)
from Products.Vendo import config
requirements = [
- ('glome', ('0.9.2.1', )),
- ('CMFMember', ('1.0 final', )),
]
required_to_be_already_installed_via_quickinstaller = [
Modified: Vendo/trunk/order.py
==============================================================================
--- Vendo/trunk/order.py (original)
+++ Vendo/trunk/order.py Mon Jan 23 16:01:34 2006
(at)(at) -40,7 +40,8 (at)(at)
archetype_name = 'VendoOrder'
security = ClassSecurityInfo()
global_allow = False
- allowed_content_types = ('VendoOrderItem', 'VendoAddress',
'VendoShippingAddress',)
+ allowed_content_types = ('VendoOrderItem', 'VendoAddress',
+ 'VendoShippingAddress',)
content_icon = 'vendoOrder.gif'
sum = None
Modified: Vendo/trunk/permission.py
==============================================================================
--- Vendo/trunk/permission.py (original)
+++ Vendo/trunk/permission.py Mon Jan 23 16:01:34 2006
(at)(at) -3,13 +3,12 (at)(at)
# See also LICENSE.txt
# $Id: config.py 2864 2005-05-18 09:22:33Z zagy $
-from Products.CMFCore import CMFCorePermissions
-from Products.ATContentTypes import Permissions
+from Products.CMFCore import permissions as cmf
from Products.CMFMember.utils import ContentPermMap
# permission definitions
-AddContent = Permissions.ADD_CONTENT_PERMISSION
-AddCustomer = CMFCorePermissions.AddPortalMember
+AddContent = cmf.AddPortalContent
+AddCustomer = cmf.AddPortalMember
ManageOrders = "Vendo: Manage orders"
# mapping of permission -> portal_type
Modified: Vendo/trunk/tests/common.py
==============================================================================
--- Vendo/trunk/tests/common.py (original)
+++ Vendo/trunk/tests/common.py Mon Jan 23 16:01:34 2006
(at)(at) -6,11 +6,7 (at)(at)
from Testing import ZopeTestCase
import sys
-from Products.CMFCore.utils import getToolByName
-
from Products.glome.tests.GlomeTestCase import installProducts
-from Products.glome import utils as gutils
-
products = (
(at)(at) -32,16 +28,19 (at)(at)
from AccessControl.SecurityManagement import noSecurityManager
import time
-from Products.CMFPlone.tests import PloneTestCase
+from Products.PloneTestCase import PloneTestCase
+from Products.PloneTestCase.setup import setupPloneSite
from Products.CMFCore.utils import getToolByName
+from Products.glome import utils as gutils
+
portal_name = PloneTestCase.portal_name
portal_owner = PloneTestCase.portal_owner
def createTestContent(app):
- portal = app.portal
+ portal = app[portal_name]
gutils.migrateCMFMember(portal, ['VendoCustomer'], 'VendoCustomer',
'member_auto_workflow')
# create shops and products
(at)(at) -101,7 +100,8 (at)(at)
home_folder = pms.getHomeFolder(user_name)
if has_addr:
addr_id = shop.getBillingAddressId()
- home_folder.invokeFactory('VendoAddress',addr_id)
+ gutils.unrestrictedInvokeFactory(home_folder, 'VendoAddress',
+ addr_id)
addr = getattr(home_folder, addr_id)
addr.setCountry(country)
addr.reindexObject()
(at)(at) -145,5 +145,6 (at)(at)
app = ZopeTestCase.app()
+setupPloneSite()
setup(app)
ZopeTestCase.close(app)
Modified: Vendo/trunk/tests/test_cart.py
==============================================================================
--- Vendo/trunk/tests/test_cart.py (original)
+++ Vendo/trunk/tests/test_cart.py Mon Jan 23 16:01:34 2006
(at)(at) -56,7 +56,7 (at)(at)
order = cart.order()
self.assertEquals(order.getSum(), FixedPoint(sum, 2))
- portal = self.getPortal()
+ portal = self.portal
cart = portal.shop1.getCart()
v1 = portal.shop1.p1.v1
v1_uid = v1.UID()
(at)(at) -93,7 +93,7 (at)(at)
checkCartContent([], cartcontent)
def test_shipping(self):
- portal = self.getPortal()
+ portal = self.portal
cart = portal.shop1.getCart()
v1_uid = portal.shop1.p1.v1.UID()
v2_uid = portal.shop1.p1.v2.UID()
(at)(at) -141,7 +141,7 (at)(at)
test_shipping('222.50')
def test_subtotal(self):
- portal = self.getPortal()
+ portal = self.portal
cart = portal.shop1.getCart()
v1_uid = portal.shop1.p1.v1.UID()
v2_uid = portal.shop1.p1.v2.UID()
(at)(at) -164,7 +164,7 (at)(at)
self.assertEquals(FixedPoint(vat_sum), order.getVATSum())
self.assertEquals(FixedPoint(total), order.getTotal())
- portal = self.getPortal()
+ portal = self.portal
shop = portal.shop1
v1_uid = shop.p1.v1.UID()
v2_uid = shop.p1.v2.UID()
(at)(at) -200,7 +200,7 (at)(at)
self.assertEquals(FixedPoint('0.00'), order.getVATRate())
def test_order_leaves_cart_untouched(self):
- portal = self.getPortal()
+ portal = self.portal
cart = portal.shop1.getCart()
v1_uid = portal.shop1.p1.v1.UID()
v2_uid = portal.shop1.p1.v2.UID()
Modified: Vendo/trunk/tests/test_shop.py
==============================================================================
--- Vendo/trunk/tests/test_shop.py (original)
+++ Vendo/trunk/tests/test_shop.py Mon Jan 23 16:01:34 2006
(at)(at) -42,7 +42,7 (at)(at)
def test_getprice(self):
- portal = self.getPortal()
+ portal = self.portal
v1 = portal.shop1.p1.v1
#first with anonymous
(at)(at) -67,7 +67,7 (at)(at)
from Products.Vendo.validator import UniqueSubSkuValidator
ussv = UniqueSubSkuValidator()
- portal = self.getPortal()
+ portal = self.portal
shop1 = portal.shop1
shop2 = portal.shop2
p1 = shop1.p1
(at)(at) -99,7 +99,7 (at)(at)
from Products.Vendo.validator import UniqueSkuValidator
usv = UniqueSkuValidator()
- portal = self.getPortal()
+ portal = self.portal
shop1 = portal.shop1
shop2 = portal.shop2
(at)(at) -138,7 +138,7 (at)(at)
self.assert_('sku' in errors, errors)
def test_listVariation(self):
- portal = self.getPortal()
+ portal = self.portal
p1 = portal.shop1.p1
self.assertEquals(p1.listVariations(), [p1.v1, p1.v2])
(at)(at) -146,7 +146,7 (at)(at)
def test_getcart(self):
self.logout()
- portal = self.getPortal()
+ portal = self.portal
request = portal.REQUEST
security = getSecurityManager()
(at)(at) -168,7 +168,7 (at)(at)
def test_allowed_ids(self):
self.loginPortalOwner()
- portal = self.getPortal()
+ portal = self.portal
members = portal.Members
members.invokeFactory('Folder', 'foo(at)bar.com')
members.invokeFactory('Folder', 'fo+o(at)bar.com')
(at)(at) -182,7 +182,7 (at)(at)
len(portal.portal_membership.getHomeFolder().contentValues('VendoAddress')))
self.login('cheapuser(at)test.gocept.com')
- portal = self.getPortal()
+ portal = self.portal
shop = portal.shop1
_checkAddrLen(0)
address = shop.getCustomerAddress()
(at)(at) -207,7 +207,7 (at)(at)
self.assertEqual(ship_addr, shop.getShippingAddress())
self.login('bothuser(at)test.gocept.com')
- portal = self.getPortal()
+ portal = self.portal
shop = portal.shop1
_checkAddrLen(0)
address3 = shop.getCustomerAddress()
(at)(at) -216,7 +216,7 (at)(at)
self.assertNotEqual('cheap', address3.getLastname())
self.logout() # anonymous
- portal = self.getPortal()
+ portal = self.portal
shop = portal.shop1
self.failUnless(shop.getCustomerAddress() is None)
self.assertRaises(Unauthorized, shop.createShippingAddress)
|
SVN: r3806 - Vendo/trunk
Christian Zagrodnick <cz(at)gocept.com> |
2006-01-23 16:43:05 |
[ FULL ]
|
Author: zagy
Date: Mon Jan 23 16:43:00 2006
New Revision: 3806
Modified:
Vendo/trunk/cart.py
Log:
retabbed
Modified: Vendo/trunk/cart.py
==============================================================================
--- Vendo/trunk/cart.py (original)
+++ Vendo/trunk/cart.py Mon Jan 23 16:43:00 2006
(at)(at) -210,27 +210,27 (at)(at)
security.declareProtected(CMFCorePermissions.View, 'getShipping')
def getShipping(self):
"""return the shipping cost for that cart if country is switzerland.
- if country is switzerland and zip is between 1200 and 1299, don't
calculate"""
- if not self.isSwitzerland():
- return FixedPoint('0')
-
- if self.isSwitzerland() and self.isGenf():
- return FixedPoint('0')
-
+ if country is switzerland and zip is between 1200 and 1299, don't
calculate"""
+ if not self.isSwitzerland():
+ return FixedPoint('0')
+
+ if self.isSwitzerland() and self.isGenf():
+ return FixedPoint('0')
+
weightsum = self.getTotalWeight()
- if weightsum == 0:
- return FixedPoint('0')
+ if weightsum == 0:
+ return FixedPoint('0')
weights = TRANSPORT.items()
weights.sort()
shipping = FixedPoint('0')
lastweight = 0
- for weight, price in weights:
- if weightsum in range(lastweight+1, weight+1):
- shipping = price
- lastweight = weight
+ for weight, price in weights:
+ if weightsum in range(lastweight+1, weight+1):
+ shipping = price
+ lastweight = weight
- if not shipping:
- shipping = price
+ if not shipping:
+ shipping = price
return shipping
security.declareProtected(CMFCorePermissions.View, 'getSubTotal')
(at)(at) -241,14 +241,14 (at)(at)
security.declareProtected(CMFCorePermissions.View, 'validateSixBottles')
def validateSixBottles(self):
"""validate that the current number of bottles is divideable by 6"""
- items = self.listCartItems()
- sum = 0
- for item in items:
- if item.getVariation().getIncludeInSixBottlesRestriction():
- sum += item.getVariation().getWeight() * item.getAmount()
-
- return not bool(sum % 6)
-
+ items = self.listCartItems()
+ sum = 0
+ for item in items:
+ if item.getVariation().getIncludeInSixBottlesRestriction():
+ sum += item.getVariation().getWeight() * item.getAmount()
+
+ return not bool(sum % 6)
+
def customerHasShopCountry(self):
shop = self.getShop()
shop_country = shop.getShopCountry()
(at)(at) -301,27 +301,27 (at)(at)
def _get_customer_country(self):
shop = self.getShop()
address = shop.getCustomerAddress()
- if address:
- if address.getDifferentShippingAddress():
- address = shop.getShippingAddress()
-
- if address is not None:
- return address.getCountry()
+ if address:
+ if address.getDifferentShippingAddress():
+ address = shop.getShippingAddress()
+
+ if address is not None:
+ return address.getCountry()
security.declarePrivate('_get_customer_zip_int')
def _get_customer_zip_int(self):
shop = self.getShop()
address = shop.getCustomerAddress()
- if address:
- if address.getDifferentShippingAddress():
- address = shop.getShippingAddress()
-
- if address is not None:
- try:
- intzip = int(address.getZip())
- except:
- intzip = 0
- return intzip
+ if address:
+ if address.getDifferentShippingAddress():
+ address = shop.getShippingAddress()
+
+ if address is not None:
+ try:
+ intzip = int(address.getZip())
+ except:
+ intzip = 0
+ return intzip
atapi.registerType(VendoCart)
|
SVN: r3808 - in Vendo/trunk: . tests
Christian Zagrodnick <cz(at)gocept.com> |
2006-01-25 13:32:54 |
[ FULL ]
|
Author: zagy
Date: Wed Jan 25 13:32:43 2006
New Revision: 3808
Added:
Vendo/trunk/tests/test_doctests.py (contents, props changed)
Vendo/trunk/vat.py
- copied, changed from r3807, Vendo/trunk/tax.py
Removed:
Vendo/trunk/tax.py
Modified:
Vendo/trunk/cart.py
Vendo/trunk/config.py
Vendo/trunk/configure.zcml
Vendo/trunk/interfaces.py
Vendo/trunk/shipping.py
Log:
implemented different tax systems depending on country.
Modified: Vendo/trunk/cart.py
==============================================================================
--- Vendo/trunk/cart.py (original)
+++ Vendo/trunk/cart.py Wed Jan 25 13:32:43 2006
(at)(at) -2,6 +2,7 (at)(at)
# See also LICENSE.txt
# $Id$
+from zope.app import zapi
from zope.interface import implements
from AccessControl import ClassSecurityInfo
(at)(at) -228,8 +229,50 (at)(at)
security.declareProtected(CMFCorePermissions.View, 'getVATRate')
def getVATRate(self):
- """return the VAT rate that applies to the customer"""
- return IVATCalculator(self).getVATRate()
+ """return the VAT rate that applies to the customer
+
+ The actual calculation is done via adpter and depends on the shop
+ country
+
+ >>> shop = portal.shop1
+ >>> shop.setShopCountry('CH')
+ >>> self.login('cheapuser(at)test.gocept.com')
+ >>> cart = shop.getCart()
+ >>> addr = cart.getShippingAddress()
+ >>> addr.setCountry('CH')
+ >>> cart.getVATRate()
+ FixedPoint('10.0000', 4)
+
+
+ We are in CH, so a state change should not change anything:
+
+ >>> addr.setState('WA')
+ >>> cart.getVATRate()
+ FixedPoint('10.0000', 4)
+
+
+ Now we change the shop and the customer. They are not in the same
+ state, thus we get 0.00
+
+
+ >>> shop.setShopCountry('US')
+ >>> shop.setShopState('VA')
+ >>> addr.setCountry('US')
+ >>> cart.getVATRate()
+ FixedPoint('0.0000', 4)
+
+
+ Change customer state to VA, we'd have 10.00 again:
+
+ >>> addr.setState('VA')
+ >>> cart.getVATRate()
+ FixedPoint('10.0000', 4)
+
+ """
+ shop = self.getShop()
+ country = unicode(shop.getShopCountry())
+ vat_calc = zapi.getAdapter(self, IVATCalculator, name=country)
+ return vat_calc.getVATRate()
security.declareProtected(CMFCorePermissions.View, 'getVATSum')
def getVATSum(self):
(at)(at) -254,36 +297,56 (at)(at)
weightsum += citem.getAmount() * variation.getWeight()
return weightsum
+
+ def getShippingAddress(self):
+ """return the shipping address
+
+ If the user doesn't have one, return the customer address
- ###
- ### private
- ###
- security.declarePrivate('_get_customer_country')
- def _get_customer_country(self):
- shop = self.getShop()
- address = shop.getCustomerAddress()
- if address:
- if address.getDifferentShippingAddress():
- address = shop.getShippingAddress()
-
- if address is not None:
- return address.getCountry()
+ >>> from Products.Vendo.interfaces import IAddress
+ >>> self.login('cheapuser(at)test.gocept.com')
+ >>> shop = portal.shop1
+ >>> cart = shop.getCart()
+
+ The cheapuser doesn't have a dedicated shipping address yet. We expect
+ an address nevertheless
+
+ >>> shop.getShippingAddress() is None
+ True
+ >>> ship_address = cart.getShippingAddress()
+ >>> IAddress.providedBy(ship_address)
+ True
+ >>> ship_address == shop.getCustomerAddress()
+ True
+
+
+ If we create a shipping address we expect it to be returned:
+
+ >>> ship_address.setDifferentShippingAddress(True)
+ >>> new_ship_address = shop.createShippingAddress()
+ >>> new_ship_address == ship_address
+ False
+ >>> cart.getShippingAddress() == new_ship_address
+ True
- security.declarePrivate('_get_customer_zip_int')
- def _get_customer_zip_int(self):
+
+ """
shop = self.getShop()
address = shop.getCustomerAddress()
if address:
if address.getDifferentShippingAddress():
address = shop.getShippingAddress()
-
- if address is not None:
- try:
- intzip = int(address.getZip())
- except:
- intzip = 0
- return intzip
-
+ return address
+
+ ###
+ ### private
+ ###
+ security.declarePrivate('_get_customer_country')
+ def _get_customer_country(self):
+ address = self.getShippingAddress()
+ if address is not None:
+ return address.getCountry()
+
atapi.registerType(VendoCart)
Modified: Vendo/trunk/config.py
==============================================================================
--- Vendo/trunk/config.py (original)
+++ Vendo/trunk/config.py Wed Jan 25 13:32:43 2006
(at)(at) -9,6 +9,8 (at)(at)
# Currencies selectable for a shop
CURRENCIES = (('EUR','Euro'),
('USD','US Dollar'),
+ ('JPY', 'Japanese Yen'),
+ ('KRW', 'South Korean Won'),
('CHF', 'Swiss Franc'))
(at)(at) -28,6 +30,14 (at)(at)
}
+STATES = (
+ ('', 'N/A'),
+ ('WA', 'Washington'),
+ ('VA', 'Virginia'),
+
+)
+
+
VENDO_CART_SESSION_ID = 'Vendo-%s-ShoppingCart' % VERSION
Modified: Vendo/trunk/configure.zcml
==============================================================================
--- Vendo/trunk/configure.zcml (original)
+++ Vendo/trunk/configure.zcml Wed Jan 25 13:32:43 2006
(at)(at) -17,6 +17,13 (at)(at)
<adapter
for=".interfaces.ICart"
provides=".interfaces.IVATCalculator"
- factory=".tax.SwissVAT" />
+ factory=".vat.SwissVAT"
+ name="CH"/>
+ <adapter
+ for=".interfaces.ICart"
+ provides=".interfaces.IVATCalculator"
+ factory=".vat.USSalesTax"
+ name="US" />
+
</configure>
Modified: Vendo/trunk/interfaces.py
==============================================================================
--- Vendo/trunk/interfaces.py (original)
+++ Vendo/trunk/interfaces.py Wed Jan 25 13:32:43 2006
(at)(at) -123,7 +123,7 (at)(at)
def getCustomerAddress():
"""get the address object of the current member
- returns IVendoAddress instance if member is not Anonymous
+ returns IAddress instance if member is not Anonymous
otherwise None is returned
"""
(at)(at) -141,7 +141,7 (at)(at)
shipping address not existing or
customer address says that there is no different
shipping address
- IVendoAddress otherwise
+ IAddress otherwise
"""
def getBillingAddressId(self):
(at)(at) -161,6 +161,16 (at)(at)
description_msgid='currency_desc',
),
),
+ atapi.StringField(
+ 'shopState',
+ vocabulary=config.STATES,
+ widget=atapi.SelectionWidget(
+ label='State',
+ format='select',
+ label_msgid='shop_state_label',
+ description_msgid='shop_state_desc',
+ ),
+ ),
atapi.StringField('shopCountry',
widget=CountryWidget(label='Country',
format='select',
(at)(at) -401,7 +411,16 (at)(at)
"""
def notifyOfOrder(order):
"""notify customer and shop owner of an order."""
-
+
+
+ def getShippingAddress():
+ """return the shipping address this cart will probably being sent to
+
+ returns IAddress if user is logged in,
+ None otherwise
+ """
+
+
class ICartItem(Interface):
"""interface for an item of the
(at)(at) -653,6 +672,17 (at)(at)
)
),
atapi.StringField(
+ "state",
+ required=1,
+ default='',
+ vocabulary=config.STATES,
+ widget=atapi.SelectionWidget(
+ i18n_domain="vendo",
+ label_msgid="label_statey",
+ description_msgid="help_staate"
+ )
+ ),
+ atapi.StringField(
"country",
required=1,
default='CH',
Modified: Vendo/trunk/shipping.py
==============================================================================
--- Vendo/trunk/shipping.py (original)
+++ Vendo/trunk/shipping.py Wed Jan 25 13:32:43 2006
(at)(at) -75,7 +75,15 (at)(at)
return self.context._get_customer_country() == 'CH'
def isGenf(self):
- # XXX calling _something is a baaad idea
- return self.context._get_customer_zip_int() in range(1200,1300)
+ return self._get_customer_zip_int() in range(1200,1300)
+ def _get_customer_zip_int(self):
+ address = self.context.getShippingAddress()
+ if address is not None:
+ try:
+ intzip = int(address.getZip())
+ except:
+ intzip = 0
+ return intzip
+
Added: Vendo/trunk/tests/test_doctests.py
==============================================================================
--- (empty file)
+++ Vendo/trunk/tests/test_doctests.py Wed Jan 25 13:32:43 2006
(at)(at) -0,0 +1,22 (at)(at)
+# -*- coding: latin1 -*-
+# Copyright (c) 2006 gocept gmbh & co. kg
+# See also LICENSE.txt
+# $Id: test_doctests.py 40 2006-01-19 10:08:45Z zagy $
+
+import common
+
+from Products.Archetypes.tests.doctestcase import ZopeDocTestSuite
+from Products.glome.tests.GlomeTestCase import GlomeTestCase
+
+DOCTESTS = (
+ 'Products.Vendo.vat',
+ 'Products.Vendo.cart',
+)
+
+
+
+
+def test_suite():
+ suite = ZopeDocTestSuite(test_class=GlomeTestCase, *DOCTESTS)
+ return suite
+
Copied: Vendo/trunk/vat.py (from r3807, Vendo/trunk/tax.py)
==============================================================================
--- Vendo/trunk/tax.py (original)
+++ Vendo/trunk/vat.py Wed Jan 25 13:32:43 2006
(at)(at) -22,6 +22,8 (at)(at)
return shop.getVATRate()
+
+
class SwissVAT:
"""VAT inside switzerland
(at)(at) -59,5 +61,49 (at)(at)
return customer_country == shop_country
+class USSalesTax:
+
+ implements(IVATCalculator)
+
+ def __init__(self, context):
+ self.context = context
+
+ def getVATRate(self):
+ """add us sales tax if customer comes from the same state as the shop
+
+ self.login('cheapuser(at)test.gocept.com')
+ >>> shop = portal.shop1
+ >>> cart = shop.getCart()
+ >>> tax = USSalesTax(cart)
+
+ >>> shop.setShopState('WA')
+ >>> addr = shop.getCustomerAddress()
+ >>> addr.getDifferentShippingAddress()
+ False
+
+ >>> addr.edit(state='WA')
+ >>> tax.getVATRate()
+ FixedPoint('10.0000', 4)
+
+ >>> addr.edit(state='VA')
+ >>> tax.getVATRate()
+ FixedPoint('0.0000', 4)
+
+ """
+ cart = self.context
+ shipping_address = cart.getShippingAddress()
+
+ tax = FixedPoint('0.00', 4)
+ if shipping_address is not None:
+ shop = cart.getShop()
+ country = shop.getShopCountry()
+ state = shop.getShopState()
+
+ if (country == shipping_address.getCountry() and
+ state == shipping_address.getState()):
+ # so, we are in the same state -- issue sales tax
+ tax = shop.getVATRate()
+ return tax
+
|
SVN: r3814 - glome/trunk/Extensions
Daniel Havlik <dh(at)gocept.com> |
2006-01-30 13:18:02 |
[ FULL ]
|
Author: nilo
Date: Mon Jan 30 13:17:59 2006
New Revision: 3814
Modified:
glome/trunk/Extensions/Install.py
Log:
delete layer plone_patches in skins when plone version is >= 2.1
Modified: glome/trunk/Extensions/Install.py
==============================================================================
--- glome/trunk/Extensions/Install.py (original)
+++ glome/trunk/Extensions/Install.py Mon Jan 30 13:17:59 2006
(at)(at) -102,6 +102,18 (at)(at)
print >> out, "skipped" + skin,
+def removeSkinLayer(self, out, layer, skin):
+ """removes given layer from given skin"""
+ path = self.portal_skins.getSkinPath(skin)
+ path = [ element.strip() for element in path.split(',') ]
+ if layer in path:
+ path.remove(layer)
+ path = ','.join(path)
+ self.portal_skins.addSkinSelection(skin, path)
+ print >> out, "Removed layer %s from %s" % (layer, skin)
+ else:
+ print >> out, "Layer %s not found in skin %s" % (layer, skin)
+
def addSkin(self, out, name):
ps = getToolByName(self, 'portal_skins')
default_skin = ps.getDefaultSkin()
(at)(at) -301,7 +313,10 (at)(at)
def install_skin(self, out):
install_subskin(self, out, config.GLOBALS)
moveSkinLayerAfter(self, 'glome_scripts', 'custom')
-
+ if plone21:
+ #remove plone_patches layer
+ removeSkinLayer(self, out, 'plone_patches', 'Plone Default')
+ removeSkinLayer(self, out, 'plone_patches', 'Plone Tableless')
def configure_permissions(self, out):
|
|