mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
DictifiableMixin cleanup: (a) remove 'Mixin' from name and (b) rename dictify to to_dict.
This commit is contained in:
@@ -23,7 +23,7 @@ import galaxy.datatypes
|
||||
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 @@ def set_datatypes_registry( d_registry ):
|
||||
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 @@ class User( object, DictifiableMixin ):
|
||||
return total
|
||||
|
||||
|
||||
class Job( object, DictifiableMixin ):
|
||||
class Job( object, Dictifiable ):
|
||||
dict_collection_visible_keys = [ 'id' ]
|
||||
dict_element_visible_keys = [ 'id' ]
|
||||
|
||||
@@ -363,8 +363,8 @@ class Job( object, DictifiableMixin ):
|
||||
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 @@ class DeferredJob( object ):
|
||||
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 @@ class UserGroupAssociation( object ):
|
||||
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 @@ class History( object, DictifiableMixin, UsesAnnotations ):
|
||||
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 @@ class GroupRoleAssociation( object ):
|
||||
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 @@ class Role( object, DictifiableMixin ):
|
||||
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 @@ class Quota( object, DictifiableMixin ):
|
||||
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 @@ class DatasetInstance( object ):
|
||||
|
||||
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 @@ class HistoryDatasetAssociation( DatasetInstance, DictifiableMixin, UsesAnnotati
|
||||
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 @@ class HistoryDatasetAssociationSubset( object ):
|
||||
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 @@ class Library( object, DictifiableMixin ):
|
||||
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 @@ class LibraryFolder( object, DictifiableMixin ):
|
||||
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 @@ class LibraryDataset( object ):
|
||||
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 @@ class LibraryDatasetDatasetAssociation( DatasetInstance ):
|
||||
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 @@ class UCI( object ):
|
||||
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 @@ class StoredWorkflow( object, DictifiableMixin):
|
||||
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 @@ class MetadataFile( object ):
|
||||
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 @@ class FormValues( object ):
|
||||
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 @@ class ExternalService( object ):
|
||||
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 @@ class RequestTypePermissions( object ):
|
||||
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 @@ class Tag ( object ):
|
||||
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 @@ class ToolShedRepository( object ):
|
||||
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 @@ class ToolShedRepository( object ):
|
||||
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 @@ class ToolDependency( object ):
|
||||
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 @@ class ToolVersion( object, DictifiableMixin ):
|
||||
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
|
||||
|
||||
@@ -158,12 +158,12 @@ class UsesAnnotations:
|
||||
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 @@ class DictifiableMixin:
|
||||
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 @@ class DictifiableMixin:
|
||||
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 )
|
||||
|
||||
@@ -560,7 +560,7 @@ class SearchQuery:
|
||||
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 = {}
|
||||
|
||||
@@ -59,7 +59,7 @@ from galaxy.util.odict import odict
|
||||
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 StdioErrorLevel( object ):
|
||||
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 @@ class ToolBox( object, DictifiableMixin ):
|
||||
"""
|
||||
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 @@ class ToolBox( object, DictifiableMixin ):
|
||||
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 @@ def _filter_for_panel( item, filters, context ):
|
||||
|
||||
|
||||
|
||||
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 @@ class ToolSection( object, DictifiableMixin ):
|
||||
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 @@ class DefaultToolState( object ):
|
||||
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 @@ class ToolRequirement( object ):
|
||||
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 @@ class Tool( object, DictifiableMixin ):
|
||||
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 @@ class Tool( object, DictifiableMixin ):
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
@@ -12,12 +12,12 @@ from sanitize import ToolParameterSanitizer
|
||||
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 @@ class ToolParameter( object, DictifiableMixin ):
|
||||
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 @@ class SelectToolParameter( ToolParameter ):
|
||||
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, [] )
|
||||
|
||||
@@ -15,9 +15,9 @@ from galaxy.util import relpath
|
||||
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 @@ class Group( object, DictifiableMixin ):
|
||||
"""
|
||||
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 ):
|
||||
|
||||
@@ -73,7 +73,7 @@ class Genome( object ):
|
||||
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 @@ class Genomes( object ):
|
||||
# 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 )
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ from galaxy.workflow.modules import module_factory
|
||||
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 @@ class UsesHistoryMixin( SharableItemSecurityMixin ):
|
||||
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 @@ class UsesHistoryDatasetAssociationMixin:
|
||||
"""
|
||||
#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 @@ class UsesHistoryDatasetAssociationMixin:
|
||||
# ---- 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 @@ class UsesVisualizationMixin( UsesHistoryDatasetAssociationMixin, UsesLibraryMix
|
||||
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 @@ class UsesVisualizationMixin( UsesHistoryDatasetAssociationMixin, UsesLibraryMix
|
||||
'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 @@ class UsesVisualizationMixin( UsesHistoryDatasetAssociationMixin, UsesLibraryMix
|
||||
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 @@ class UsesVisualizationMixin( UsesHistoryDatasetAssociationMixin, UsesLibraryMix
|
||||
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 @@ class UsesVisualizationMixin( UsesHistoryDatasetAssociationMixin, UsesLibraryMix
|
||||
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 @@ class UsesVisualizationMixin( UsesHistoryDatasetAssociationMixin, UsesLibraryMix
|
||||
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 ),
|
||||
|
||||
@@ -60,7 +60,7 @@ class DatasetsController( BaseAPIController, UsesVisualizationMixin, UsesHistory
|
||||
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 )
|
||||
|
||||
@@ -35,7 +35,7 @@ class FoldersController( BaseAPIController, UsesLibraryMixin, UsesLibraryMixinIt
|
||||
# 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 ):
|
||||
|
||||
@@ -23,7 +23,7 @@ class FormDefinitionAPIController( BaseAPIController ):
|
||||
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 @@ class FormDefinitionAPIController( BaseAPIController ):
|
||||
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 @@ class FormDefinitionAPIController( BaseAPIController ):
|
||||
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 ]
|
||||
|
||||
@@ -21,7 +21,7 @@ class GroupAPIController( BaseAPIController ):
|
||||
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 @@ class GroupAPIController( BaseAPIController ):
|
||||
"""
|
||||
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 @@ class GroupAPIController( BaseAPIController ):
|
||||
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 )
|
||||
|
||||
@@ -46,14 +46,14 @@ class HistoriesController( BaseAPIController, UsesHistoryMixin ):
|
||||
.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 @@ class HistoriesController( BaseAPIController, UsesHistoryMixin ):
|
||||
|
||||
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 @@ class HistoriesController( BaseAPIController, UsesHistoryMixin ):
|
||||
: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
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ class HistoryContentsController( BaseAPIController, UsesHistoryDatasetAssociatio
|
||||
|
||||
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 @@ class HistoryContentsController( BaseAPIController, UsesHistoryDatasetAssociatio
|
||||
: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
|
||||
|
||||
@@ -49,7 +49,7 @@ class BaseItemTagsController( BaseAPIController, UsesTagsMixin ):
|
||||
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"
|
||||
|
||||
@@ -49,7 +49,7 @@ class LibrariesController( BaseAPIController ):
|
||||
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 @@ class LibrariesController( BaseAPIController ):
|
||||
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 @@ class LibrariesController( BaseAPIController ):
|
||||
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 } )
|
||||
|
||||
@@ -105,7 +105,7 @@ class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar
|
||||
: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 @@ class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar
|
||||
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 @@ class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar
|
||||
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:
|
||||
|
||||
@@ -47,6 +47,6 @@ class PermissionsController( BaseAPIController ):
|
||||
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
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class QuotaAPIController( BaseAPIController, Admin, AdminActions, UsesQuotaMixin
|
||||
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 @@ class QuotaAPIController( BaseAPIController, Admin, AdminActions, UsesQuotaMixin
|
||||
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 @@ class QuotaAPIController( BaseAPIController, Admin, AdminActions, UsesQuotaMixin
|
||||
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
|
||||
|
||||
@@ -19,7 +19,7 @@ class RequestTypeAPIController( BaseAPIController ):
|
||||
"""
|
||||
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 @@ class RequestTypeAPIController( BaseAPIController ):
|
||||
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 @@ class RequestTypeAPIController( BaseAPIController ):
|
||||
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 ]
|
||||
|
||||
@@ -30,7 +30,7 @@ class RequestsAPIController( BaseAPIController ):
|
||||
.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 @@ class RequestsAPIController( BaseAPIController ):
|
||||
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
|
||||
|
||||
@@ -18,7 +18,7 @@ class RoleAPIController( BaseAPIController ):
|
||||
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 @@ class RoleAPIController( BaseAPIController ):
|
||||
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 @@ class RoleAPIController( BaseAPIController ):
|
||||
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 ]
|
||||
|
||||
@@ -35,7 +35,7 @@ class SamplesAPIController( BaseAPIController ):
|
||||
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 ) )
|
||||
|
||||
@@ -45,7 +45,7 @@ class ToolShedRepositoriesController( BaseAPIController ):
|
||||
.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 @@ class ToolShedRepositoriesController( BaseAPIController ):
|
||||
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 ) )
|
||||
|
||||
@@ -32,7 +32,7 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin ):
|
||||
|
||||
# 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 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin ):
|
||||
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 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin ):
|
||||
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 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin ):
|
||||
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
|
||||
|
||||
@@ -33,13 +33,13 @@ class UserAPIController( BaseAPIController ):
|
||||
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 @@ class UserAPIController( BaseAPIController ):
|
||||
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 @@ class UserAPIController( BaseAPIController ):
|
||||
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()
|
||||
|
||||
@@ -212,7 +212,7 @@ class VisualizationsController( BaseAPIController, UsesVisualizationMixin, UsesA
|
||||
# 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
|
||||
|
||||
@@ -31,7 +31,7 @@ class WorkflowsAPIController(BaseAPIController, UsesAnnotations):
|
||||
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 @@ class WorkflowsAPIController(BaseAPIController, UsesAnnotations):
|
||||
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 @@ class WorkflowsAPIController(BaseAPIController, UsesAnnotations):
|
||||
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 @@ class WorkflowsAPIController(BaseAPIController, UsesAnnotations):
|
||||
# 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);
|
||||
|
||||
@@ -873,8 +873,8 @@ class VisualizationController( BaseUIController, SharableMixin, UsesAnnotations,
|
||||
|
||||
# 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 )
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ class RepositoriesController( BaseAPIController ):
|
||||
# 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 @@ class RepositoriesController( BaseAPIController ):
|
||||
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 @@ class RepositoriesController( BaseAPIController ):
|
||||
.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 @@ class RepositoriesController( BaseAPIController ):
|
||||
# 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 ) )
|
||||
|
||||
@@ -127,7 +127,7 @@ class RepositoryRevisionsController( BaseAPIController ):
|
||||
.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',
|
||||
|
||||
@@ -4,7 +4,7 @@ import os
|
||||
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 @@ class APIKeys( object ):
|
||||
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 @@ class User( object, DictifiableMixin ):
|
||||
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 @@ class Group( object, DictifiableMixin ):
|
||||
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 @@ class GalaxySession( object ):
|
||||
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 @@ class Repository( object, DictifiableMixin ):
|
||||
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 @@ class Repository( object, DictifiableMixin ):
|
||||
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 @@ class Repository( object, DictifiableMixin ):
|
||||
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 @@ class RepositoryMetadata( object, DictifiableMixin ):
|
||||
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 @@ class RepositoryMetadata( object, DictifiableMixin ):
|
||||
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 @@ class SkipToolTest( object, DictifiableMixin ):
|
||||
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 @@ class SkipToolTest( object, DictifiableMixin ):
|
||||
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 @@ class RepositoryReview( object, DictifiableMixin ):
|
||||
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 @@ class RepositoryRatingAssociation( ItemRatingAssociation ):
|
||||
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' )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user