Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def createform(self, xfields):
if self.formstyle == 'table3cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw')
table.append(TR(TD(a,_class='w2p_fl'),
td_b,
TD(c,_class='w2p_fc'),_id=id))
elif self.formstyle == 'table2cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw',_colspan="2")
table.append(TR(TD(a,_class='w2p_fl'),
TD(c,_class='w2p_fc'),_id=id
+'1',_class='even'))
table.append(TR(td_b,_id=id+'2',_class='odd'))
elif self.formstyle == 'divs':
table = TAG['']()
for id,a,b,c in xfields:
div_b = self.field_parent[id] = DIV(b,_class='w2p_fw')
table.append(DIV(DIV(a,_class='w2p_fl'),
div_b,
DIV(c,_class='w2p_fc'),_id=id))
elif self.formstyle == 'ul':
def createform(self, xfields):
if self.formstyle == 'table3cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw')
table.append(TR(TD(a,_class='w2p_fl'),
td_b,
TD(c,_class='w2p_fc'),_id=id))
elif self.formstyle == 'table2cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw',_colspan="2")
table.append(TR(TD(a,_class='w2p_fl'),
TD(c,_class='w2p_fc'),_id=id
+'1',_class='even'))
table.append(TR(td_b,_id=id+'2',_class='odd'))
elif self.formstyle == 'divs':
table = TAG['']()
for id,a,b,c in xfields:
div_b = self.field_parent[id] = DIV(b,_class='w2p_fw')
table.append(DIV(DIV(a,_class='w2p_fl'),
div_b,
DIV(c,_class='w2p_fc'),_id=id))
elif self.formstyle == 'ul':
table = UL()
for id,a,b,c in xfields:
div_b = self.field_parent[id] = DIV(b,_class='w2p_fw')
table.append(LI(DIV(a,_class='w2p_fl'),
r = field.represent(r)
elif field.type == 'blob' and r:
r = 'DATA'
elif field.type == 'upload':
if upload and r:
r = A('file', _href='%s/%s' % (upload, r))
elif r:
r = 'file'
else:
r = ''
elif field.type in ['string','text']:
r = str(field.formatter(r))
ur = unicode(r, 'utf8')
if truncate!=None and len(ur) > truncate:
r = ur[:truncate - 3].encode('utf8') + '...'
row.append(TD(r))
tbody.append(TR(_class=_class, *row))
components.append(TBODY(*tbody))
def createform(self, xfields):
if self.formstyle == 'table3cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw')
table.append(TR(TD(a,_class='w2p_fl'),
td_b,
TD(c,_class='w2p_fc'),_id=id))
elif self.formstyle == 'table2cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw',_colspan="2")
table.append(TR(TD(a,_class='w2p_fl'),
TD(c,_class='w2p_fc'),_id=id
+'1',_class='even'))
table.append(TR(td_b,_id=id+'2',_class='odd'))
elif self.formstyle == 'divs':
table = TAG['']()
for id,a,b,c in xfields:
div_b = self.field_parent[id] = DIV(b,_class='w2p_fw')
table.append(DIV(DIV(a,_class='w2p_fl'),
div_b,
DIV(c,_class='w2p_fc'),_id=id))
elif self.formstyle == 'ul':
table = UL()
for id,a,b,c in xfields:
div_b = self.field_parent[id] = DIV(b,_class='w2p_fw')
table.append(LI(DIV(a,_class='w2p_fl'),
div_b,
value = A('File', _href=upload(value))
elif upload:
value = A('File',
_href='%s/%s' % (upload, value))
else:
value = ''
elif isinstance(value,str):
value = truncate_string(value,maxlength)
else:
value = field.formatter(value)
tr.append(TD(value))
row_buttons = TD(_class='row_buttons')
if links and links_in_grid:
for link in links:
if isinstance(link, dict):
tr.append(TD(link['body'](row)))
else:
if link(row):
row_buttons.append(link(row))
if include_buttons_column:
if details and (not callable(details) or details(row)):
row_buttons.append(gridbutton(
'buttonview', 'View',
url(args=['view',tablename,id])))
if editable and (not callable(editable) or editable(row)):
row_buttons.append(gridbutton(
'buttonedit', 'Edit',
url(args=['edit',tablename,id])))
if deletable and (not callable(deletable) or deletable(row)):
row_buttons.append(gridbutton(
'buttondelete', 'Delete',
callback=url(args=['delete',tablename,id]),
_disabled=True)
elif field.type=='upload':
if value:
if callable(upload):
value = A('File', _href=upload(value))
elif upload:
value = A('File',
_href='%s/%s' % (upload, value))
else:
value = ''
elif isinstance(value,str):
value = truncate_string(value,maxlength)
else:
value = field.formatter(value)
tr.append(TD(value))
row_buttons = TD(_class='row_buttons')
if links and links_in_grid:
for link in links:
if isinstance(link, dict):
tr.append(TD(link['body'](row)))
else:
if link(row):
row_buttons.append(link(row))
if include_buttons_column:
if details and (not callable(details) or details(row)):
row_buttons.append(gridbutton(
'buttonview', 'View',
url(args=['view',tablename,id])))
if editable and (not callable(editable) or editable(row)):
row_buttons.append(gridbutton(
'buttonedit', 'Edit',
url(args=['edit',tablename,id])))
def createform(self, xfields):
if self.formstyle == 'table3cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw')
table.append(TR(TD(a,_class='w2p_fl'),
td_b,
TD(c,_class='w2p_fc'),_id=id))
elif self.formstyle == 'table2cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw',_colspan="2")
table.append(TR(TD(a,_class='w2p_fl'),
TD(c,_class='w2p_fc'),_id=id
+'1',_class='even'))
table.append(TR(td_b,_id=id+'2',_class='odd'))
elif self.formstyle == 'divs':
table = TAG['']()
for id,a,b,c in xfields:
div_b = self.field_parent[id] = DIV(b,_class='w2p_fw')
table.append(DIV(DIV(a,_class='w2p_fl'),
div_b,
DIV(c,_class='w2p_fc'),_id=id))
elif self.formstyle == 'ul':
table = UL()
for id,a,b,c in xfields:
div_b = self.field_parent[id] = DIV(b,_class='w2p_fw')
table.append(LI(DIV(a,_class='w2p_fl'),
def createform(self, xfields):
if self.formstyle == 'table3cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw')
table.append(TR(TD(a,_class='w2p_fl'),
td_b,
TD(c,_class='w2p_fc'),_id=id))
elif self.formstyle == 'table2cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw',_colspan="2")
table.append(TR(TD(a,_class='w2p_fl'),
TD(c,_class='w2p_fc'),_id=id
+'1',_class='even'))
table.append(TR(td_b,_id=id+'2',_class='odd'))
elif self.formstyle == 'divs':
table = TAG['']()
for id,a,b,c in xfields:
div_b = self.field_parent[id] = DIV(b,_class='w2p_fw')
table.append(DIV(DIV(a,_class='w2p_fl'),
div_b,
DIV(c,_class='w2p_fc'),_id=id))
elif self.formstyle == 'ul':
table = UL()
for id,a,b,c in xfields:
div_b = self.field_parent[id] = DIV(b,_class='w2p_fw')
table.append(LI(DIV(a,_class='w2p_fl'),
div_b,
DIV(c,_class='w2p_fc'),_id=id))
value = A('File', _href=upload(value))
elif upload:
value = A('File',
_href='%s/%s' % (upload, value))
else:
value = ''
elif isinstance(value,str):
value = truncate_string(value,maxlength)
else:
value = field.formatter(value)
tr.append(TD(value))
row_buttons = TD(_class='row_buttons')
if links and links_in_grid:
for link in links:
if isinstance(link, dict):
tr.append(TD(link['body'](row)))
else:
if link(row):
row_buttons.append(link(row))
if include_buttons_column:
if details and (not callable(details) or details(row)):
row_buttons.append(gridbutton(
'buttonview', 'View',
url(args=['view',tablename,id])))
if editable and (not callable(editable) or editable(row)):
row_buttons.append(gridbutton(
'buttonedit', 'Edit',
url(args=['edit',tablename,id])))
if deletable and (not callable(deletable) or deletable(row)):
row_buttons.append(gridbutton(
'buttondelete', 'Delete',
callback=url(args=['delete',tablename,id]),
def createform(self, xfields):
if self.formstyle == 'table3cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw')
table.append(TR(TD(a,_class='w2p_fl'),
td_b,
TD(c,_class='w2p_fc'),_id=id))
elif self.formstyle == 'table2cols':
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw',_colspan="2")
table.append(TR(TD(a,_class='w2p_fl'),
TD(c,_class='w2p_fc'),_id=id
+'1',_class='even'))
table.append(TR(td_b,_id=id+'2',_class='odd'))
elif self.formstyle == 'divs':
table = TAG['']()
for id,a,b,c in xfields:
div_b = self.field_parent[id] = DIV(b,_class='w2p_fw')
table.append(DIV(DIV(a,_class='w2p_fl'),
div_b,