commit/galaxy-central: 3 new changesets
3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ce4c7a3fb0d8/ Changeset: ce4c7a3fb0d8 User: jgoecks Date: 2013-08-30 20:09:18 Summary: Use super() to call dictify() rather than calling directly. Affected #: 1 file diff -r 9345e15ec4b7f81271a071f0703e89fff0c5b3ac -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -2342,7 +2342,7 @@ self.tags.append(new_swta) def dictify( self, view='collection', value_mapper = None ): - rval = DictifiableMixin.dictify(self, view=view, value_mapper = value_mapper) + rval = super( StoredWorkflow, self ).dictify(self, view=view, value_mapper = value_mapper) tags_str_list = [] for tag in self.tags: tag_str = tag.user_tname @@ -3831,7 +3831,7 @@ return [ tool_version.tool_id for tool_version in self.get_versions( app ) ] def dictify( self, view='element' ): - rval = DictifiableMixin.dictify(self, view) + rval = super( ToolVersion, self ).dictify( self, view ) rval['tool_name'] = self.tool_id for a in self.parent_tool_association: rval['parent_tool_id'] = a.parent_id https://bitbucket.org/galaxy/galaxy-central/commits/a4259a97c287/ Changeset: a4259a97c287 User: jgoecks Date: 2013-08-30 20:17:23 Summary: DictifiableMixin cleanup: (a) remove 'Mixin' from name and (b) rename dictify to to_dict. Affected #: 32 files diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -23,7 +23,7 @@ import galaxy.datatypes.registry import galaxy.security.passwords from galaxy.datatypes.metadata import MetadataCollection -from galaxy.model.item_attrs import DictifiableMixin, UsesAnnotations +from galaxy.model.item_attrs import Dictifiable, UsesAnnotations from galaxy.security import get_permitted_actions from galaxy.util import is_multi_byte, nice_size, Params, restore_text, send_mail from galaxy.util.bunch import Bunch @@ -61,15 +61,15 @@ datatypes_registry = d_registry -class User( object, DictifiableMixin ): +class User( object, Dictifiable ): use_pbkdf2 = True """ Data for a Galaxy user or admin and relations to their histories, credentials, and roles. """ - # attributes that will be accessed and returned when calling dictify( view='collection' ) + # attributes that will be accessed and returned when calling to_dict( view='collection' ) dict_collection_visible_keys = ( 'id', 'email' ) - # attributes that will be accessed and returned when calling dictify( view='element' ) + # attributes that will be accessed and returned when calling to_dict( view='element' ) dict_element_visible_keys = ( 'id', 'email', 'username', 'total_disk_usage', 'nice_total_disk_usage' ) def __init__( self, email=None, password=None ): @@ -157,7 +157,7 @@ return total -class Job( object, DictifiableMixin ): +class Job( object, Dictifiable ): dict_collection_visible_keys = [ 'id' ] dict_element_visible_keys = [ 'id' ] @@ -363,8 +363,8 @@ dataset.blurb = 'deleted' dataset.peek = 'Job deleted' dataset.info = 'Job output deleted by user before job completed' - def dictify( self, view='collection' ): - rval = super( Job, self ).dictify( view=view ) + def to_dict( self, view='collection' ): + rval = super( Job, self ).to_dict( view=view ) rval['tool_name'] = self.tool_id param_dict = dict( [ ( p.name, p.value ) for p in self.parameters ] ) rval['params'] = param_dict @@ -649,7 +649,7 @@ else: return False -class Group( object, DictifiableMixin ): +class Group( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'name' ) dict_element_visible_keys = ( 'id', 'name' ) @@ -662,7 +662,7 @@ self.user = user self.group = group -class History( object, DictifiableMixin, UsesAnnotations ): +class History( object, Dictifiable, UsesAnnotations ): dict_collection_visible_keys = ( 'id', 'name', 'published', 'deleted' ) dict_element_visible_keys = ( 'id', 'name', 'published', 'deleted', 'genome_build', 'purged' ) @@ -780,10 +780,10 @@ history_name = unicode(history_name, 'utf-8') return history_name - def dictify( self, view='collection', value_mapper = None ): + def to_dict( self, view='collection', value_mapper = None ): # Get basic value. - rval = super( History, self ).dictify( view=view, value_mapper=value_mapper ) + rval = super( History, self ).to_dict( view=view, value_mapper=value_mapper ) # Add tags. tags_str_list = [] @@ -869,7 +869,7 @@ self.group = group self.role = role -class Role( object, DictifiableMixin ): +class Role( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'name' ) dict_element_visible_keys = ( 'id', 'name', 'description', 'type' ) private_id = None @@ -886,19 +886,19 @@ self.type = type self.deleted = deleted -class UserQuotaAssociation( object, DictifiableMixin ): +class UserQuotaAssociation( object, Dictifiable ): dict_element_visible_keys = ( 'user', ) def __init__( self, user, quota ): self.user = user self.quota = quota -class GroupQuotaAssociation( object, DictifiableMixin ): +class GroupQuotaAssociation( object, Dictifiable ): dict_element_visible_keys = ( 'group', ) def __init__( self, group, quota ): self.group = group self.quota = quota -class Quota( object, DictifiableMixin ): +class Quota( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'name' ) dict_element_visible_keys = ( 'id', 'name', 'description', 'bytes', 'operation', 'display_amount', 'default', 'users', 'groups' ) valid_operations = ( '+', '-', '=' ) @@ -927,7 +927,7 @@ else: return nice_size( self.bytes ) -class DefaultQuotaAssociation( Quota, DictifiableMixin ): +class DefaultQuotaAssociation( Quota, Dictifiable ): dict_element_visible_keys = ( 'type', ) types = Bunch( UNREGISTERED = 'unregistered', @@ -1508,7 +1508,7 @@ return msg -class HistoryDatasetAssociation( DatasetInstance, DictifiableMixin, UsesAnnotations ): +class HistoryDatasetAssociation( DatasetInstance, Dictifiable, UsesAnnotations ): """ Resource class that creates a relation between a dataset and a user history. """ @@ -1680,7 +1680,7 @@ rval += child.get_disk_usage( user ) return rval - def dictify( self, view='collection' ): + def to_dict( self, view='collection' ): """ Return attributes of this HDA that are exposed using the API. """ @@ -1759,7 +1759,7 @@ self.subset = subset self.location = location -class Library( object, DictifiableMixin ): +class Library( object, Dictifiable ): permitted_actions = get_permitted_actions( filter='LIBRARY' ) dict_collection_visible_keys = ( 'id', 'name' ) dict_element_visible_keys = ( 'id', 'deleted', 'name', 'description', 'synopsis' ) @@ -1828,7 +1828,7 @@ name = unicode( name, 'utf-8' ) return name -class LibraryFolder( object, DictifiableMixin ): +class LibraryFolder( object, Dictifiable ): dict_element_visible_keys = ( 'id', 'parent_id', 'name', 'description', 'item_count', 'genome_build' ) def __init__( self, name=None, description=None, item_count=0, order_id=None ): self.name = name or "Unnamed folder" @@ -1900,8 +1900,8 @@ if isinstance( name, str ): name = unicode( name, 'utf-8' ) return name - def dictify( self, view='collection' ): - rval = super( LibraryFolder, self ).dictify( view=view ) + def to_dict( self, view='collection' ): + rval = super( LibraryFolder, self ).to_dict( view=view ) info_association, inherited = self.get_info_association() if info_association: if inherited: @@ -1966,7 +1966,7 @@ name = property( get_name, set_name ) def display_name( self ): self.library_dataset_dataset_association.display_name() - def dictify( self, view='collection' ): + def to_dict( self, view='collection' ): # Since this class is a proxy to rather complex attributes we want to # display in other objects, we can't use the simpler method used by # other model classes. @@ -2096,7 +2096,7 @@ if restrict: return None, inherited return self.library_dataset.folder.get_info_association( inherited=True ) - def dictify( self, view='collection' ): + def to_dict( self, view='collection' ): # Since this class is a proxy to rather complex attributes we want to # display in other objects, we can't use the simpler method used by # other model classes. @@ -2323,7 +2323,7 @@ self.id = None self.user = None -class StoredWorkflow( object, DictifiableMixin): +class StoredWorkflow( object, Dictifiable): dict_collection_visible_keys = ( 'id', 'name', 'published' ) dict_element_visible_keys = ( 'id', 'name', 'published' ) def __init__( self ): @@ -2341,8 +2341,8 @@ new_swta.user = target_user self.tags.append(new_swta) - def dictify( self, view='collection', value_mapper = None ): - rval = super( StoredWorkflow, self ).dictify(self, view=view, value_mapper = value_mapper) + def to_dict( self, view='collection', value_mapper = None ): + rval = super( StoredWorkflow, self ).to_dict(self, view=view, value_mapper = value_mapper) tags_str_list = [] for tag in self.tags: tag_str = tag.user_tname @@ -2434,7 +2434,7 @@ return os.path.abspath( os.path.join( path, "metadata_%d.dat" % self.id ) ) -class FormDefinition( object, DictifiableMixin ): +class FormDefinition( object, Dictifiable ): # The following form_builder classes are supported by the FormDefinition class. supported_field_types = [ AddressField, CheckboxField, PasswordField, SelectField, TextArea, TextField, WorkflowField, WorkflowMappingField, HistoryField ] types = Bunch( REQUEST = 'Sequencing Request Form', @@ -2562,7 +2562,7 @@ self.form_definition = form_def self.content = content -class Request( object, DictifiableMixin ): +class Request( object, Dictifiable ): states = Bunch( NEW = 'New', SUBMITTED = 'In Progress', REJECTED = 'Rejected', @@ -2753,7 +2753,7 @@ def populate_actions( self, trans, item, param_dict=None ): return self.get_external_service_type( trans ).actions.populate( self, item, param_dict=param_dict ) -class RequestType( object, DictifiableMixin ): +class RequestType( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'name', 'desc' ) dict_element_visible_keys = ( 'id', 'name', 'desc', 'request_form_id', 'sample_form_id' ) rename_dataset_options = Bunch( NO = 'Do not rename', @@ -2839,7 +2839,7 @@ self.request_type = request_type self.role = role -class Sample( object, DictifiableMixin ): +class Sample( object, Dictifiable ): # The following form_builder classes are supported by the Sample class. supported_field_types = [ CheckboxField, SelectField, TextField, WorkflowField, WorkflowMappingField, HistoryField ] bulk_operations = Bunch( CHANGE_STATE = 'Change state', @@ -3169,7 +3169,7 @@ def __str__ ( self ): return "Tag(id=%s, type=%i, parent_id=%s, name=%s)" % ( self.id, self.type, self.parent_id, self.name ) -class ItemTagAssociation ( object, DictifiableMixin ): +class ItemTagAssociation ( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'user_tname', 'user_value' ) dict_element_visible_keys = dict_collection_visible_keys @@ -3350,7 +3350,7 @@ self.error_message = error_message def as_dict( self, value_mapper=None ): - return self.dictify( view='element', value_mapper=value_mapper ) + return self.to_dict( view='element', value_mapper=value_mapper ) @property def can_install( self ): @@ -3372,7 +3372,7 @@ def can_reinstall_or_activate( self ): return self.deleted - def dictify( self, view='collection', value_mapper=None ): + def to_dict( self, view='collection', value_mapper=None ): if value_mapper is None: value_mapper = {} rval = {} @@ -3772,7 +3772,7 @@ self.tool_shed_repository.name, self.tool_shed_repository.installed_changeset_revision ) -class ToolVersion( object, DictifiableMixin ): +class ToolVersion( object, Dictifiable ): dict_element_visible_keys = ( 'id', 'tool_shed_repository' ) def __init__( self, id=None, create_time=None, tool_id=None, tool_shed_repository=None ): self.id = id @@ -3830,8 +3830,8 @@ return version_ids return [ tool_version.tool_id for tool_version in self.get_versions( app ) ] - def dictify( self, view='element' ): - rval = super( ToolVersion, self ).dictify( self, view ) + def to_dict( self, view='element' ): + rval = super( ToolVersion, self ).to_dict( self, view ) rval['tool_name'] = self.tool_id for a in self.parent_tool_association: rval['parent_tool_id'] = a.parent_id diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/model/item_attrs.py --- a/lib/galaxy/model/item_attrs.py +++ b/lib/galaxy/model/item_attrs.py @@ -158,12 +158,12 @@ class_name = '%sAnnotationAssociation' % item.__class__.__name__ return getattr( galaxy.model, class_name, None ) -class DictifiableMixin: +class Dictifiable: """ Mixin that enables objects to be converted to dictionaries. This is useful when for sharing objects across boundaries, such as the API, tool scripts, and JavaScript code. """ - def dictify( self, view='collection', value_mapper=None ): + def to_dict( self, view='collection', value_mapper=None ): """ Return item dictionary. """ @@ -176,9 +176,9 @@ Recursive helper function to get item values. """ # FIXME: why use exception here? Why not look for key in value_mapper - # first and then default to dictify? + # first and then default to to_dict? try: - return item.dictify( view=view, value_mapper=value_mapper ) + return item.to_dict( view=view, value_mapper=value_mapper ) except: if key in value_mapper: return value_mapper.get( key )( item ) @@ -193,7 +193,7 @@ try: visible_keys = self.__getattribute__( 'dict_' + view + '_visible_keys' ) except AttributeError: - raise Exception( 'Unknown DictifiableMixin view: %s' % view ) + raise Exception( 'Unknown Dictifiable view: %s' % view ) for key in visible_keys: try: item = self.__getattribute__( key ) diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/model/search.py --- a/lib/galaxy/model/search.py +++ b/lib/galaxy/model/search.py @@ -560,7 +560,7 @@ return self.view.get_results(True) def item_to_api_value(self, item): - r = item.dictify( view='element' ) + r = item.to_dict( view='element' ) if self.query.field_list.count("*"): return r o = {} diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -59,7 +59,7 @@ from galaxy.util.template import fill_template from galaxy.web import url_for from galaxy.web.form_builder import SelectField -from galaxy.model.item_attrs import DictifiableMixin +from galaxy.model.item_attrs import Dictifiable from tool_shed.util import shed_util_common from .loader import load_tool, template_macro_params @@ -93,16 +93,16 @@ class ToolNotFoundException( Exception ): pass -def dictify_helper( obj, kwargs ): - """ Helper function that provides the appropriate kwargs to dictify an object. """ +def to_dict_helper( obj, kwargs ): + """ Helper function that provides the appropriate kwargs to to_dict an object. """ - # Label.dictify cannot have kwargs. + # Label.to_dict cannot have kwargs. if isinstance( obj, ToolSectionLabel ): kwargs = {} - return obj.dictify( **kwargs ) + return obj.to_dict( **kwargs ) -class ToolBox( object, DictifiableMixin ): +class ToolBox( object, Dictifiable ): """Container for a collection of tools""" def __init__( self, config_filenames, tool_root_dir, app ): @@ -711,9 +711,9 @@ """ return self.app.model.context - def dictify( self, trans, in_panel=True, **kwds ): + def to_dict( self, trans, in_panel=True, **kwds ): """ - Dictify toolbox. + to_dict toolbox. """ context = Bunch( toolbox=self, trans=trans, **kwds ) @@ -736,11 +736,11 @@ link_details = True ) for elt in panel_elts: - rval.append( dictify_helper( elt, kwargs ) ) + rval.append( to_dict_helper( elt, kwargs ) ) else: tools = [] for id, tool in self.tools_by_id.items(): - tools.append( tool.dictify( trans, link_details=True ) ) + tools.append( tool.to_dict( trans, link_details=True ) ) rval = tools return rval @@ -801,7 +801,7 @@ -class ToolSection( object, DictifiableMixin ): +class ToolSection( object, Dictifiable ): """ A group of tools with similar type/purpose that will be displayed as a group in the user interface. @@ -824,22 +824,22 @@ copy.elems = self.elems.copy() return copy - def dictify( self, trans, link_details=False ): + def to_dict( self, trans, link_details=False ): """ Return a dict that includes section's attributes. """ - section_dict = super( ToolSection, self ).dictify() + section_dict = super( ToolSection, self ).to_dict() section_elts = [] kwargs = dict( trans = trans, link_details = link_details ) for elt in self.elems.values(): - section_elts.append( dictify_helper( elt, kwargs ) ) + section_elts.append( to_dict_helper( elt, kwargs ) ) section_dict[ 'elems' ] = section_elts return section_dict -class ToolSectionLabel( object, DictifiableMixin ): +class ToolSectionLabel( object, Dictifiable ): """ A label for a set of tools that can be displayed above groups of tools and sections in the user interface @@ -898,7 +898,7 @@ self.rerun_remap_job_id = None self.inputs = params_from_strings( tool.inputs, values, app, ignore_errors=True ) -class ToolOutput( object, DictifiableMixin ): +class ToolOutput( object, Dictifiable ): """ Represents an output datasets produced by a tool. For backward compatibility this behaves as if it were the tuple:: @@ -948,7 +948,7 @@ self.type = type self.version = version -class Tool( object, DictifiableMixin ): +class Tool( object, Dictifiable ): """ Represents a computational tool that can be executed through Galaxy. """ @@ -2962,11 +2962,11 @@ self.sa_session.flush() return primary_datasets - def dictify( self, trans, link_details=False, io_details=False ): + def to_dict( self, trans, link_details=False, io_details=False ): """ Returns dict of tool. """ # Basic information - tool_dict = super( Tool, self ).dictify() + tool_dict = super( Tool, self ).to_dict() # Add link details. if link_details: @@ -2983,8 +2983,8 @@ # Add input and output details. if io_details: - tool_dict[ 'inputs' ] = [ input.dictify( trans ) for input in self.inputs.values() ] - tool_dict[ 'outputs' ] = [ output.dictify() for output in self.outputs.values() ] + tool_dict[ 'inputs' ] = [ input.to_dict( trans ) for input in self.inputs.values() ] + tool_dict[ 'outputs' ] = [ output.to_dict() for output in self.outputs.values() ] return tool_dict diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -12,12 +12,12 @@ import validation, dynamic_options # For BaseURLToolParameter from galaxy.web import url_for -from galaxy.model.item_attrs import DictifiableMixin +from galaxy.model.item_attrs import Dictifiable import galaxy.model log = logging.getLogger(__name__) -class ToolParameter( object, DictifiableMixin ): +class ToolParameter( object, Dictifiable ): """ Describes a parameter accepted by a tool. This is just a simple stub at the moment but in the future should encapsulate more complex parameters (lists @@ -170,10 +170,10 @@ for validator in self.validators: validator.validate( value, history ) - def dictify( self, trans, view='collection', value_mapper=None ): - """ Dictify tool parameter. This can be overridden by subclasses. """ + def to_dict( self, trans, view='collection', value_mapper=None ): + """ to_dict tool parameter. This can be overridden by subclasses. """ - tool_dict = super( ToolParameter, self ).dictify() + tool_dict = super( ToolParameter, self ).to_dict() tool_dict[ 'html' ] = urllib.quote( self.get_html( trans ) ) if hasattr( self, 'value' ): tool_dict[ 'value' ] = self.value @@ -872,8 +872,8 @@ else: return [] - def dictify( self, trans, view='collection', value_mapper=None ): - d = super( SelectToolParameter, self ).dictify( trans ) + def to_dict( self, trans, view='collection', value_mapper=None ): + d = super( SelectToolParameter, self ).to_dict( trans ) # Get options, value. options = self.get_options( trans, [] ) diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/tools/parameters/grouping.py --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -15,9 +15,9 @@ from galaxy.util import sanitize_for_filename from galaxy.util.bunch import Bunch from galaxy.util.expressions import ExpressionContext -from galaxy.model.item_attrs import DictifiableMixin +from galaxy.model.item_attrs import Dictifiable -class Group( object, DictifiableMixin ): +class Group( object, Dictifiable ): dict_collection_visible_keys = ( 'name', 'type' ) @@ -48,9 +48,9 @@ """ raise TypeError( "Not implemented" ) - def dictify( self, trans, view='collection', value_mapper=None ): - # TODO: need to dictify conditions. - group_dict = super( Group, self ).dictify( view=view, value_mapper=value_mapper ) + def to_dict( self, trans, view='collection', value_mapper=None ): + # TODO: need to to_dict conditions. + group_dict = super( Group, self ).to_dict( view=view, value_mapper=value_mapper ) return group_dict class Repeat( Group ): diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/visualization/genomes.py --- a/lib/galaxy/visualization/genomes.py +++ b/lib/galaxy/visualization/genomes.py @@ -73,7 +73,7 @@ self.len_file = len_file self.twobit_file = twobit_file - def dictify( self, num=None, chrom=None, low=None ): + def to_dict( self, num=None, chrom=None, low=None ): """ Returns representation of self as a dictionary. """ @@ -289,7 +289,7 @@ # Set up return value or log exception if genome not found for key. rval = None if genome: - rval = genome.dictify( num=num, chrom=chrom, low=low ) + rval = genome.to_dict( num=num, chrom=chrom, low=low ) else: log.exception( 'genome not found for key %s' % dbkey ) diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -32,7 +32,7 @@ from galaxy.model.orm import eagerload, eagerload_all from galaxy.security.validate_user_input import validate_publicname from galaxy.util.sanitize_html import sanitize_html -from galaxy.model.item_attrs import DictifiableMixin +from galaxy.model.item_attrs import Dictifiable from galaxy.datatypes.interval import ChromatinInteractions from galaxy.datatypes.data import Text @@ -422,7 +422,7 @@ def get_history_dict( self, trans, history, hda_dictionaries=None ): """Returns history data in the form of a dictionary. """ - history_dict = history.dictify( view='element', value_mapper={ 'id':trans.security.encode_id }) + history_dict = history.to_dict( view='element', value_mapper={ 'id':trans.security.encode_id }) history_dict[ 'nice_size' ] = history.get_disk_size( nice_size=True ) history_dict[ 'annotation' ] = history.get_item_annotation_str( trans.sa_session, trans.user, history ) @@ -583,7 +583,7 @@ """ #precondition: the user's access to this hda has already been checked #TODO:?? postcondition: all ids are encoded (is this really what we want at this level?) - hda_dict = hda.dictify( view='element' ) + hda_dict = hda.to_dict( view='element' ) hda_dict[ 'api_type' ] = "file" # Add additional attributes that depend on trans can hence must be added here rather than at the model level. @@ -594,7 +594,7 @@ # ---- return here if deleted AND purged OR can't access purged = ( hda.purged or hda.dataset.purged ) if ( hda.deleted and purged ): - #TODO: dictify should really go AFTER this - only summary data + #TODO: to_dict should really go AFTER this - only summary data return trans.security.encode_dict_ids( hda_dict ) if trans.user_is_admin() or trans.app.config.expose_dataset_path: @@ -920,7 +920,7 @@ return query return query.all() - #TODO: move into model (dictify) + #TODO: move into model (to_dict) def get_visualization_summary_dict( self, visualization ): """ Return a set of summary attributes for a visualization in dictionary form. @@ -949,7 +949,7 @@ 'user_id' : visualization.user.id, 'dbkey' : visualization.dbkey, 'slug' : visualization.slug, - # dictify only the latest revision (allow older to be fetched elsewhere) + # to_dict only the latest revision (allow older to be fetched elsewhere) 'latest_revision' : self.get_visualization_revision_dict( visualization.latest_revision ), 'revisions' : [ r.id for r in visualization.revisions ], } @@ -1129,7 +1129,7 @@ return None # Get tool definition and add input values from job. - tool_dict = tool.dictify( trans, io_details=True ) + tool_dict = tool.to_dict( trans, io_details=True ) inputs_dict = tool_dict[ 'inputs' ] tool_param_values = dict( [ ( p.name, p.value ) for p in job.parameters ] ) tool_param_values = tool.params_from_strings( tool_param_values, trans.app, ignore_errors=True ) @@ -1139,8 +1139,8 @@ name = t_input[ 'name' ] if name in tool_param_values: value = tool_param_values[ name ] - if isinstance( value, DictifiableMixin ): - value = value.dictify() + if isinstance( value, Dictifiable ): + value = value.to_dict() t_input[ 'value' ] = value return tool_dict @@ -1172,7 +1172,7 @@ source='data' ) return { "track_type": dataset.datatype.track_type, - "dataset": trans.security.encode_dict_ids( dataset.dictify() ), + "dataset": trans.security.encode_dict_ids( dataset.to_dict() ), "name": track_dict['name'], "prefs": prefs, "mode": track_dict.get( 'mode', 'Auto' ), @@ -1252,7 +1252,7 @@ return { "track_type": dataset.datatype.track_type, "name": dataset.name, - "dataset": trans.security.encode_dict_ids( dataset.dictify() ), + "dataset": trans.security.encode_dict_ids( dataset.to_dict() ), "prefs": {}, "filters": { 'filters' : track_data_provider.get_filters() }, "tool": self.get_tool_def( trans, dataset ), diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/datasets.py --- a/lib/galaxy/webapps/galaxy/api/datasets.py +++ b/lib/galaxy/webapps/galaxy/api/datasets.py @@ -60,7 +60,7 @@ rval[ 'display_types' ] = self.get_old_display_applications( trans, dataset ) rval[ 'display_apps' ] = self.get_display_apps( trans, dataset ) else: - rval = dataset.dictify() + rval = dataset.to_dict() except Exception, e: rval = "Error in dataset API at listing contents: " + str( e ) diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/folders.py --- a/lib/galaxy/webapps/galaxy/api/folders.py +++ b/lib/galaxy/webapps/galaxy/api/folders.py @@ -35,7 +35,7 @@ # check_ownership=false since we are only displaying it. content = self.get_library_folder( trans, id, check_ownership=False, check_accessible=True ) - return self.encode_all_ids( trans, content.dictify( view='element' ) ) + return self.encode_all_ids( trans, content.to_dict( view='element' ) ) @web.expose_api def create( self, trans, payload, **kwd ): diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/forms.py --- a/lib/galaxy/webapps/galaxy/api/forms.py +++ b/lib/galaxy/webapps/galaxy/api/forms.py @@ -23,7 +23,7 @@ query = trans.sa_session.query( trans.app.model.FormDefinition )#.filter( trans.app.model.FormDefinition.table.c.deleted == False ) rval = [] for form_definition in query: - item = form_definition.dictify( value_mapper={ 'id': trans.security.encode_id, 'form_definition_current_id': trans.security.encode_id } ) + item = form_definition.to_dict( value_mapper={ 'id': trans.security.encode_id, 'form_definition_current_id': trans.security.encode_id } ) item['url'] = url_for( 'form', id=trans.security.encode_id( form_definition.id ) ) rval.append( item ) return rval @@ -47,7 +47,7 @@ if not form_definition or not trans.user_is_admin(): trans.response.status = 400 return "Invalid form definition id ( %s ) specified." % str( form_definition_id ) - item = form_definition.dictify( view='element', value_mapper={ 'id': trans.security.encode_id, 'form_definition_current_id': trans.security.encode_id } ) + item = form_definition.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id, 'form_definition_current_id': trans.security.encode_id } ) item['url'] = url_for( 'form', id=form_definition_id ) return item @@ -69,6 +69,6 @@ trans.sa_session.add( form_definition ) trans.sa_session.flush() encoded_id = trans.security.encode_id( form_definition.id ) - item = form_definition.dictify( view='element', value_mapper={ 'id': trans.security.encode_id, 'form_definition_current_id': trans.security.encode_id } ) + item = form_definition.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id, 'form_definition_current_id': trans.security.encode_id } ) item['url'] = url_for( 'form', id=encoded_id ) return [ item ] diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/groups.py --- a/lib/galaxy/webapps/galaxy/api/groups.py +++ b/lib/galaxy/webapps/galaxy/api/groups.py @@ -21,7 +21,7 @@ rval = [] for group in trans.sa_session.query( trans.app.model.Group ).filter( trans.app.model.Group.table.c.deleted == False ): if trans.user_is_admin(): - item = group.dictify( value_mapper={ 'id': trans.security.encode_id } ) + item = group.to_dict( value_mapper={ 'id': trans.security.encode_id } ) encoded_id = trans.security.encode_id( group.id ) item['url'] = url_for( 'group', id=encoded_id ) rval.append( item ) @@ -65,7 +65,7 @@ """ trans.sa_session.flush() encoded_id = trans.security.encode_id( group.id ) - item = group.dictify( view='element', value_mapper={ 'id': trans.security.encode_id } ) + item = group.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } ) item['url'] = url_for( 'group', id=encoded_id ) return [ item ] @@ -89,7 +89,7 @@ if not group: trans.response.status = 400 return "Invalid group id ( %s ) specified." % str( group_id ) - item = group.dictify( view='element', value_mapper={ 'id': trans.security.encode_id } ) + item = group.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } ) item['url'] = url_for( 'group', id=group_id ) item['users_url'] = url_for( 'group_users', group_id=group_id ) item['roles_url'] = url_for( 'group_roles', group_id=group_id ) diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/histories.py --- a/lib/galaxy/webapps/galaxy/api/histories.py +++ b/lib/galaxy/webapps/galaxy/api/histories.py @@ -46,14 +46,14 @@ .order_by( desc( trans.app.model.History.table.c.update_time ) ) .all() ) for history in query: - item = history.dictify(value_mapper={'id':trans.security.encode_id}) + item = history.to_dict(value_mapper={'id':trans.security.encode_id}) item['url'] = url_for( 'history', id=trans.security.encode_id( history.id ) ) rval.append( item ) elif trans.galaxy_session.current_history: #No user, this must be session authentication with an anonymous user. history = trans.galaxy_session.current_history - item = history.dictify(value_mapper={'id':trans.security.encode_id}) + item = history.to_dict(value_mapper={'id':trans.security.encode_id}) item['url'] = url_for( 'history', id=trans.security.encode_id( history.id ) ) rval.append(item) @@ -139,7 +139,7 @@ trans.sa_session.add( new_history ) trans.sa_session.flush() - item = new_history.dictify(view='element', value_mapper={'id':trans.security.encode_id}) + item = new_history.to_dict(view='element', value_mapper={'id':trans.security.encode_id}) item['url'] = url_for( 'history', id=item['id'] ) #TODO: copy own history @@ -254,7 +254,7 @@ :param id: the encoded id of the history to undelete :type payload: dict :param payload: a dictionary containing any or all the - fields in :func:`galaxy.model.History.dictify` and/or the following: + fields in :func:`galaxy.model.History.to_dict` and/or the following: * annotation: an annotation for the history diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/history_contents.py --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -190,7 +190,7 @@ hda = ld.library_dataset_dataset_association.to_history_dataset_association( history, add_to_history=True ) trans.sa_session.flush() - return hda.dictify() + return hda.to_dict() else: # TODO: implement other "upload" methods here. @@ -210,7 +210,7 @@ :param id: the encoded id of the history to undelete :type payload: dict :param payload: a dictionary containing any or all the - fields in :func:`galaxy.model.HistoryDatasetAssociation.dictify` + fields in :func:`galaxy.model.HistoryDatasetAssociation.to_dict` and/or the following: * annotation: an annotation for the HDA diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/item_tags.py --- a/lib/galaxy/webapps/galaxy/api/item_tags.py +++ b/lib/galaxy/webapps/galaxy/api/item_tags.py @@ -49,7 +49,7 @@ return 'OK' def _api_value( self, tag, trans, view='element' ): - return tag.dictify( view=view, value_mapper={ 'id': trans.security.encode_id } ) + return tag.to_dict( view=view, value_mapper={ 'id': trans.security.encode_id } ) class HistoryContentTagsController( BaseItemTagsController ): controller_name = "history_content_tags" diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/libraries.py --- a/lib/galaxy/webapps/galaxy/api/libraries.py +++ b/lib/galaxy/webapps/galaxy/api/libraries.py @@ -49,7 +49,7 @@ trans.model.Library.table.c.id.in_( accessible_restricted_library_ids ) ) ) rval = [] for library in query: - item = library.dictify() + item = library.to_dict() item['url'] = url_for( route, id=trans.security.encode_id( library.id ) ) item['id'] = trans.security.encode_id( item['id'] ) rval.append( item ) @@ -87,7 +87,7 @@ library = None if not library or not ( trans.user_is_admin() or trans.app.security_agent.can_access_library( trans.get_current_user_roles(), library ) ): raise HTTPBadRequest( detail='Invalid library id ( %s ) specified.' % id ) - item = library.dictify( view='element' ) + item = library.to_dict( view='element' ) #item['contents_url'] = url_for( 'contents', library_id=library_id ) item['contents_url'] = url_for( 'library_contents', library_id=library_id ) return item @@ -162,4 +162,4 @@ library.deleted = True trans.sa_session.add( library ) trans.sa_session.flush() - return library.dictify( view='element', value_mapper={ 'id' : trans.security.encode_id } ) + return library.to_dict( view='element', value_mapper={ 'id' : trans.security.encode_id } ) diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/library_contents.py --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -105,7 +105,7 @@ :rtype: dict :returns: detailed library item information .. seealso:: - :func:`galaxy.model.LibraryDataset.dictify` and + :func:`galaxy.model.LibraryDataset.to_dict` and :attr:`galaxy.model.LibraryFolder.dict_element_visible_keys` """ class_name, content_id = self.__decode_library_content_id( trans, id ) @@ -113,7 +113,7 @@ content = self.get_library_folder( trans, content_id, check_ownership=False, check_accessible=True ) else: content = self.get_library_dataset( trans, content_id, check_ownership=False, check_accessible=True ) - return self.encode_all_ids( trans, content.dictify( view='element' ) ) + return self.encode_all_ids( trans, content.to_dict( view='element' ) ) @web.expose_api def create( self, trans, library_id, payload, **kwd ): @@ -266,7 +266,7 @@ return { 'error' : 'user has no permission to add to library folder (%s)' %( folder_id ) } ldda = self.copy_hda_to_library_folder( trans, hda, folder, ldda_message=ldda_message ) - ldda_dict = ldda.dictify() + ldda_dict = ldda.to_dict() rval = trans.security.encode_dict_ids( ldda_dict ) except Exception, exc: diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/permissions.py --- a/lib/galaxy/webapps/galaxy/api/permissions.py +++ b/lib/galaxy/webapps/galaxy/api/permissions.py @@ -47,6 +47,6 @@ trans.app.security_agent.copy_library_permissions( trans, library, library.root_folder ) message = "Permissions updated for library '%s'." % library.name - item = library.dictify( view='element' ) + item = library.to_dict( view='element' ) return item diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/quotas.py --- a/lib/galaxy/webapps/galaxy/api/quotas.py +++ b/lib/galaxy/webapps/galaxy/api/quotas.py @@ -34,7 +34,7 @@ route = 'quota' query = query.filter( trans.app.model.Quota.table.c.deleted == False ) for quota in query: - item = quota.dictify( value_mapper={ 'id': trans.security.encode_id } ) + item = quota.to_dict( value_mapper={ 'id': trans.security.encode_id } ) encoded_id = trans.security.encode_id( quota.id ) item['url'] = url_for( route, id=encoded_id ) rval.append( item ) @@ -49,7 +49,7 @@ Displays information about a quota. """ quota = self.get_quota( trans, id, deleted=util.string_as_bool( deleted ) ) - return quota.dictify( view='element', value_mapper={ 'id': trans.security.encode_id } ) + return quota.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } ) @web.expose_api @web.require_admin @@ -67,7 +67,7 @@ quota, message = self._create_quota( params ) except ActionInputError, e: raise HTTPBadRequest( detail=str( e ) ) - item = quota.dictify( value_mapper={ 'id': trans.security.encode_id } ) + item = quota.to_dict( value_mapper={ 'id': trans.security.encode_id } ) item['url'] = url_for( 'quota', id=trans.security.encode_id( quota.id ) ) item['message'] = message return item diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/request_types.py --- a/lib/galaxy/webapps/galaxy/api/request_types.py +++ b/lib/galaxy/webapps/galaxy/api/request_types.py @@ -19,7 +19,7 @@ """ rval = [] for request_type in trans.app.security_agent.get_accessible_request_types( trans, trans.user ): - item = request_type.dictify( value_mapper={ 'id': trans.security.encode_id, 'request_form_id': trans.security.encode_id, 'sample_form_id': trans.security.encode_id } ) + item = request_type.to_dict( value_mapper={ 'id': trans.security.encode_id, 'request_form_id': trans.security.encode_id, 'sample_form_id': trans.security.encode_id } ) encoded_id = trans.security.encode_id( request_type.id ) item['url'] = url_for( 'request_type', id=encoded_id ) rval.append( item ) @@ -47,7 +47,7 @@ if not trans.app.security_agent.can_access_request_type( trans.user.all_roles(), request_type ): trans.response.status = 400 return "No permission to access request_type ( %s )." % str( request_type_id ) - item = request_type.dictify( view='element', value_mapper={ 'id': trans.security.encode_id, 'request_form_id': trans.security.encode_id, 'sample_form_id': trans.security.encode_id } ) + item = request_type.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id, 'request_form_id': trans.security.encode_id, 'sample_form_id': trans.security.encode_id } ) item['url'] = url_for( 'request_type', id=request_type_id ) return item @@ -97,6 +97,6 @@ trans.sa_session.add( request_type ) trans.sa_session.flush() encoded_id = trans.security.encode_id( request_type.id ) - item = request_type.dictify( view='element', value_mapper={ 'id': trans.security.encode_id, 'request_form_id': trans.security.encode_id, 'sample_form_id': trans.security.encode_id } ) + item = request_type.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id, 'request_form_id': trans.security.encode_id, 'sample_form_id': trans.security.encode_id } ) item['url'] = url_for( 'request_type', id=encoded_id ) return [ item ] diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/requests.py --- a/lib/galaxy/webapps/galaxy/api/requests.py +++ b/lib/galaxy/webapps/galaxy/api/requests.py @@ -30,7 +30,7 @@ .all() rval = [] for request in query: - item = request.dictify() + item = request.to_dict() item['url'] = url_for( 'requests', id=trans.security.encode_id( request.id ) ) item['id'] = trans.security.encode_id( item['id'] ) if trans.user_is_admin(): @@ -55,7 +55,7 @@ if not request or not ( trans.user_is_admin() or request.user.id == trans.user.id ): trans.response.status = 400 return "Invalid request id ( %s ) specified." % str( request_id ) - item = request.dictify() + item = request.to_dict() item['url'] = url_for( 'requests', id=trans.security.encode_id( request.id ) ) item['id'] = trans.security.encode_id( item['id'] ) item['user'] = request.user.email diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/roles.py --- a/lib/galaxy/webapps/galaxy/api/roles.py +++ b/lib/galaxy/webapps/galaxy/api/roles.py @@ -18,7 +18,7 @@ rval = [] for role in trans.sa_session.query( trans.app.model.Role ).filter( trans.app.model.Role.table.c.deleted == False ): if trans.user_is_admin() or trans.app.security_agent.ok_to_display( trans.user, role ): - item = role.dictify( value_mapper={ 'id': trans.security.encode_id } ) + item = role.to_dict( value_mapper={ 'id': trans.security.encode_id } ) encoded_id = trans.security.encode_id( role.id ) item['url'] = url_for( 'role', id=encoded_id ) rval.append( item ) @@ -43,7 +43,7 @@ if not role or not (trans.user_is_admin() or trans.app.security_agent.ok_to_display( trans.user, role )): trans.response.status = 400 return "Invalid role id ( %s ) specified." % str( role_id ) - item = role.dictify( view='element', value_mapper={ 'id': trans.security.encode_id } ) + item = role.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } ) item['url'] = url_for( 'role', id=role_id ) return item @@ -81,6 +81,6 @@ trans.app.security_agent.associate_group_role( group, role ) trans.sa_session.flush() encoded_id = trans.security.encode_id( role.id ) - item = role.dictify( view='element', value_mapper={ 'id': trans.security.encode_id } ) + item = role.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id } ) item['url'] = url_for( 'role', id=encoded_id ) return [ item ] diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/samples.py --- a/lib/galaxy/webapps/galaxy/api/samples.py +++ b/lib/galaxy/webapps/galaxy/api/samples.py @@ -35,7 +35,7 @@ return "Invalid request id ( %s ) specified." % str( request_id ) rval = [] for sample in request.samples: - item = sample.dictify() + item = sample.to_dict() item['url'] = url_for( 'samples', request_id=trans.security.encode_id( request_id ), id=trans.security.encode_id( sample.id ) ) diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py --- a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py +++ b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py @@ -45,7 +45,7 @@ .order_by( trans.app.model.ToolShedRepository.table.c.name ) \ .all() for tool_shed_repository in query: - tool_shed_repository_dict = tool_shed_repository.dictify( value_mapper=default_tool_shed_repository_value_mapper( trans, tool_shed_repository ) ) + tool_shed_repository_dict = tool_shed_repository.to_dict( value_mapper=default_tool_shed_repository_value_mapper( trans, tool_shed_repository ) ) tool_shed_repository_dict[ 'url' ] = web.url_for( controller='tool_shed_repositories', action='show', id=trans.security.encode_id( tool_shed_repository.id ) ) @@ -402,7 +402,7 @@ repair_dict = repository_util.repair_tool_shed_repository( trans, repository, encoding_util.tool_shed_encode( repo_info_dict ) ) - repository_dict = repository.dictify( value_mapper=default_tool_shed_repository_value_mapper( trans, repository ) ) + repository_dict = repository.to_dict( value_mapper=default_tool_shed_repository_value_mapper( trans, repository ) ) repository_dict[ 'url' ] = web.url_for( controller='tool_shed_repositories', action='show', id=trans.security.encode_id( repository.id ) ) diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/tools.py --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -32,7 +32,7 @@ # Create return value. try: - return self.app.toolbox.dictify( trans, in_panel=in_panel, trackster=trackster ) + return self.app.toolbox.to_dict( trans, in_panel=in_panel, trackster=trackster ) except Exception, exc: log.error( 'could not convert toolbox to dictionary: %s', str( exc ), exc_info=True ) trans.response.status = 500 @@ -45,7 +45,7 @@ Returns tool information, including parameters and inputs. """ try: - return self.app.toolbox.tools_by_id[ id ].dictify( trans, for_display=True ) + return self.app.toolbox.tools_by_id[ id ].to_dict( trans, for_display=True ) except Exception, exc: log.error( 'could not convert tool (%s) to dictionary: %s', id, str( exc ), exc_info=True ) trans.response.status = 500 @@ -105,7 +105,7 @@ outputs = rval[ "outputs" ] #TODO:?? poss. only return ids? for output in output_datasets: - output_dict = output.dictify() + output_dict = output.to_dict() outputs.append( trans.security.encode_dict_ids( output_dict ) ) return rval @@ -411,7 +411,7 @@ if joda.name == output_name: output_dataset = joda.dataset - dataset_dict = output_dataset.dictify() + dataset_dict = output_dataset.to_dict() dataset_dict[ 'id' ] = trans.security.encode_id( dataset_dict[ 'id' ] ) dataset_dict[ 'track_config' ] = self.get_new_track_config( trans, output_dataset ); return dataset_dict diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/users.py --- a/lib/galaxy/webapps/galaxy/api/users.py +++ b/lib/galaxy/webapps/galaxy/api/users.py @@ -33,13 +33,13 @@ query = query.filter( trans.app.model.User.table.c.deleted == False ) # special case: user can see only their own user if not trans.user_is_admin(): - item = trans.user.dictify( value_mapper={ 'id': trans.security.encode_id } ) + item = trans.user.to_dict( value_mapper={ 'id': trans.security.encode_id } ) item['url'] = url_for( route, id=item['id'] ) item['quota_percent'] = trans.app.quota_agent.get_percent( trans=trans ) return [item] for user in query: - item = user.dictify( value_mapper={ 'id': trans.security.encode_id } ) + item = user.to_dict( value_mapper={ 'id': trans.security.encode_id } ) #TODO: move into api_values item['quota_percent'] = trans.app.quota_agent.get_percent( trans=trans ) item['url'] = url_for( route, id=item['id'] ) @@ -77,7 +77,7 @@ raise else: raise HTTPBadRequest( detail='Invalid user id ( %s ) specified' % id ) - item = user.dictify( view='element', value_mapper={ 'id': trans.security.encode_id, + item = user.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id, 'total_disk_usage': float } ) #TODO: move into api_values (needs trans, tho - can we do that with api_keys/@property??) #TODO: works with other users (from admin)?? @@ -94,7 +94,7 @@ raise HTTPNotImplemented( detail='User creation is not allowed in this Galaxy instance' ) if trans.app.config.use_remote_user and trans.user_is_admin(): user = trans.get_or_create_remote_user(remote_user_email=payload['remote_user_email']) - item = user.dictify( view='element', value_mapper={ 'id': trans.security.encode_id, + item = user.to_dict( view='element', value_mapper={ 'id': trans.security.encode_id, 'total_disk_usage': float } ) else: raise HTTPNotImplemented() diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/visualizations.py --- a/lib/galaxy/webapps/galaxy/api/visualizations.py +++ b/lib/galaxy/webapps/galaxy/api/visualizations.py @@ -212,7 +212,7 @@ # this allows PUT'ing an entire model back to the server without attribute errors on uneditable attrs valid_but_uneditable_keys = ( 'id', 'model_class' - #TODO: fill out when we create dictify, get_dict, whatevs + #TODO: fill out when we create to_dict, get_dict, whatevs ) #TODO: deleted #TODO: importable diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/api/workflows.py --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -31,7 +31,7 @@ for wf in trans.sa_session.query(trans.app.model.StoredWorkflow).filter_by( user=trans.user, deleted=False).order_by( desc(trans.app.model.StoredWorkflow.table.c.update_time)).all(): - item = wf.dictify(value_mapper={'id':trans.security.encode_id}) + item = wf.to_dict(value_mapper={'id':trans.security.encode_id}) encoded_id = trans.security.encode_id(wf.id) item['url'] = url_for('workflow', id=encoded_id) rval.append(item) @@ -39,7 +39,7 @@ user=trans.user ).join( 'stored_workflow' ).filter( trans.app.model.StoredWorkflow.deleted == False ).order_by( desc( trans.app.model.StoredWorkflow.update_time ) ).all(): - item = wf_sa.stored_workflow.dictify(value_mapper={'id':trans.security.encode_id}) + item = wf_sa.stored_workflow.to_dict(value_mapper={'id':trans.security.encode_id}) encoded_id = trans.security.encode_id(wf_sa.stored_workflow.id) item['url'] = url_for('workflow', id=encoded_id) rval.append(item) @@ -67,7 +67,7 @@ except: trans.response.status = 400 return "That workflow does not exist." - item = stored_workflow.dictify(view='element', value_mapper={'id':trans.security.encode_id}) + item = stored_workflow.to_dict(view='element', value_mapper={'id':trans.security.encode_id}) item['url'] = url_for('workflow', id=workflow_id) latest_workflow = stored_workflow.latest_workflow inputs = {} @@ -329,7 +329,7 @@ # return list rval= []; - item = workflow.dictify(value_mapper={'id':trans.security.encode_id}) + item = workflow.to_dict(value_mapper={'id':trans.security.encode_id}) item['url'] = url_for('workflow', id=encoded_id) rval.append(item); diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/galaxy/controllers/visualization.py --- a/lib/galaxy/webapps/galaxy/controllers/visualization.py +++ b/lib/galaxy/webapps/galaxy/controllers/visualization.py @@ -873,8 +873,8 @@ # Add tool, dataset attributes to config based on id. tool = trans.app.toolbox.get_tool( viz_config[ 'tool_id' ] ) - viz_config[ 'tool' ] = tool.dictify( trans, io_details=True ) - viz_config[ 'dataset' ] = trans.security.encode_dict_ids( dataset.dictify() ) + viz_config[ 'tool' ] = tool.to_dict( trans, io_details=True ) + viz_config[ 'dataset' ] = trans.security.encode_dict_ids( dataset.to_dict() ) return trans.fill_template_mako( "visualization/sweepster.mako", config=viz_config ) diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/tool_shed/api/repositories.py --- a/lib/galaxy/webapps/tool_shed/api/repositories.py +++ b/lib/galaxy/webapps/tool_shed/api/repositories.py @@ -113,7 +113,7 @@ # Get the repository information. repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) encoded_repository_id = trans.security.encode_id( repository.id ) - repository_dict = repository.dictify( view='element', value_mapper=default_repository_value_mapper( trans, repository ) ) + repository_dict = repository.to_dict( view='element', value_mapper=default_repository_value_mapper( trans, repository ) ) repository_dict[ 'url' ] = web.url_for( controller='repositories', action='show', id=encoded_repository_id ) @@ -129,7 +129,7 @@ changeset_revision = new_changeset_revision if repository_metadata: encoded_repository_metadata_id = trans.security.encode_id( repository_metadata.id ) - repository_metadata_dict = repository_metadata.dictify( view='collection', + repository_metadata_dict = repository_metadata.to_dict( view='collection', value_mapper=default_repository_metadata_value_mapper( trans, repository_metadata ) ) repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions', action='show', @@ -164,7 +164,7 @@ .order_by( trans.app.model.Repository.table.c.name ) \ .all() for repository in query: - repository_dict = repository.dictify( view='collection', value_mapper=default_repository_value_mapper( trans, repository ) ) + repository_dict = repository.to_dict( view='collection', value_mapper=default_repository_value_mapper( trans, repository ) ) repository_dict[ 'url' ] = web.url_for( controller='repositories', action='show', id=trans.security.encode_id( repository.id ) ) @@ -187,7 +187,7 @@ # Example URL: http://localhost:9009/api/repositories/f9cad7b01a472135 try: repository = suc.get_repository_in_tool_shed( trans, id ) - repository_dict = repository.dictify( view='element', value_mapper=default_repository_value_mapper( trans, repository ) ) + repository_dict = repository.to_dict( view='element', value_mapper=default_repository_value_mapper( trans, repository ) ) repository_dict[ 'url' ] = web.url_for( controller='repositories', action='show', id=trans.security.encode_id( repository.id ) ) diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/tool_shed/api/repository_revisions.py --- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py +++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py @@ -127,7 +127,7 @@ .order_by( trans.app.model.RepositoryMetadata.table.c.repository_id ) \ .all() for repository_metadata in query: - repository_metadata_dict = repository_metadata.dictify( view='collection', + repository_metadata_dict = repository_metadata.to_dict( view='collection', value_mapper=default_value_mapper( trans, repository_metadata ) ) repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions', action='show', diff -r ce4c7a3fb0d847633db4e77d6e90cc94c7d55aa3 -r a4259a97c287927d6a377092bc649579a88cb433 lib/galaxy/webapps/tool_shed/model/__init__.py --- a/lib/galaxy/webapps/tool_shed/model/__init__.py +++ b/lib/galaxy/webapps/tool_shed/model/__init__.py @@ -4,7 +4,7 @@ from galaxy import util from galaxy.util.bunch import Bunch from galaxy.util.hash_util import new_secure_hash -from galaxy.model.item_attrs import DictifiableMixin +from galaxy.model.item_attrs import Dictifiable import tool_shed.repository_types.util as rt_util from galaxy import eggs @@ -19,7 +19,7 @@ pass -class User( object, DictifiableMixin ): +class User( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'email' ) dict_element_visible_keys = ( 'id', 'email', 'username' ) @@ -61,7 +61,7 @@ return 0 -class Group( object, DictifiableMixin ): +class Group( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'name' ) dict_element_visible_keys = ( 'id', 'name' ) @@ -70,7 +70,7 @@ self.deleted = False -class Role( object, DictifiableMixin ): +class Role( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'name' ) dict_element_visible_keys = ( 'id', 'name', 'description', 'type' ) private_id = None @@ -130,7 +130,7 @@ self.prev_session_id = prev_session_id -class Repository( object, DictifiableMixin ): +class Repository( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'name', 'type', 'description', 'user_id', 'private', 'deleted', 'times_downloaded', 'deprecated' ) dict_element_visible_keys = ( 'id', 'name', 'type', 'description', 'long_description', 'user_id', 'private', 'deleted', 'times_downloaded', 'deprecated' ) @@ -155,7 +155,7 @@ self.deprecated = deprecated def as_dict( self, value_mapper=None ): - return self.dictify( view='element', value_mapper=value_mapper ) + return self.to_dict( view='element', value_mapper=value_mapper ) def can_change_type( self, app ): # Allow changing the type only if the repository has no contents, has never been installed, or has never been changed from @@ -175,7 +175,7 @@ return True return False - def dictify( self, view='collection', value_mapper=None ): + def to_dict( self, view='collection', value_mapper=None ): if value_mapper is None: value_mapper = {} rval = {} @@ -244,7 +244,7 @@ fp.close() -class RepositoryMetadata( object, DictifiableMixin ): +class RepositoryMetadata( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'repository_id', 'changeset_revision', 'malicious', 'downloadable', 'has_repository_dependencies', 'includes_datatypes', 'includes_tools', 'includes_tool_dependencies', 'includes_tools_for_display_in_tool_panel', 'includes_workflows' ) dict_element_visible_keys = ( 'id', 'repository_id', 'changeset_revision', 'malicious', 'downloadable', 'tools_functionally_correct', 'do_not_test', @@ -284,9 +284,9 @@ return False def as_dict( self, value_mapper=None ): - return self.dictify( view='element', value_mapper=value_mapper ) + return self.to_dict( view='element', value_mapper=value_mapper ) - def dictify( self, view='collection', value_mapper=None ): + def to_dict( self, view='collection', value_mapper=None ): if value_mapper is None: value_mapper = {} rval = {} @@ -304,7 +304,7 @@ return rval -class SkipToolTest( object, DictifiableMixin ): +class SkipToolTest( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'repository_metadata_id', 'initial_changeset_revision' ) dict_element_visible_keys = ( 'id', 'repository_metadata_id', 'initial_changeset_revision', 'comment' ) @@ -315,9 +315,9 @@ self.comment = comment def as_dict( self, value_mapper=None ): - return self.dictify( view='element', value_mapper=value_mapper ) + return self.to_dict( view='element', value_mapper=value_mapper ) - def dictify( self, view='collection', value_mapper=None ): + def to_dict( self, view='collection', value_mapper=None ): if value_mapper is None: value_mapper = {} rval = {} @@ -335,7 +335,7 @@ return rval -class RepositoryReview( object, DictifiableMixin ): +class RepositoryReview( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'repository_id', 'changeset_revision', 'user_id', 'rating', 'deleted' ) dict_element_visible_keys = ( 'id', 'repository_id', 'changeset_revision', 'user_id', 'rating', 'deleted' ) approved_states = Bunch( NO='no', YES='yes' ) @@ -347,7 +347,7 @@ self.rating = rating self.deleted = deleted -class ComponentReview( object, DictifiableMixin ): +class ComponentReview( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'repository_review_id', 'component_id', 'private', 'approved', 'rating', 'deleted' ) dict_element_visible_keys = ( 'id', 'repository_review_id', 'component_id', 'private', 'approved', 'rating', 'deleted' ) approved_states = Bunch( NO='no', YES='yes', NA='not_applicable' ) @@ -389,7 +389,7 @@ self.repository = repository -class Category( object, DictifiableMixin ): +class Category( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'name', 'description', 'deleted' ) dict_element_visible_keys = ( 'id', 'name', 'description', 'deleted' ) https://bitbucket.org/galaxy/galaxy-central/commits/c59cc42b2793/ Changeset: c59cc42b2793 User: jgoecks Date: 2013-08-30 20:23:42 Summary: Remove unneeded to_dict code/methods. Affected #: 1 file diff -r a4259a97c287927d6a377092bc649579a88cb433 -r c59cc42b279385f0d351d31f919d29bb7c012877 lib/galaxy/webapps/tool_shed/model/__init__.py --- a/lib/galaxy/webapps/tool_shed/model/__init__.py +++ b/lib/galaxy/webapps/tool_shed/model/__init__.py @@ -176,20 +176,7 @@ return False def to_dict( self, view='collection', value_mapper=None ): - if value_mapper is None: - value_mapper = {} - rval = {} - try: - visible_keys = self.__getattribute__( 'dict_' + view + '_visible_keys' ) - except AttributeError: - raise Exception( 'Unknown API view: %s' % view ) - for key in visible_keys: - try: - rval[ key ] = self.__getattribute__( key ) - if key in value_mapper: - rval[ key ] = value_mapper.get( key, rval[ key ] ) - except AttributeError: - rval[ key ] = None + rval = super( Repository, self ).to_dict( view=view, value_mapper=value_mapper ) if 'user_id' in rval: rval[ 'owner' ] = self.user.username return rval @@ -286,23 +273,6 @@ def as_dict( self, value_mapper=None ): return self.to_dict( view='element', value_mapper=value_mapper ) - def to_dict( self, view='collection', value_mapper=None ): - if value_mapper is None: - value_mapper = {} - rval = {} - try: - visible_keys = self.__getattribute__( 'dict_' + view + '_visible_keys' ) - except AttributeError: - raise Exception( 'Unknown API view: %s' % view ) - for key in visible_keys: - try: - rval[ key ] = self.__getattribute__( key ) - if key in value_mapper: - rval[ key ] = value_mapper.get( key, rval[ key ] ) - except AttributeError: - rval[ key ] = None - return rval - class SkipToolTest( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'repository_metadata_id', 'initial_changeset_revision' ) @@ -317,23 +287,6 @@ def as_dict( self, value_mapper=None ): return self.to_dict( view='element', value_mapper=value_mapper ) - def to_dict( self, view='collection', value_mapper=None ): - if value_mapper is None: - value_mapper = {} - rval = {} - try: - visible_keys = self.__getattribute__( 'dict_' + view + '_visible_keys' ) - except AttributeError: - raise Exception( 'Unknown API view: %s' % view ) - for key in visible_keys: - try: - rval[ key ] = self.__getattribute__( key ) - if key in value_mapper: - rval[ key ] = value_mapper.get( key, rval[ key ] ) - except AttributeError: - rval[ key ] = None - return rval - class RepositoryReview( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'repository_id', 'changeset_revision', 'user_id', 'rating', 'deleted' ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org