dabo Commit
Revision 4031
Date: 2008-04-06 09:02:35 -0700 (Sun, 06 Apr 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4031

Changed:
U   trunk/dabo/biz/dBizobj.py

Log:
Added the getDataTypeForField() method. This will return the Python data type 
for a given field in the dataset, or raise a ValueError if the field is not in 
the dataset.


Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py   2008-04-06 00:24:53 UTC (rev 4030)
+++ trunk/dabo/biz/dBizobj.py   2008-04-06 16:02:35 UTC (rev 4031)
@@ -1440,6 +1440,21 @@
                return self._CurrentCursor.getFieldInfoFromDescription()
 
 
+       def getDataTypeForField(self, fld):
+               """Given a field name, returns its Python type, or None if no 
+               DataStructure information is available.
+               """
+               ds = self.getDataStructure()
+               if not ds:
+                       return None
+               try:
+                       fldInfo = [rec[1] for rec in ds
+                                       if rec[0] == fld][0]
+               except IndexError:
+                       raise ValueError, _("Field '%s' does not exist in the 
DataStructure") % fld
+               return dabo.db.getPythonType(fldInfo)
+
+
        def getParams(self):
                """ Return the parameters to send to the cursor's execute 
method.
 




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to