コード例 #1
0
ファイル: field.py プロジェクト: Raptus/raptus.article.table
 def get(self, instance, **kwargs):
     value = LinesField.get(self, instance, **kwargs) or ()
     columns = []
     for column in value:
         try:
             columns.append(loads(column))
         except: # BBB
             try:
                 columns.append(parseColumn(column))
             except:
                 pass
     return columns
コード例 #2
0
 def parseColumns(self, columns):
     ignore = 1
     cols = []
     for column in columns:
         try:
             # BBB
             if not isinstance(column, dict):
                 column = parseColumn(column)
             column['ignore'] = ignore > 1
             ignore = max(1, ignore-1)
             if column.get('colspan', 0):
                 ignore = int(column['colspan'])
             utility = component.getUtility(IType, column['type'])
             column['utility'] = utility
             cols.append(column)
         except:
             pass
     return cols