Added an "Auto-dectect" button to the Edit (metadata) Attributes form.

Cleaned up some bugs in Bed and Interval set_meta associated functions.
set_meta() will no longer be called prior to the edit form being displayed since doing this displayed attribute values that were not from the database (misleading the user).
This commit is contained in:
Greg Von Kuster
2007-11-12 22:20:06 +00:00
parent 6eaa6d511c
commit f638adb5d3
6 changed files with 23 additions and 13 deletions
+1 -1
View File
@@ -234,7 +234,7 @@ class Bed( Interval ):
def missing_meta( self, dataset ):
"""Checks for empty meta values"""
return Tabular.missing_meta(self, dataset)
return Interval.missing_meta(self, dataset)
def init_meta( self, dataset, copy_from=None ):
Interval.init_meta( self, dataset, copy_from=copy_from )
-5
View File
@@ -134,8 +134,3 @@ class Tabular( data.Text ):
m_peek = self.make_html_table( dataset.peek )
return m_peek
def before_edit( self, dataset ):
data.Text.before_edit( self, dataset )
if self.missing_meta( dataset ):
self.set_meta( dataset )
-2
View File
@@ -24,8 +24,6 @@ class DynamicOptions( object ):
while '' indicates that it is not. Currently dynamically generated select lists do not work well with optional datasets.
"""
return None
# TODO: this can be eliminated after Dan's script is run.
#dataset.set_meta()
return dataset
def get_param_ref( self, trans, other_values ):
if self.param_ref is None: return None
-2
View File
@@ -610,8 +610,6 @@ class ColumnListParameter( SelectToolParameter ):
# while '' indicates that it is not. Currently column
# parameters do not work well with optional datasets
return column_list
# Just to be safe... (FIXME: Is this still neccesary?)
#dataset.set_meta()
# Generate options
if not dataset.metadata.columns:
if self.accept_default:
+13 -2
View File
@@ -162,6 +162,7 @@ class Universe( BaseController ):
@web.expose
def edit(self, trans, id=None, hid=None, **kwd):
"""Returns data directly into the browser. Sets the mime-type according to the extension"""
if hid is not None:
history = trans.get_history()
# TODO: hid handling
@@ -176,7 +177,7 @@ class Universe( BaseController ):
p = util.Params(kwd, safe=False)
if p.change:
"""Ths user clicked the Save button on the 'Change data type' form"""
"""The user clicked the Save button on the 'Change data type' form"""
trans.app.datatypes_registry.change_datatype( data, p.datatype )
trans.app.model.flush()
elif p.save:
@@ -197,7 +198,17 @@ class Universe( BaseController ):
data.datatype.after_edit( data )
trans.app.model.flush()
return trans.fill_template( "edit_complete.tmpl" )
elif p.detect:
"""The user clicked the Auto-detect button on the 'Edit Attributes' form"""
for name, spec in data.datatype.metadata_spec.items():
# We need to be careful about the attributes we are resetting
if name != 'name' and name != 'info' and name != 'dbkey':
if spec.get( 'default' ):
setattr( data.metadata,name,spec.unwrap( spec.get( 'default' ), spec ))
data.datatype.set_meta( data )
data.datatype.after_edit( data )
trans.app.model.flush()
return trans.fill_template( "edit_complete.tmpl" )
elif p.convert_data:
"""The user clicked the Convert button on the 'Convert to new format' form"""
+9 -1
View File
@@ -62,6 +62,14 @@
<div style="clear: both"></div>
</div>
#end for
<div style="float: left; width: 250px; margin-right: 10px;">
<input type="submit" name="detect" value="Auto-detect">
</div>
<div class="toolParamHelp" style="clear: both;">
This will inspect the dataset and attempt to correct the above column values
if they are not accurate.
</div>
<br/>
<div class="form-row">
<input type="submit" name="save" value="Save">
</div>
@@ -133,6 +141,6 @@
</form>
</div>
</div>
</body>
</html>