Changeset 4419 for waeup/branches/ulif-rewrite/src
- Timestamp:
- 23 Jul 2009, 00:47:36 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/widgets/table.py
r4404 r4419 57 57 return result 58 58 59 def castValue(self, value, type):60 return value61 if type == 'int':62 return str(value)63 return "'%s'" % value64 65 def castRow(self, row):66 """Lookup type of each column and cast values to strings usable in JS67 code.68 """69 result = []70 for num, value in enumerate(row):71 type = self.cols[num].type72 result.append(self.castValue(value, type))73 return result74 75 59 def getRows(self): 76 60 data_cols = (x.data for x in self.cols) … … 125 109 126 110 127 class YUIStaticTable (grok.View):111 class YUIStaticTableView(grok.View): 128 112 grok.context(Interface) 129 113 grok.name('yuistatictables.js') … … 134 118 provider = ITableProvider(self.context) 135 119 except: 136 # Couldn't find a table provider for the context. Okay, if 137 # the context is a view, we try to lookup the context of 138 # the context... 139 if hasattr(self.context, 'context'): 140 try: 141 print self.context.context 142 provider = ITableProvider(self.context.context) 143 except: 144 return '' 145 else: 146 return '' 120 # No table provider for the context. Be gentle... 121 return '' 147 122 self.response.setHeader('Content-Type', 148 123 'text/javascript; charset=UTF-8')
Note: See TracChangeset for help on using the changeset viewer.