[Erp5-report] r39078 yo - /erp5/trunk/products/ERP5Type/Base.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Oct 13 05:02:44 CEST 2010
Author: yo
Date: Wed Oct 13 05:02:42 2010
New Revision: 39078
URL: http://svn.erp5.org?rev=39078&view=rev
Log:
Allow a default precision to be specified.
Modified:
erp5/trunk/products/ERP5Type/Base.py
Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=39078&r1=39077&r2=39078&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Base.py [utf8] Wed Oct 13 05:02:42 2010
@@ -3482,7 +3482,7 @@ class Base( CopyContainer,
self.id = self.id
# Helpers
- def getQuantityPrecisionFromResource(self, resource):
+ def getQuantityPrecisionFromResource(self, resource, d=2):
"""
Provides a quick access to precision without accessing the resource
value in ZODB. Here resource is the relative_url of the resource, such as
@@ -3493,14 +3493,17 @@ class Base( CopyContainer,
resource_value = self.portal_categories.resolveCategory(resource)
if resource_value is not None:
return resource_value.getQuantityPrecision()
- return 0
+ return None
cached_getQuantityPrecisionFromResource = CachingMethod(
cached_getQuantityPrecisionFromResource,
id='Base_getQuantityPrecisionFromResource',
cache_factory='erp5_content_short')
- return cached_getQuantityPrecisionFromResource(resource)
+ precision = cached_getQuantityPrecisionFromResource(resource)
+ if precision is None:
+ precision = d
+ return precision
# Documentation Helpers
More information about the Erp5-report
mailing list