[Erp5-report] r16171 - /erp5/trunk/products/ERP5Type/Accessor/TypeDefinition.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Sep 8 08:00:19 CEST 2007


Author: vincent
Date: Sat Sep  8 08:00:19 2007
New Revision: 16171

URL: http://svn.erp5.org?rev=16171&view=rev
Log:
Add docstrings.

Modified:
    erp5/trunk/products/ERP5Type/Accessor/TypeDefinition.py

Modified: erp5/trunk/products/ERP5Type/Accessor/TypeDefinition.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Accessor/TypeDefinition.py?rev=16171&r1=16170&r2=16171&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Accessor/TypeDefinition.py (original)
+++ erp5/trunk/products/ERP5Type/Accessor/TypeDefinition.py Sat Sep  8 08:00:19 2007
@@ -28,6 +28,11 @@
 
 from DateTime import DateTime
 
+"""
+  Define the types available in property sheets and a typecasting method for
+  each.
+"""
+
 # By setting ATTRIBUTE_PREFIX to '_', properties become private
 # which allows to force users to use accessors only.
 ATTRIBUTE_PREFIX = ''
@@ -37,6 +42,9 @@
   return value
 
 def asFloat(value):
+  """
+    Return the value as a float or a type-specific default value if it fails.
+  """
   try:
     result = float(value)
   except TypeError:
@@ -44,6 +52,9 @@
   return result
 
 def asDate(value):
+  """
+    Return the value as a date or a type-specific default value if it fails.
+  """
   try:
     if isinstance(value,DateTime):
       result = value
@@ -54,6 +65,9 @@
   return result
 
 def asInt(value):
+  """
+    Return the value as an int or a type-specific default value if it fails.
+  """
   try:
     result = int(value)
   except TypeError:
@@ -61,6 +75,9 @@
   return result
 
 def asLong(value):
+  """
+    Return the value as a long or a type-specific default value if it fails.
+  """
   try:
     result = long(value)
   except TypeError:
@@ -68,6 +85,9 @@
   return result
 
 def asString(value):
+  """
+    Return the value as a string or a type-specific default value if it fails.
+  """
   try:
     if value is None:
       result = ''
@@ -78,6 +98,9 @@
   return result
 
 def asList(value):
+  """
+    Return the value as a list or a type-specific default value if it fails.
+  """
   if type(value) in (type([]), type(())):
     result = list(value)
   elif type(value) is type('a'):




More information about the Erp5-report mailing list