[Erp5-report] r12351 - /erp5/trunk/products/ERP5Type/Base.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Jan 24 18:33:32 CET 2007
Author: jerome
Date: Wed Jan 24 18:33:31 2007
New Revision: 12351
URL: http://svn.erp5.org?rev=12351&view=rev
Log:
getQuantityPrecisionFromResource ignores empty strings, so that you can safely
call doc.getQuantityPrecisionFromResource(doc.getResource()) even if resource
is not set on doc.
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=12351&r1=12350&r2=12351&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py (original)
+++ erp5/trunk/products/ERP5Type/Base.py Wed Jan 24 18:33:31 2007
@@ -2541,12 +2541,14 @@
def getQuantityPrecisionFromResource(self, resource):
"""
Provides a quick access to precision without accessing the resource
- value in ZODB
+ value in ZODB. Here resource is the relative_url of the resource, such as
+ the result of self.getResource().
"""
def cached_getQuantityPrecisionFromResource(resource):
- resource_value = self.portal_categories.resolveCategory(resource)
- if resource_value is not None:
- return resource_value.getQuantityPrecision()
+ if resource:
+ resource_value = self.portal_categories.resolveCategory(resource)
+ if resource_value is not None:
+ return resource_value.getQuantityPrecision()
return 0
cached_getQuantityPrecisionFromResource = CachingMethod(
More information about the Erp5-report
mailing list