/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Model/table.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Model/table.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1960 by bh, Mon Nov 3 17:33:36 2003 UTC revision 1961 by bh, Wed Nov 19 15:46:03 2003 UTC
# Line 33  dbflib_fieldtypes = {dbflib.FTString: FI Line 33  dbflib_fieldtypes = {dbflib.FTString: FI
33                       dbflib.FTDouble: FIELDTYPE_DOUBLE}                       dbflib.FTDouble: FIELDTYPE_DOUBLE}
34    
35    
 class OldTableInterfaceMixin:  
   
     """Mixin to implement the old table interface using the new one"""  
   
     def __deprecation_warning(self):  
         """Issue a DeprecationWarning for code hat uses the old interface"""  
         callername = inspect.currentframe().f_back.f_code.co_name  
         warnings.warn("The %s method of the old table interface"  
                       " is deprecated" % callername,  
                       DeprecationWarning, stacklevel = 3)  
   
     def record_count(self):  
         self.__deprecation_warning()  
         return self.NumRows()  
   
     def field_count(self):  
         self.__deprecation_warning()  
         return self.NumColumns()  
   
     def field_info(self, field):  
         """Return a tuple (type, name, width, prec) for the field no. field  
   
         type is the data type of the field, name the name, width the  
         field width in characters and prec the decimal precision. width  
         and prec will be zero if the information returned by the Column  
         method doesn't provide values for them.  
         """  
         self.__deprecation_warning()  
         col = self.Column(field)  
         return (col.type, col.name,  
                getattr(col, "width", 0), getattr(col, "prec", 0))  
   
     def field_info_by_name(self, col):  
         self.__deprecation_warning()  
         try:  
             return self.field_info(col)  
         except KeyError:  
             # FIXME: It may be that field_info raises other exceptions  
             # when the name is not a valid column name.  
             return None  
   
     def field_range(self, fieldName):  
         self.__deprecation_warning()  
         min, max = self.ValueRange(fieldName)  
         return ((min, None), (max, None))  
   
     def GetUniqueValues(self, field):  
         self.__deprecation_warning()  
         return self.UniqueValues(field)  
   
     def read_record(self, r):  
         self.__deprecation_warning()  
         return self.ReadRowAsDict(r)  
   
   
   
36  class DBFColumn:  class DBFColumn:
37    
38      """Description of a column in a DBFTable      """Description of a column in a DBFTable
# Line 111  class DBFColumn: Line 55  class DBFColumn:
55          self.index = index          self.index = index
56    
57    
58  class DBFTable(TitledObject, OldTableInterfaceMixin):  class DBFTable(TitledObject):
59    
60      """      """
61      Table interface for the data in a DBF file      Table interface for the data in a DBF file
# Line 301  class MemoryColumn: Line 245  class MemoryColumn:
245          self.type = type          self.type = type
246          self.index = index          self.index = index
247    
248  class MemoryTable(TitledObject, OldTableInterfaceMixin):  class MemoryTable(TitledObject):
249    
250      """Very simple table implementation that operates on a list of tuples"""      """Very simple table implementation that operates on a list of tuples"""
251    

Legend:
Removed from v.1960  
changed lines
  Added in v.1961

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26