Crude check on the edit form. Checks to make sure all of the column assignments are numbers (strand is allowed to be empty) greater than zero.

This commit is contained in:
Ian Schenck
2007-05-16 18:12:41 +00:00
parent 0f3f301db4
commit a94811d6d0
2 changed files with 17 additions and 1 deletions
+14 -1
View File
@@ -156,6 +156,19 @@ class Universe(common.Root):
p = util.Params(kwd, safe=False)
if p.edit_genome_btn:
err = None
# check for "valid" column assignments first
for attr in 'chromCol', 'startCol', 'endCol', 'strandCol':
try:
num = int( getattr(p, attr) )
if num < 0: raise Exception()
except:
if getattr(p, attr) != "" or attr != 'strandCol':
err = "Column assignments must be numbers greater than zero. Strand column may be ommitted (set to 0)."
if err:
trans.log_event( "Edit submitted bad values on dataset %s" % str(id) )
return trans.fill_template( "edit.tmpl", data=data, dbnames=util.dbnames, err=err )
data.name = p.name
data.info = p.info
data.dbkey = p.dbkey
@@ -187,7 +200,7 @@ class Universe(common.Root):
return trans.fill_template( "edit_complete.tmpl" )
else:
trans.log_event( "Opened edit view on dataset %s" % str(id) )
return trans.fill_template( "edit.tmpl", data=data, dbnames=util.dbnames )
return trans.fill_template( "edit.tmpl", data=data, dbnames=util.dbnames, err=None )
@web.expose
def delete( self, trans, id = None, **kwd):
+3
View File
@@ -69,6 +69,9 @@
<p>Strand: <input type="textfield" size="2" name="strandCol" value=""> </p>
</div>
#end if
#if $err
<div style="color: red; font-style: italic; padding-top: 1px; padding-bottom: 3px;">$err</div>
#end if
<p><b>Note:</b> The strand column is optional.</p>
</div>
</td>