galaxy-dev
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
April 2010
- 37 participants
- 148 discussions
details: http://www.bx.psu.edu/hg/galaxy/rev/7bdc5202c67e
changeset: 3612:7bdc5202c67e
user: fubar: ross Lazarus at gmail period com
date: Mon Apr 05 14:15:19 2010 -0400
description:
merged to 3610:23fb19105d96
diffstat:
lib/galaxy/model/__init__.py | 4 +-
lib/galaxy/tools/actions/__init__.py | 13 +
lib/galaxy/web/controllers/admin.py | 205 +---
lib/galaxy/web/controllers/dataset.py | 2 +-
lib/galaxy/web/controllers/forms.py | 100 +-
lib/galaxy/web/controllers/history.py | 7 +-
lib/galaxy/web/controllers/library.py | 16 +-
lib/galaxy/web/controllers/library_admin.py | 46 +-
lib/galaxy/web/controllers/library_common.py | 548 +++++++-------
lib/galaxy/web/controllers/requests.py | 164 ++--
lib/galaxy/web/controllers/requests_admin.py | 298 +++---
lib/galaxy/web/controllers/root.py | 32 +-
lib/galaxy/web/controllers/user.py | 442 ++++------
lib/galaxy/web/framework/__init__.py | 11 +-
static/images/fugue/plus-white.png | 0
static/june_2007_style/base.css.tmpl | 6 +
static/june_2007_style/blue/base.css | 2 +-
static/scripts/galaxy.base.js | 87 +-
static/scripts/packed/galaxy.base.js | 2 +-
templates/admin/dataset_security/group/group.mako | 4 +-
templates/admin/dataset_security/group/group_create.mako | 4 +-
templates/admin/dataset_security/group/group_rename.mako | 4 +-
templates/admin/dataset_security/role/role.mako | 4 +-
templates/admin/dataset_security/role/role_create.mako | 4 +-
templates/admin/dataset_security/role/role_rename.mako | 4 +-
templates/admin/forms/create_form.mako | 4 +-
templates/admin/forms/edit_form.mako | 4 +-
templates/admin/forms/show_form_read_only.mako | 4 +-
templates/admin/jobs.mako | 4 +-
templates/admin/library/new_library.mako | 4 +-
templates/admin/memdump.mako | 4 +-
templates/admin/reload_tool.mako | 4 +-
templates/admin/requests/add_states.mako | 4 +-
templates/admin/requests/create_request_type.mako | 4 +-
templates/admin/requests/edit_request.mako | 4 +-
templates/admin/requests/edit_request_type.mako | 4 +-
templates/admin/requests/events.mako | 4 +-
templates/admin/requests/get_data.mako | 4 +-
templates/admin/requests/new_request.mako | 4 +-
templates/admin/requests/reject.mako | 4 +-
templates/admin/requests/show_request.mako | 4 +-
templates/admin/requests/view_request_type.mako | 4 +-
templates/admin/samples/bar_codes.mako | 4 +-
templates/admin/samples/events.mako | 4 +-
templates/admin/user/create.mako | 43 -
templates/admin/user/reset_password.mako | 4 +-
templates/admin/user/user.mako | 4 +-
templates/dataset/edit_attributes.mako | 10 +-
templates/history/sharing.mako | 4 +-
templates/library/browse_libraries.mako | 4 +-
templates/library/common/browse_library.mako | 5 +-
templates/library/common/common.mako | 2 +-
templates/library/common/edit_template.mako | 4 +-
templates/library/common/folder_info.mako | 4 +-
templates/library/common/folder_permissions.mako | 4 +-
templates/library/common/ldda_edit_info.mako | 11 +-
templates/library/common/ldda_info.mako | 4 +-
templates/library/common/ldda_permissions.mako | 4 +-
templates/library/common/library_dataset_info.mako | 4 +-
templates/library/common/library_dataset_permissions.mako | 4 +-
templates/library/common/library_info.mako | 4 +-
templates/library/common/library_permissions.mako | 4 +-
templates/library/common/new_folder.mako | 4 +-
templates/library/common/select_template.mako | 4 +-
templates/library/common/upload.mako | 4 +-
templates/mobile/manage_library.mako | 4 +-
templates/requests/edit_request.mako | 4 +-
templates/requests/events.mako | 4 +-
templates/requests/new_request.mako | 4 +-
templates/requests/show_data.mako | 4 +-
templates/requests/show_request.mako | 4 +-
templates/root/index.mako | 3 -
templates/sample/sample_events.mako | 4 +-
templates/tool_form.mako | 5 +-
templates/user/edit_address.mako | 4 +-
templates/user/index.mako | 16 +-
templates/user/info.mako | 4 +-
templates/user/login.mako | 53 +-
templates/user/logout.mako | 6 +
templates/user/new_address.mako | 4 +-
templates/user/register.mako | 122 +-
templates/user/reset_password.mako | 4 +-
templates/webapps/galaxy/base_panels.mako | 10 +-
test/base/twilltestcase.py | 82 +-
test/functional/test_admin_features.py | 25 +-
85 files changed, 1264 insertions(+), 1322 deletions(-)
diffs (truncated from 5963 to 3000 lines):
diff -r fabf48e747ae -r 7bdc5202c67e lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py Mon Apr 05 14:14:09 2010 -0400
+++ b/lib/galaxy/model/__init__.py Mon Apr 05 14:15:19 2010 -0400
@@ -1348,8 +1348,8 @@
# Since we do not have contents, set checkbox value to False
value = False
else:
- # Set other field types to empty string
- value = ''
+ # Set other field types to the default value of the field
+ value = field['default']
# create the field widget
field_widget = eval( field[ 'type' ] )( field_name )
if field[ 'type' ] == 'TextField':
diff -r fabf48e747ae -r 7bdc5202c67e lib/galaxy/tools/actions/__init__.py
--- a/lib/galaxy/tools/actions/__init__.py Mon Apr 05 14:14:09 2010 -0400
+++ b/lib/galaxy/tools/actions/__init__.py Mon Apr 05 14:15:19 2010 -0400
@@ -107,14 +107,27 @@
Makes a copy of input dictionary from_dict such that all values that are dictionaries
result in creation of a new dictionary ( a sort of deepcopy ). We may need to handle
other complex types ( e.g., lists, etc ), but not sure...
+ Yes, we need to handle lists (and now are)...
"""
copy_from_dict = {}
for key, value in from_dict.items():
if type( value ).__name__ == 'dict':
copy_from_dict[ key ] = make_dict_copy( value )
+ elif isinstance( value, list ):
+ copy_from_dict[ key ] = make_list_copy( value )
else:
copy_from_dict[ key ] = value
return copy_from_dict
+ def make_list_copy( from_list ):
+ new_list = []
+ for value in from_list:
+ if isinstance( value, dict ):
+ new_list.append( make_dict_copy( value ) )
+ elif isinstance( value, list ):
+ new_list.append( make_list_copy( value ) )
+ else:
+ new_list.append( value )
+ return new_list
def wrap_values( inputs, input_values ):
# Wrap tool inputs as necessary
for input in inputs.itervalues():
diff -r fabf48e747ae -r 7bdc5202c67e lib/galaxy/web/controllers/admin.py
--- a/lib/galaxy/web/controllers/admin.py Mon Apr 05 14:14:09 2010 -0400
+++ b/lib/galaxy/web/controllers/admin.py Mon Apr 05 14:15:19 2010 -0400
@@ -263,9 +263,9 @@
@web.require_admin
def index( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
- return trans.fill_template( '/admin/index.mako', msg=msg, messagetype=messagetype )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ return trans.fill_template( '/admin/index.mako', message=message, status=status )
@web.expose
@web.require_admin
def center( self, trans, **kwd ):
@@ -274,17 +274,17 @@
@web.require_admin
def reload_tool( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
- return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, msg=msg, messagetype=messagetype )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, message=message, status=status )
@web.expose
@web.require_admin
def tool_reload( self, trans, tool_version=None, **kwd ):
params = util.Params( kwd )
tool_id = params.tool_id
self.app.toolbox.reload( tool_id )
- msg = 'Reloaded tool: ' + tool_id
- return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, msg=msg, messagetype='done' )
+ message = 'Reloaded tool: ' + tool_id
+ return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, message=message, status='done' )
# Galaxy Role Stuff
@web.expose
@@ -312,8 +312,8 @@
@web.require_admin
def create_role( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
if params.get( 'create_role_button', False ):
name = util.restore_text( params.name )
description = util.restore_text( params.description )
@@ -321,9 +321,9 @@
in_groups = util.listify( params.get( 'in_groups', [] ) )
create_group_for_role = params.get( 'create_group_for_role', 'no' )
if not name or not description:
- msg = "Enter a valid name and a description"
+ message = "Enter a valid name and a description"
elif trans.sa_session.query( trans.app.model.Role ).filter( trans.app.model.Role.table.c.name==name ).first():
- msg = "A role with that name already exists"
+ message = "A role with that name already exists"
else:
# Create the role
role = trans.app.model.Role( name=name, description=description, type=trans.app.model.Role.types.ADMIN )
@@ -340,13 +340,13 @@
# Create the group
group = trans.app.model.Group( name=name )
trans.sa_session.add( group )
- msg = "Group '%s' has been created, and role '%s' has been created with %d associated users and %d associated groups" % \
+ message = "Group '%s' has been created, and role '%s' has been created with %d associated users and %d associated groups" % \
( group.name, role.name, len( in_users ), len( in_groups ) )
else:
- msg = "Role '%s' has been created with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) )
+ message = "Role '%s' has been created with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) )
trans.sa_session.flush()
- trans.response.send_redirect( web.url_for( controller='admin', action='roles', message=util.sanitize_text( msg ), status='done' ) )
- trans.response.send_redirect( web.url_for( controller='admin', action='create_role', msg=util.sanitize_text( msg ), messagetype='error' ) )
+ trans.response.send_redirect( web.url_for( controller='admin', action='roles', message=util.sanitize_text( message ), status='done' ) )
+ trans.response.send_redirect( web.url_for( controller='admin', action='create_role', message=util.sanitize_text( message ), status='error' ) )
out_users = []
for user in trans.sa_session.query( trans.app.model.User ) \
.filter( trans.app.model.User.table.c.deleted==False ) \
@@ -362,39 +362,39 @@
out_users=out_users,
in_groups=[],
out_groups=out_groups,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
@web.require_admin
def rename_role( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
role = get_role( trans, params.id )
if params.get( 'rename_role_button', False ):
old_name = role.name
new_name = util.restore_text( params.name )
new_description = util.restore_text( params.description )
if not new_name:
- msg = 'Enter a valid name'
- return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, msg=msg, messagetype='error' )
+ message = 'Enter a valid name'
+ return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, message=message, status='error' )
elif trans.sa_session.query( trans.app.model.Role ).filter( trans.app.model.Role.table.c.name==new_name ).first():
- msg = 'A role with that name already exists'
- return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, msg=msg, messagetype='error' )
+ message = 'A role with that name already exists'
+ return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, message=message, status='error' )
else:
role.name = new_name
role.description = new_description
trans.sa_session.add( role )
trans.sa_session.flush()
- msg = "Role '%s' has been renamed to '%s'" % ( old_name, new_name )
- return trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( msg ), status='done' ) )
- return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, msg=msg, messagetype=messagetype )
+ message = "Role '%s' has been renamed to '%s'" % ( old_name, new_name )
+ return trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( message ), status='done' ) )
+ return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, message=message, status=status )
@web.expose
@web.require_admin
def manage_users_and_groups_for_role( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
role = get_role( trans, params.id )
if params.get( 'role_members_edit_button', False ):
in_users = [ trans.sa_session.query( trans.app.model.User ).get( x ) for x in util.listify( params.in_users ) ]
@@ -414,8 +414,8 @@
in_groups = [ trans.sa_session.query( trans.app.model.Group ).get( x ) for x in util.listify( params.in_groups ) ]
trans.app.security_agent.set_entity_role_associations( roles=[ role ], users=in_users, groups=in_groups )
trans.sa_session.refresh( role )
- msg = "Role '%s' has been updated with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) )
- trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( msg ), status=messagetype ) )
+ message = "Role '%s' has been updated with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) )
+ trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( message ), status=status ) )
in_users = []
out_users = []
in_groups = []
@@ -467,8 +467,8 @@
in_groups=in_groups,
out_groups=out_groups,
library_dataset_actions=library_dataset_actions,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
@web.require_admin
def mark_role_deleted( self, trans, **kwd ):
@@ -554,39 +554,39 @@
@web.require_admin
def rename_group( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
group = get_group( trans, params.id )
if params.get( 'rename_group_button', False ):
old_name = group.name
new_name = util.restore_text( params.name )
if not new_name:
- msg = 'Enter a valid name'
- return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, msg=msg, messagetype='error' )
+ message = 'Enter a valid name'
+ return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, message=message, status='error' )
elif trans.sa_session.query( trans.app.model.Group ).filter( trans.app.model.Group.table.c.name==new_name ).first():
- msg = 'A group with that name already exists'
- return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, msg=msg, messagetype='error' )
+ message = 'A group with that name already exists'
+ return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, message=message, status='error' )
else:
group.name = new_name
trans.sa_session.add( group )
trans.sa_session.flush()
- msg = "Group '%s' has been renamed to '%s'" % ( old_name, new_name )
- return trans.response.send_redirect( web.url_for( action='groups', msg=util.sanitize_text( msg ), messagetype='done' ) )
- return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, msg=msg, messagetype=messagetype )
+ message = "Group '%s' has been renamed to '%s'" % ( old_name, new_name )
+ return trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='done' ) )
+ return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, message=message, status=status )
@web.expose
@web.require_admin
def manage_users_and_roles_for_group( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
group = get_group( trans, params.id )
if params.get( 'group_roles_users_edit_button', False ):
in_roles = [ trans.sa_session.query( trans.app.model.Role ).get( x ) for x in util.listify( params.in_roles ) ]
in_users = [ trans.sa_session.query( trans.app.model.User ).get( x ) for x in util.listify( params.in_users ) ]
trans.app.security_agent.set_entity_group_associations( groups=[ group ], roles=in_roles, users=in_users )
trans.sa_session.refresh( group )
- msg += "Group '%s' has been updated with %d associated roles and %d associated users" % ( group.name, len( in_roles ), len( in_users ) )
- trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status=messagetype ) )
+ message += "Group '%s' has been updated with %d associated roles and %d associated users" % ( group.name, len( in_roles ), len( in_users ) )
+ trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status=status ) )
in_roles = []
out_roles = []
in_users = []
@@ -605,29 +605,29 @@
in_users.append( ( user.id, user.email ) )
else:
out_users.append( ( user.id, user.email ) )
- msg += 'Group %s is currently associated with %d roles and %d users' % ( group.name, len( in_roles ), len( in_users ) )
+ message += 'Group %s is currently associated with %d roles and %d users' % ( group.name, len( in_roles ), len( in_users ) )
return trans.fill_template( '/admin/dataset_security/group/group.mako',
group=group,
in_roles=in_roles,
out_roles=out_roles,
in_users=in_users,
out_users=out_users,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
@web.require_admin
def create_group( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
if params.get( 'create_group_button', False ):
name = util.restore_text( params.name )
in_users = util.listify( params.get( 'in_users', [] ) )
in_roles = util.listify( params.get( 'in_roles', [] ) )
if not name:
- msg = "Enter a valid name"
+ message = "Enter a valid name"
elif trans.sa_session.query( trans.app.model.Group ).filter( trans.app.model.Group.table.c.name==name ).first():
- msg = "A group with that name already exists"
+ message = "A group with that name already exists"
else:
# Create the group
group = trans.app.model.Group( name=name )
@@ -643,9 +643,9 @@
gra = trans.app.model.GroupRoleAssociation( group, role )
trans.sa_session.add( gra )
trans.sa_session.flush()
- msg = "Group '%s' has been created with %d associated users and %d associated roles" % ( name, len( in_users ), len( in_roles ) )
- trans.response.send_redirect( web.url_for( controller='admin', action='groups', message=util.sanitize_text( msg ), status='done' ) )
- trans.response.send_redirect( web.url_for( controller='admin', action='create_group', msg=util.sanitize_text( msg ), messagetype='error' ) )
+ message = "Group '%s' has been created with %d associated users and %d associated roles" % ( name, len( in_users ), len( in_roles ) )
+ trans.response.send_redirect( web.url_for( controller='admin', action='groups', message=util.sanitize_text( message ), status='done' ) )
+ trans.response.send_redirect( web.url_for( controller='admin', action='create_group', message=util.sanitize_text( message ), status='error' ) )
out_users = []
for user in trans.sa_session.query( trans.app.model.User ) \
.filter( trans.app.model.User.table.c.deleted==False ) \
@@ -661,8 +661,8 @@
out_users=out_users,
in_roles=[],
out_roles=out_roles,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
@web.require_admin
def mark_group_deleted( self, trans, **kwd ):
@@ -671,8 +671,8 @@
group.deleted = True
trans.sa_session.add( group )
trans.sa_session.flush()
- msg = "Group '%s' has been marked as deleted." % group.name
- trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status='done' ) )
+ message = "Group '%s' has been marked as deleted." % group.name
+ trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='done' ) )
@web.expose
@web.require_admin
def undelete_group( self, trans, **kwd ):
@@ -681,8 +681,8 @@
group.deleted = False
trans.sa_session.add( group )
trans.sa_session.flush()
- msg = "Group '%s' has been marked as not deleted." % group.name
- trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status='done' ) )
+ message = "Group '%s' has been marked as not deleted." % group.name
+ trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='done' ) )
@web.expose
@web.require_admin
def purge_group( self, trans, **kwd ):
@@ -692,8 +692,8 @@
group = get_group( trans, params.id )
if not group.deleted:
# We should never reach here, but just in case there is a bug somewhere...
- msg = "Group '%s' has not been deleted, so it cannot be purged." % group.name
- trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status='error' ) )
+ message = "Group '%s' has not been deleted, so it cannot be purged." % group.name
+ trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='error' ) )
# Delete UserGroupAssociations
for uga in group.users:
trans.sa_session.delete( uga )
@@ -711,69 +711,6 @@
return trans.response.send_redirect( web.url_for( controller='user',
action='create',
admin_view=True ) )
- email = ''
- password = ''
- confirm = ''
- subscribe = False
- email_filter = kwargs.get( 'email_filter', 'A' )
- if 'user_create_button' in kwargs:
- message = ''
- status = ''
- email = kwargs.get( 'email' , None )
- password = kwargs.get( 'password', None )
- confirm = kwargs.get( 'confirm', None )
- subscribe = kwargs.get( 'subscribe', None )
- if not email:
- message = 'Enter a valid email address'
- elif not password:
- message = 'Enter a valid password'
- elif not confirm:
- message = 'Confirm the password'
- elif len( email ) == 0 or "@" not in email or "." not in email:
- message = 'Enter a real email address'
- elif len( email) > 255:
- message = 'Email address exceeds maximum allowable length'
- elif trans.sa_session.query( trans.app.model.User ).filter_by( email=email ).first():
- message = 'User with that email already exists'
- elif len( password ) < 6:
- message = 'Use a password of at least 6 characters'
- elif password != confirm:
- message = 'Passwords do not match'
- if message:
- trans.response.send_redirect( web.url_for( controller='admin',
- action='users',
- email_filter=email_filter,
- message=util.sanitize_text( message ),
- status='error' ) )
- else:
- user = trans.app.model.User( email=email )
- user.set_password_cleartext( password )
- if trans.app.config.use_remote_user:
- user.external = True
- trans.sa_session.add( user )
- trans.sa_session.flush()
- trans.app.security_agent.create_private_user_role( user )
- trans.app.security_agent.user_set_default_permissions( user, history=False, dataset=False )
- message = 'Created new user account (%s)' % user.email
- status = 'done'
- #subscribe user to email list
- if subscribe:
- mail = os.popen( "%s -t" % trans.app.config.sendmail_path, 'w' )
- mail.write( "To: %s\nFrom: %s\nSubject: Join Mailing List\n\nJoin Mailing list." % ( trans.app.config.mailing_join_addr, email ) )
- if mail.close():
- message + ". However, subscribing to the mailing list has failed."
- status = 'error'
- trans.response.send_redirect( web.url_for( controller='admin',
- action='users',
- email_filter=email_filter,
- message=util.sanitize_text( message ),
- status=status ) )
- return trans.fill_template( '/admin/user/create.mako',
- email_filter=email_filter,
- email=email,
- password=password,
- confirm=confirm,
- subscribe=subscribe )
@web.expose
@web.require_admin
def reset_user_password( self, trans, **kwd ):
@@ -916,7 +853,7 @@
status='done' ) )
@web.expose
@web.require_admin
- def users( self, trans, **kwargs ):
+ def users( self, trans, **kwargs ):
if 'operation' in kwargs:
operation = kwargs['operation'].lower()
if operation == "roles":
@@ -1035,8 +972,8 @@
out_roles=out_roles,
in_groups=in_groups,
out_groups=out_groups,
- msg=message,
- messagetype=status )
+ message=message,
+ status=status )
@web.expose
@web.require_admin
def memdump( self, trans, ids = 'None', sorts = 'None', pages = 'None', new_id = None, new_sort = None, **kwd ):
@@ -1083,11 +1020,11 @@
def jobs( self, trans, stop = [], stop_msg = None, cutoff = 180, **kwd ):
deleted = []
msg = None
- messagetype = None
+ status = None
job_ids = util.listify( stop )
if job_ids and stop_msg in [ None, '' ]:
msg = 'Please enter an error message to display to the user describing why the job was terminated'
- messagetype = 'error'
+ status = 'error'
elif job_ids:
if stop_msg[-1] not in string.punctuation:
stop_msg += '.'
@@ -1100,7 +1037,7 @@
msg += 's'
msg += ' for deletion: '
msg += ', '.join( deleted )
- messagetype = 'done'
+ status = 'done'
cutoff_time = datetime.utcnow() - timedelta( seconds=int( cutoff ) )
jobs = trans.sa_session.query( trans.app.model.Job ) \
.filter( and_( trans.app.model.Job.table.c.update_time < cutoff_time,
@@ -1116,7 +1053,7 @@
last_updated[job.id] = '%s hours' % int( delta.seconds / 60 / 60 )
else:
last_updated[job.id] = '%s minutes' % int( delta.seconds / 60 )
- return trans.fill_template( '/admin/jobs.mako', jobs = jobs, last_updated = last_updated, cutoff = cutoff, msg = msg, messagetype = messagetype )
+ return trans.fill_template( '/admin/jobs.mako', jobs = jobs, last_updated = last_updated, cutoff = cutoff, msg = msg, status = status )
## ---- Utility methods -------------------------------------------------------
diff -r fabf48e747ae -r 7bdc5202c67e lib/galaxy/web/controllers/dataset.py
--- a/lib/galaxy/web/controllers/dataset.py Mon Apr 05 14:14:09 2010 -0400
+++ b/lib/galaxy/web/controllers/dataset.py Mon Apr 05 14:15:19 2010 -0400
@@ -352,7 +352,7 @@
return open( data.file_name )
if os.path.exists( data.file_name ):
max_peek_size = 1000000 # 1 MB
- if preview and os.stat( data.file_name ).st_size > max_peek_size:
+ if preview and (not isinstance(data.datatype, datatypes.binary.Binary)) and os.stat( data.file_name ).st_size > max_peek_size:
trans.response.set_content_type( "text/html" )
return trans.stream_template_mako( "/dataset/large_file.mako",
truncated_data = open( data.file_name ).read(max_peek_size),
diff -r fabf48e747ae -r 7bdc5202c67e lib/galaxy/web/controllers/forms.py
--- a/lib/galaxy/web/controllers/forms.py Mon Apr 05 14:14:09 2010 -0400
+++ b/lib/galaxy/web/controllers/forms.py Mon Apr 05 14:15:19 2010 -0400
@@ -72,7 +72,8 @@
'required': False,
'type': BaseField.form_field_types()[0],
'selectlist': [],
- 'layout': 'none' }
+ 'layout': 'none',
+ 'default': '' }
forms_grid = FormsGrid()
@web.expose
@@ -101,8 +102,8 @@
except:
return trans.response.send_redirect( web.url_for( controller='forms',
action='manage',
- msg='Invalid form',
- messagetype='error' ) )
+ message='Invalid form',
+ status='error' ) )
return trans.fill_template( '/admin/forms/show_form_read_only.mako',
form=fdc.latest_form )
def __form_types_widget(self, trans, selected='none'):
@@ -126,16 +127,16 @@
@web.require_admin
def new( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
self.__imported_from_file = False
if params.get( 'create_form_button', False ):
- fd, msg = self.__save_form( trans, fdc_id=None, **kwd )
+ fd, message = self.__save_form( trans, fdc_id=None, **kwd )
if not fd:
return trans.response.send_redirect( web.url_for( controller='forms',
action='new',
- msg=msg,
- messagetype='error',
+ message=message,
+ status='error',
name=util.restore_text( params.get( 'name', '' ) ),
description=util.restore_text( params.get( 'description', '' ) ) ))
self.__get_saved_form( fd )
@@ -157,8 +158,8 @@
( 'Import from csv file (Optional)', FileField( 'file_data', 40, '' ) ) ]
return trans.fill_template( '/admin/forms/create_form.mako',
inputs=inputs,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
def __delete( self, trans, **kwd ):
id_list = util.listify( kwd['id'] )
delete_failed = []
@@ -204,8 +205,8 @@
edit_template() method in the library_common controller.
'''
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
fdc = trans.sa_session.query( trans.app.model.FormDefinitionCurrent ).get( trans.security.decode_id(kwd['id']) )
except:
@@ -218,22 +219,22 @@
# Save changes
#
if params.get( 'save_changes_button', False ):
- fd_new, msg = self.__save_form( trans, fdc_id=fd.form_definition_current.id, **kwd )
+ fd_new, message = self.__save_form( trans, fdc_id=fd.form_definition_current.id, **kwd )
# if validation error encountered while saving the form, show the
# unsaved form, with the error message
if not fd_new:
current_form = self.__get_form( trans, **kwd )
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype='error', response_redirect=response_redirect, **kwd )
+ message=message, status='error', response_redirect=response_redirect, **kwd )
# everything went fine. form saved successfully. Show the saved form or redirect
# to response_redirect if appropriate.
if response_redirect:
return trans.response.send_redirect( response_redirect )
fd = fd_new
current_form = self.__get_saved_form( fd )
- msg = "The form '%s' has been updated with the changes." % fd.name
+ message = "The form '%s' has been updated with the changes." % fd.name
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Add a layout grid
#
@@ -242,7 +243,7 @@
current_form['layout'].append('')
# show the form again
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Delete a layout grid
#
@@ -251,7 +252,7 @@
index = int( kwd[ 'remove_layout_grid_button' ].split( ' ' )[2] ) - 1
del current_form['layout'][index]
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Add a field
#
@@ -260,7 +261,7 @@
current_form['fields'].append( self.empty_field )
# show the form again with one empty field
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Delete a field
#
@@ -270,33 +271,33 @@
index = int( kwd[ 'remove_button' ].split( ' ' )[2] ) - 1
del current_form['fields'][index]
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Add SelectField option
#
elif 'Add' in kwd.values():
- return self.__add_selectbox_option(trans, fd, msg, messagetype, response_redirect=response_redirect, **kwd)
+ return self.__add_selectbox_option(trans, fd, message, status, response_redirect=response_redirect, **kwd)
#
# Remove SelectField option
#
elif 'Remove' in kwd.values():
- return self.__remove_selectbox_option(trans, fd, msg, messagetype, response_redirect=response_redirect, **kwd)
+ return self.__remove_selectbox_option(trans, fd, message, status, response_redirect=response_redirect, **kwd)
#
# Refresh page
#
elif params.get( 'refresh', False ):
current_form = self.__get_form( trans, **kwd )
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Show the form for editing
#
else:
current_form = self.__get_saved_form( fd )
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
- def __add_selectbox_option( self, trans, fd, msg, messagetype, response_redirect=None, **kwd ):
+ def __add_selectbox_option( self, trans, fd, message, status, response_redirect=None, **kwd ):
'''
This method adds a selectbox option. The kwd dict searched for
the field index which needs to be removed
@@ -312,13 +313,13 @@
if index == -1:
# something wrong happened
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg='Error in adding selectfield option',
- messagetype='error', response_redirect=response_redirect, **kwd )
+ message='Error in adding selectfield option',
+ status='error', response_redirect=response_redirect, **kwd )
# add an empty option
current_form[ 'fields' ][ index ][ 'selectlist' ].append( '' )
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
- def __remove_selectbox_option( self, trans, fd, msg, messagetype, response_redirect=None, **kwd ):
+ message=message, status=status, response_redirect=response_redirect, **kwd )
+ def __remove_selectbox_option( self, trans, fd, message, status, response_redirect=None, **kwd ):
'''
This method removes a selectbox option. The kwd dict searched for
the field index and option index which needs to be removed
@@ -335,12 +336,12 @@
if option == -1:
# something wrong happened
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg='Error in removing selectfield option',
- messagetype='error', response_redirect=response_redirect, **kwd )
+ message='Error in removing selectfield option',
+ status='error', response_redirect=response_redirect, **kwd )
# remove the option
del current_form[ 'fields' ][ index ][ 'selectlist' ][ option ]
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
def __get_field(self, index, **kwd):
@@ -354,6 +355,7 @@
required = params.get( 'field_required_%i' % index, False )
field_type = util.restore_text( params.get( 'field_type_%i' % index, '' ) )
layout = params.get( 'field_layout_%i' % index, '' )
+ default = params.get( 'field_default_%i' % index, '' )
if field_type == 'SelectField':
selectlist = self.__get_selectbox_options(index, **kwd)
return {'label': name,
@@ -362,13 +364,15 @@
'required': required,
'type': field_type,
'selectlist': selectlist,
- 'layout': layout }
+ 'layout': layout,
+ 'default': default }
return {'label': name,
'helptext': helptext,
'visible': True,
'required': required,
'type': field_type,
- 'layout': layout}
+ 'layout': layout,
+ 'default': default}
def __get_selectbox_options(self, index, **kwd):
'''
This method gets all the options entered by the user for field when
@@ -453,7 +457,8 @@
'required': row[3],
'type': row[4],
'selectlist': options,
- 'layout':row[6]})
+ 'layout':row[6],
+ 'default': row[7]})
layouts.add(row[6])
else:
for row in reader:
@@ -463,7 +468,8 @@
'visible': row[2],
'required': row[3],
'type': row[4],
- 'selectlist': options})
+ 'selectlist': options,
+ 'default': row[7]})
except:
return trans.response.send_redirect( web.url_for( controller='forms',
action='new',
@@ -491,9 +497,9 @@
This method saves the current form
'''
# check the form for invalid inputs
- flag, msg = self.__validate_form(**kwd)
+ flag, message = self.__validate_form(**kwd)
if not flag:
- return None, msg
+ return None, message
current_form = self.__get_form( trans, **kwd )
# validate fields
for field in current_form[ 'fields' ]:
@@ -517,8 +523,8 @@
fdc.latest_form = fd
trans.sa_session.add( fdc )
trans.sa_session.flush()
- msg = "The new form named '%s' has been created. " % (fd.name)
- return fd, msg
+ message = "The new form named '%s' has been created. " % (fd.name)
+ return fd, message
class FieldUI(object):
def __init__(self, trans, layout_grids, index, field=None, field_type=None, form_type=None):
@@ -549,7 +555,9 @@
if layout_grids:
self.layout_selectbox = SelectField('field_layout_'+str(index))
for index, grid_name in enumerate(layout_grids):
- self.layout_selectbox.add_option("%i. %s" %(index+1, grid_name), index)
+ self.layout_selectbox.add_option("%i. %s" %(index+1, grid_name), index)
+ # default value
+ self.default = TextField('field_default_'+str(index), 40, '')
if field:
self.fill(trans, field, field_type, form_type)
def fill(self, trans, field, field_type=None, form_type=None):
@@ -557,6 +565,8 @@
self.label.value = field['label']
# helptext
self.helptext.value = field['helptext']
+ # default value
+ self.default.value = field['default']
# type
self.fieldtype = SelectField('field_type_'+str(self.index),
refresh_on_change=True,
@@ -608,18 +618,20 @@
return [( 'Label', self.label ),
( 'Help text', self.helptext ),
( 'Type', self.fieldtype, self.selectbox_options),
+ ( 'Default value', self.default ),
( '', self.required),
( 'Select the grid layout to place this field', self.layout_selectbox)]
return [( 'Label', self.label ),
( 'Help text', self.helptext ),
( 'Type', self.fieldtype, self.selectbox_options),
+ ( 'Default value', self.default ),
( '', self.required)]
def __repr__(self):
return str(self.index)+'.'+self.label
def label(self):
return str(self.index)+'.'+self.label
- def __show( self, trans, form, current_form, msg='', messagetype='done', response_redirect=None, **kwd ):
+ def __show( self, trans, form, current_form, message='', status='done', response_redirect=None, **kwd ):
'''
This method displays the form and any of the changes made to it,
The empty_form param allows for this method to simulate clicking
@@ -650,8 +662,8 @@
field_details=field_details,
form=form,
field_types=BaseField.form_field_types(),
- msg=msg,
- messagetype=messagetype,
+ message=message,
+ status=status,
current_form_type=current_form[ 'type' ],
layout_grids=form_layout,
response_redirect=response_redirect )
diff -r fabf48e747ae -r 7bdc5202c67e lib/galaxy/web/controllers/history.py
--- a/lib/galaxy/web/controllers/history.py Mon Apr 05 14:14:09 2010 -0400
+++ b/lib/galaxy/web/controllers/history.py Mon Apr 05 14:15:19 2010 -0400
@@ -648,8 +648,11 @@
elif 'unshare_user' in kwargs:
user = trans.sa_session.query( trans.app.model.User ).get( trans.security.decode_id( kwargs[ 'unshare_user' ] ) )
if not user:
- msg = 'History (%s) does not seem to be shared with user (%s)' % ( history.name, user.email )
- return trans.fill_template( 'history/sharing.mako', histories=histories, msg=msg, messagetype='error' )
+ message = 'History (%s) does not seem to be shared with user (%s)' % ( history.name, user.email )
+ return trans.fill_template( 'history/sharing.mako',
+ histories=histories,
+ message=message,
+ status='error' )
husas = trans.sa_session.query( trans.app.model.HistoryUserShareAssociation ).filter_by( user=user, history=history ).all()
if husas:
for husa in husas:
diff -r fabf48e747ae -r 7bdc5202c67e lib/galaxy/web/controllers/library.py
--- a/lib/galaxy/web/controllers/library.py Mon Apr 05 14:14:09 2010 -0400
+++ b/lib/galaxy/web/controllers/library.py Mon Apr 05 14:15:19 2010 -0400
@@ -10,17 +10,17 @@
@web.expose
def index( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
return trans.fill_template( "/library/index.mako",
default_action=params.get( 'default_action', None ),
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def browse_libraries( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
current_user_roles = trans.get_current_user_roles()
all_libraries = trans.sa_session.query( trans.app.model.Library ) \
.filter( trans.app.model.Library.table.c.deleted==False ) \
@@ -32,5 +32,5 @@
return trans.fill_template( '/library/browse_libraries.mako',
libraries=authorized_libraries,
default_action=params.get( 'default_action', None ),
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
diff -r fabf48e747ae -r 7bdc5202c67e lib/galaxy/web/controllers/library_admin.py
--- a/lib/galaxy/web/controllers/library_admin.py Mon Apr 05 14:14:09 2010 -0400
+++ b/lib/galaxy/web/controllers/library_admin.py Mon Apr 05 14:15:19 2010 -0400
@@ -92,8 +92,8 @@
@web.require_admin
def create_library( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
if params.get( 'create_library_button', False ):
name = util.restore_text( params.get( 'name', 'No name' ) )
description = util.restore_text( params.get( 'description', '' ) )
@@ -105,14 +105,14 @@
library.root_folder = root_folder
trans.sa_session.add_all( ( library, root_folder ) )
trans.sa_session.flush()
- msg = "The new library named '%s' has been created" % library.name
+ message = "The new library named '%s' has been created" % library.name
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller='library_admin',
id=trans.security.encode_id( library.id ),
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
- return trans.fill_template( '/admin/library/new_library.mako', msg=msg, messagetype=messagetype )
+ message=util.sanitize_text( message ),
+ status='done' ) )
+ return trans.fill_template( '/admin/library/new_library.mako', message=message, status=status )
@web.expose
@web.require_admin
def purge_library( self, trans, **kwd ):
@@ -146,20 +146,20 @@
trans.sa_session.add( library_folder )
trans.sa_session.flush()
if not library.deleted:
- msg = "Library '%s' has not been marked deleted, so it cannot be purged" % ( library.name )
+ message = "Library '%s' has not been marked deleted, so it cannot be purged" % ( library.name )
return trans.response.send_redirect( web.url_for( controller='library_admin',
action='browse_libraries',
- message=util.sanitize_text( msg ),
+ message=util.sanitize_text( message ),
status='error' ) )
else:
purge_folder( library.root_folder )
library.purged = True
trans.sa_session.add( library )
trans.sa_session.flush()
- msg = "Library '%s' and all of its contents have been purged, datasets will be removed from disk via the cleanup_datasets script" % library.name
+ message = "Library '%s' and all of its contents have been purged, datasets will be removed from disk via the cleanup_datasets script" % library.name
return trans.response.send_redirect( web.url_for( controller='library_admin',
action='browse_libraries',
- message=util.sanitize_text( msg ),
+ message=util.sanitize_text( message ),
status='done' ) )
@web.expose
@web.require_admin
@@ -176,8 +176,8 @@
'folder': trans.app.model.LibraryFolder,
'library_dataset': trans.app.model.LibraryDataset }
if item_type not in item_types:
- msg = 'Bad item_type specified: %s' % str( item_type )
- messagetype = 'error'
+ message = 'Bad item_type specified: %s' % str( item_type )
+ status = 'error'
else:
if item_type == 'library_dataset':
item_desc = 'Dataset'
@@ -187,18 +187,18 @@
library_item.deleted = True
trans.sa_session.add( library_item )
trans.sa_session.flush()
- msg = util.sanitize_text( "%s '%s' has been marked deleted" % ( item_desc, library_item.name ) )
- messagetype = 'done'
+ message = util.sanitize_text( "%s '%s' has been marked deleted" % ( item_desc, library_item.name ) )
+ status = 'done'
if item_type == 'library':
- return self.browse_libraries( trans, message=msg, status=messagetype )
+ return self.browse_libraries( trans, message=message, status=status )
else:
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller='library_admin',
id=library_id,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype ) )
+ message=message,
+ status=status ) )
@web.expose
@web.require_admin
def undelete_library_item( self, trans, library_id, item_id, item_type, **kwd ):
@@ -208,7 +208,7 @@
'folder': trans.app.model.LibraryFolder,
'library_dataset': trans.app.model.LibraryDataset }
if item_type not in item_types:
- msg = 'Bad item_type specified: %s' % str( item_type )
+ message = 'Bad item_type specified: %s' % str( item_type )
status = ERROR
else:
if item_type == 'library_dataset':
@@ -217,21 +217,21 @@
item_desc = item_type.capitalize()
library_item = trans.sa_session.query( item_types[ item_type ] ).get( trans.security.decode_id( item_id ) )
if library_item.purged:
- msg = '%s %s has been purged, so it cannot be undeleted' % ( item_desc, library_item.name )
+ message = '%s %s has been purged, so it cannot be undeleted' % ( item_desc, library_item.name )
status = ERROR
else:
library_item.deleted = False
trans.sa_session.add( library_item )
trans.sa_session.flush()
- msg = util.sanitize_text( "%s '%s' has been marked undeleted" % ( item_desc, library_item.name ) )
+ message = util.sanitize_text( "%s '%s' has been marked undeleted" % ( item_desc, library_item.name ) )
status = SUCCESS
if item_type == 'library':
- return self.browse_libraries( trans, message=msg, status=status )
+ return self.browse_libraries( trans, message=message, status=status )
else:
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller='library_admin',
id=library_id,
show_deleted=show_deleted,
- msg=msg,
- messagetype=status ) )
+ message=message,
+ status=status ) )
diff -r fabf48e747ae -r 7bdc5202c67e lib/galaxy/web/controllers/library_common.py
--- a/lib/galaxy/web/controllers/library_common.py Mon Apr 05 14:14:09 2010 -0400
+++ b/lib/galaxy/web/controllers/library_common.py Mon Apr 05 14:15:19 2010 -0400
@@ -79,18 +79,18 @@
@web.expose
def browse_library( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
library_id = params.get( 'id', None )
if not library_id:
# To handle bots
- msg = "You must specify a library id."
- messagetype = 'error'
+ message = "You must specify a library id."
+ status = 'error'
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
if not library:
# To handle bots
- msg = "Invalid library id ( %s )." % str( library_id )
- messagetype = 'error'
+ message = "Invalid library id ( %s )." % str( library_id )
+ status = 'error'
else:
# If use_panels is True, the library is being accessed via an external link
# which did not originate from within the Galaxy instance, and the library will
@@ -100,12 +100,12 @@
created_ldda_ids = params.get( 'created_ldda_ids', '' )
hidden_folder_ids = util.listify( params.get( 'hidden_folder_ids', '' ) )
current_user_roles = trans.get_current_user_roles()
- if created_ldda_ids and not msg:
- msg = "%d datasets are uploading in the background to the library '%s' (each is selected). " % \
+ if created_ldda_ids and not message:
+ message = "%d datasets are uploading in the background to the library '%s' (each is selected). " % \
( len( created_ldda_ids.split( ',' ) ), library.name )
- msg += "Don't navigate away from Galaxy or use the browser's \"stop\" or \"reload\" buttons (on this tab) until the "
- msg += "message \"This job is running\" is cleared from the \"Information\" column below for each selected dataset."
- messagetype = "info"
+ message += "Don't navigate away from Galaxy or use the browser's \"stop\" or \"reload\" buttons (on this tab) until the "
+ message += "message \"This job is running\" is cleared from the \"Information\" column below for each selected dataset."
+ status = "info"
return trans.fill_template( '/library/common/browse_library.mako',
cntrller=cntrller,
use_panels=use_panels,
@@ -115,19 +115,19 @@
show_deleted=show_deleted,
comptypes=comptypes,
current_user_roles=current_user_roles,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
return trans.response.send_redirect( web.url_for( use_panels=use_panels,
controller=cntrller,
action='browse_libraries',
default_action=params.get( 'default_action', None ),
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
@web.expose
def library_info( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
library_id = params.get( 'id', None )
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
@@ -140,8 +140,8 @@
old_name = library.name
new_name = util.restore_text( params.get( 'name', 'No name' ) )
if not new_name:
- msg = 'Enter a valid name'
- messagetype='error'
+ message = 'Enter a valid name'
+ status='error'
else:
new_description = util.restore_text( params.get( 'description', '' ) )
new_synopsis = util.restore_text( params.get( 'synopsis', '' ) )
@@ -155,15 +155,15 @@
library.root_folder.description = new_description
trans.sa_session.add_all( ( library, library.root_folder ) )
trans.sa_session.flush()
- msg = "The information has been updated."
+ message = "The information has been updated."
return trans.response.send_redirect( web.url_for( controller='library_common',
action='library_info',
cntrller=cntrller,
use_panels=use_panels,
id=trans.security.encode_id( library.id ),
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
return trans.fill_template( '/library/common/library_info.mako',
cntrller=cntrller,
use_panels=use_panels,
@@ -173,13 +173,13 @@
show_deleted=show_deleted,
info_association=info_association,
inherited=inherited,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def library_permissions( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
library_id = params.get( 'id', None )
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
@@ -195,15 +195,15 @@
trans.sa_session.refresh( library )
# Copy the permissions to the root folder
trans.app.security_agent.copy_library_permissions( library, library.root_folder )
- msg = "Permissions updated for library '%s'" % library.name
+ message = "Permissions updated for library '%s'" % library.name
return trans.response.send_redirect( web.url_for( controller='library_common',
action='library_permissions',
cntrller=cntrller,
use_panels=use_panels,
id=trans.security.encode_id( library.id ),
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
roles = trans.app.security_agent.get_legitimate_roles( trans, library, cntrller )
return trans.fill_template( '/library/common/library_permissions.mako',
cntrller=cntrller,
@@ -212,26 +212,26 @@
current_user_roles=current_user_roles,
roles=roles,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def create_folder( self, trans, cntrller, parent_id, library_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
parent_folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( parent_id ) )
if not parent_folder:
- msg = "Invalid parent folder id (%s) specified" % str( parent_id )
+ message = "Invalid parent folder id (%s) specified" % str( parent_id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
if params.get( 'new_folder_button', False ):
new_folder = trans.app.model.LibraryFolder( name=util.restore_text( params.name ),
description=util.restore_text( params.description ) )
@@ -252,8 +252,8 @@
widgets = new_folder.get_template_widgets( trans )
if info_association:
current_user_roles = trans.get_current_user_roles()
- msg = "The new folder named '%s' has been added to the data library. " % new_folder.name
- msg += "Additional information about this folder may be added using the inherited template."
+ message = "The new folder named '%s' has been added to the data library. " % new_folder.name
+ message += "Additional information about this folder may be added using the inherited template."
return trans.fill_template( '/library/common/folder_info.mako',
cntrller=cntrller,
use_panels=use_panels,
@@ -264,18 +264,18 @@
show_deleted=show_deleted,
info_association=info_association,
inherited=inherited,
- msg=msg,
- messagetype='done' )
+ message=message,
+ status='done' )
# If not inheritable info_association, redirect to the library.
- msg = "The new folder named '%s' has been added to the data library." % new_folder.name
+ message = "The new folder named '%s' has been added to the data library." % new_folder.name
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
# We do not render any template widgets on creation pages since saving the info_association
# cannot occur before the associated item is saved.
return trans.fill_template( '/library/common/new_folder.mako',
@@ -284,13 +284,13 @@
library_id=library_id,
folder=parent_folder,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def folder_info( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( id ) )
@@ -306,18 +306,18 @@
new_name = util.restore_text( params.name )
new_description = util.restore_text( params.description )
if not new_name:
- msg = 'Enter a valid name'
- messagetype='error'
+ message = 'Enter a valid name'
+ status='error'
else:
folder.name = new_name
folder.description = new_description
trans.sa_session.add( folder )
trans.sa_session.flush()
- msg = "The information has been updated."
- messagetype='done'
+ message = "The information has been updated."
+ status='done'
else:
- msg = "You are not authorized to edit this folder"
- messagetype='error'
+ message = "You are not authorized to edit this folder"
+ status='error'
return trans.fill_template( '/library/common/folder_info.mako',
cntrller=cntrller,
use_panels=use_panels,
@@ -328,26 +328,26 @@
show_deleted=show_deleted,
info_association=info_association,
inherited=inherited,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def folder_permissions( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( id ) )
if not folder:
- msg = "Invalid folder specified, id: %s" % str( id )
+ message = "Invalid folder specified, id: %s" % str( id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
current_user_roles = trans.get_current_user_roles()
if params.get( 'update_roles_button', False ):
# The user clicked the Save button on the 'Associate With Roles' form
@@ -361,11 +361,11 @@
permissions[ trans.app.security_agent.get_action( v.action ) ] = in_roles
trans.app.security_agent.set_all_library_permissions( folder, permissions )
trans.sa_session.refresh( folder )
- msg = 'Permissions updated for folder %s' % folder.name
- messagetype='done'
+ message = 'Permissions updated for folder %s' % folder.name
+ status='done'
else:
- msg = "You are not authorized to manage permissions on this folder"
- messagetype = "error"
+ message = "You are not authorized to manage permissions on this folder"
+ status = "error"
return trans.response.send_redirect( web.url_for( controller='library_common',
action='folder_permissions',
cntrller=cntrller,
@@ -373,8 +373,8 @@
id=trans.security.encode_id( folder.id ),
library_id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
# If the library is public all roles are legitimate, but if the library is restricted, only those
# roles associated with the LIBRARY_ACCESS permission are legitimate.
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
@@ -387,26 +387,26 @@
current_user_roles=current_user_roles,
roles=roles,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def ldda_edit_info( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( id ) )
if not ldda:
- msg = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id )
+ message = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
dbkey = params.get( 'dbkey', '?' )
if isinstance( dbkey, list ):
dbkey = dbkey[0]
@@ -424,14 +424,14 @@
if ldda.datatype.allow_datatype_change and trans.app.datatypes_registry.get_datatype_by_extension( params.datatype ).allow_datatype_change:
trans.app.datatypes_registry.change_datatype( ldda, params.datatype )
trans.sa_session.flush()
- msg = "Data type changed for library dataset '%s'" % ldda.name
- messagetype = 'done'
+ message = "Data type changed for library dataset '%s'" % ldda.name
+ status = 'done'
else:
- msg = "You are unable to change datatypes in this manner. Changing %s to %s is not allowed." % ( ldda.extension, params.datatype )
- messagetype = 'error'
+ message = "You are unable to change datatypes in this manner. Changing %s to %s is not allowed." % ( ldda.extension, params.datatype )
+ status = 'error'
else:
- msg = "You are not authorized to change the data type of dataset '%s'" % ldda.name
- messagetype = 'error'
+ message = "You are not authorized to change the data type of dataset '%s'" % ldda.name
+ status = 'error'
elif params.get( 'save', False ):
# The user clicked the Save button on the 'Edit Attributes' form
if cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda ):
@@ -440,8 +440,8 @@
new_info = util.restore_text( params.get( 'info', '' ) )
new_message = util.restore_text( params.get( 'message', '' ) )
if not new_name:
- msg = 'Enter a valid name'
- messagetype = 'error'
+ message = 'Enter a valid name'
+ status = 'error'
else:
ldda.name = new_name
ldda.info = new_info
@@ -459,11 +459,11 @@
ldda.metadata.dbkey = dbkey
ldda.datatype.after_setting_metadata( ldda )
trans.sa_session.flush()
- msg = 'Attributes updated for library dataset %s' % ldda.name
- messagetype = 'done'
+ message = 'Attributes updated for library dataset %s' % ldda.name
+ status = 'done'
else:
- msg = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name
- messagetype = 'error'
+ message = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name
+ status = 'error'
elif params.get( 'detect', False ):
# The user clicked the Auto-detect button on the 'Edit Attributes' form
if cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda ):
@@ -475,11 +475,11 @@
ldda.datatype.set_meta( ldda )
ldda.datatype.after_setting_metadata( ldda )
trans.sa_session.flush()
- msg = 'Attributes updated for library dataset %s' % ldda.name
- messagetype = 'done'
+ message = 'Attributes updated for library dataset %s' % ldda.name
+ status = 'done'
else:
- msg = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name
- messagetype = 'error'
+ message = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name
+ status = 'error'
if cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda ):
if "dbkey" in ldda.datatype.metadata_spec and not ldda.metadata.dbkey:
# Copy dbkey into metadata, for backwards compatability
@@ -499,26 +499,26 @@
show_deleted=show_deleted,
info_association=info_association,
inherited=inherited,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def ldda_info( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( id ) )
if not ldda:
- msg = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id )
+ message = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
# See if we have any associated templates
widgets = []
@@ -536,13 +536,13 @@
current_user_roles=current_user_roles,
info_association=info_association,
inherited=inherited,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def ldda_permissions( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
ids = util.listify( id )
@@ -550,15 +550,15 @@
for id in [ trans.security.decode_id( id ) for id in ids ]:
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( id )
if ldda is None:
- msg = 'You specified an invalid LibraryDatasetDatasetAssociation id: %s' %str( id )
+ message = 'You specified an invalid LibraryDatasetDatasetAssociation id: %s' %str( id )
trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
lddas.append( ldda )
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
# If access to the dataset is restricted, then use the roles associated with the DATASET_ACCESS permission to
@@ -577,7 +577,7 @@
if cntrller=='library_admin' or ( trans.app.security_agent.can_manage_library_item( current_user_roles, ldda ) and \
trans.app.security_agent.can_manage_dataset( current_user_roles, ldda.dataset ) ):
a = trans.app.security_agent.get_action( trans.app.security_agent.permitted_actions.DATASET_ACCESS.action )
- permissions, in_roles, error, msg = \
+ permissions, in_roles, error, message = \
trans.app.security_agent.derive_roles_from_access( trans, trans.app.security.decode_id( library_id ), cntrller, library=True, **kwd )
for ldda in lddas:
# Set the DATASET permissions on the Dataset.
@@ -601,13 +601,13 @@
trans.app.security_agent.set_all_library_permissions( ldda, permissions )
trans.sa_session.refresh( ldda )
if error:
- messagetype = 'error'
+ status = 'error'
else:
- msg = 'Permissions have been updated on %d datasets.' % len( lddas )
- messagetype= 'done'
+ message = 'Permissions have been updated on %d datasets.' % len( lddas )
+ status= 'done'
else:
- msg = "You are not authorized to change the permissions of dataset '%s'" % ldda.name
- messagetype = 'error'
+ message = "You are not authorized to change the permissions of dataset '%s'" % ldda.name
+ status = 'error'
return trans.fill_template( "/library/common/ldda_permissions.mako",
cntrller=cntrller,
use_panels=use_panels,
@@ -615,8 +615,8 @@
library_id=library_id,
roles=roles,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
if len( ids ) > 1:
# Ensure that the permissions across all library items are identical, otherwise we can't update them together.
check_list = []
@@ -634,15 +634,15 @@
if not check_list:
check_list = permissions
if permissions != check_list:
- msg = 'The datasets you selected do not have identical permissions, so they can not be updated together'
+ message = 'The datasets you selected do not have identical permissions, so they can not be updated together'
trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
# Display permission form, permissions will be updated for all lddas simultaneously.
return trans.fill_template( "/library/common/ldda_permissions.mako",
cntrller=cntrller,
@@ -651,13 +651,13 @@
library_id=library_id,
roles=roles,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def upload_library_dataset( self, trans, cntrller, library_id, folder_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
deleted = util.string_as_bool( params.get( 'deleted', False ) )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
dbkey = params.get( 'dbkey', '?' )
@@ -694,10 +694,10 @@
error = None
if roles:
vars = dict( DATASET_ACCESS_in=roles )
- permissions, in_roles, error, msg = \
+ permissions, in_roles, error, message = \
trans.app.security_agent.derive_roles_from_access( trans, trans.app.security.decode_id( library_id ), cntrller, library=True, **vars )
if error:
- messagetype = 'error'
+ status = 'error'
trans.response.send_redirect( web.url_for( controller='library_common',
action='upload_library_dataset',
cntrller=cntrller,
@@ -706,8 +706,8 @@
replace_id=replace_id,
upload_option=upload_option,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
else:
# See if we have any inherited templates, but do not inherit contents.
@@ -731,16 +731,16 @@
ldda_id_list = [ str( v.id ) for k, v in created_outputs_dict.items() ]
created_ldda_ids=",".join( ldda_id_list )
if replace_dataset:
- msg = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset_name, folder.name )
+ message = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset_name, folder.name )
else:
if not folder.parent:
# Libraries have the same name as their root_folder
- msg = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name )
+ message = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name )
else:
- msg = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name )
+ message = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name )
if cntrller == 'library_admin':
- msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
- messagetype='done'
+ message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
+ status='done'
else:
# Since permissions on all LibraryDatasetDatasetAssociations must be the same at this point, we only need
# to check one of them to see if the current user can manage permissions on them.
@@ -749,7 +749,7 @@
if replace_dataset:
default_action = ''
else:
- msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
+ message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
default_action = 'manage_permissions'
else:
default_action = 'add'
@@ -760,21 +760,21 @@
default_action=default_action,
created_ldda_ids=created_ldda_ids,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
else:
created_ldda_ids = ''
- msg = "Upload failed"
- messagetype='error'
+ message = "Upload failed"
+ status='error'
trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
id=library_id,
created_ldda_ids=created_ldda_ids,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
# See if we have any inherited templates, but do not inherit contents.
info_association, inherited = folder.get_info_association( inherited=True )
if info_association and info_association.inheritable:
@@ -819,8 +819,8 @@
history=history,
widgets=widgets,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
def upload_dataset( self, trans, cntrller, library_id, folder_id, replace_dataset=None, **kwd ):
# Set up the traditional tool state/params
tool_id = 'upload1'
@@ -836,8 +836,8 @@
params = util.Params( kwd ) # is this filetoolparam safe?
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
library_bunch = upload_common.handle_library_params( trans, params, folder_id, replace_dataset )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
server_dir = util.restore_text( params.get( 'server_dir', '' ) )
if replace_dataset not in [ None, 'None' ]:
replace_id = trans.security.encode_id( replace_dataset.id )
@@ -860,21 +860,21 @@
else:
full_dir = os.path.join( import_dir, trans.user.email, server_dir )
if import_dir:
- msg = 'Select a directory'
+ message = 'Select a directory'
else:
- msg = '"%s" is not defined in the Galaxy configuration file' % import_dir_desc
+ message = '"%s" is not defined in the Galaxy configuration file' % import_dir_desc
# Proceed with (mostly) regular upload processing
precreated_datasets = upload_common.get_precreated_datasets( trans, tool_params, trans.app.model.LibraryDatasetDatasetAssociation, controller=cntrller )
if upload_option == 'upload_file':
tool_params = upload_common.persist_uploads( tool_params )
uploaded_datasets = upload_common.get_uploaded_datasets( trans, cntrller, tool_params, precreated_datasets, dataset_upload_inputs, library_bunch=library_bunch )
elif upload_option == 'upload_directory':
- uploaded_datasets, err_redirect, msg = self.get_server_dir_uploaded_datasets( trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, msg )
+ uploaded_datasets, err_redirect, message = self.get_server_dir_uploaded_datasets( trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, message )
elif upload_option == 'upload_paths':
- uploaded_datasets, err_redirect, msg = self.get_path_paste_uploaded_datasets( trans, cntrller, params, library_bunch, err_redirect, msg )
+ uploaded_datasets, err_redirect, message = self.get_path_paste_uploaded_datasets( trans, cntrller, params, library_bunch, err_redirect, message )
upload_common.cleanup_unused_precreated_datasets( precreated_datasets )
if upload_option == 'upload_file' and not uploaded_datasets:
- msg = 'Select a file, enter a URL or enter text'
+ message = 'Select a file, enter a URL or enter text'
err_redirect = True
if err_redirect:
trans.response.send_redirect( web.url_for( controller='library_common',
@@ -885,8 +885,8 @@
replace_id=replace_id,
upload_option=upload_option,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
json_file_path = upload_common.create_paramfile( trans, uploaded_datasets )
data_list = [ ud.data for ud in uploaded_datasets ]
return upload_common.create_job( trans, tool_params, tool, json_file_path, data_list, folder=library_bunch.folder )
@@ -909,7 +909,7 @@
trans.sa_session.add( uploaded_dataset.data )
trans.sa_session.flush()
return uploaded_dataset
- def get_server_dir_uploaded_datasets( self, trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, msg ):
+ def get_server_dir_uploaded_datasets( self, trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, message ):
files = []
try:
for entry in os.listdir( full_dir ):
@@ -925,23 +925,23 @@
if os.path.isfile( path ):
files.append( path )
except Exception, e:
- msg = "Unable to get file list for configured %s, error: %s" % ( import_dir_desc, str( e ) )
+ message = "Unable to get file list for configured %s, error: %s" % ( import_dir_desc, str( e ) )
err_redirect = True
- return None, err_redirect, msg
+ return None, err_redirect, message
if not files:
- msg = "The directory '%s' contains no valid files" % full_dir
+ message = "The directory '%s' contains no valid files" % full_dir
err_redirect = True
- return None, err_redirect, msg
+ return None, err_redirect, message
uploaded_datasets = []
for file in files:
name = os.path.basename( file )
uploaded_datasets.append( self.make_library_uploaded_dataset( trans, cntrller, params, name, file, 'server_dir', library_bunch ) )
return uploaded_datasets, None, None
- def get_path_paste_uploaded_datasets( self, trans, cntrller, params, library_bunch, err_redirect, msg ):
+ def get_path_paste_uploaded_datasets( self, trans, cntrller, params, library_bunch, err_redirect, message ):
if params.get( 'filesystem_paths', '' ) == '':
- msg = "No paths entered in the upload form"
+ message = "No paths entered in the upload form"
err_redirect = True
- return None, err_redirect, msg
+ return None, err_redirect, message
preserve_dirs = True
if params.get( 'dont_preserve_dirs', False ):
preserve_dirs = False
@@ -974,16 +974,16 @@
library_bunch,
in_folder ) )
if bad_paths:
- msg = "Invalid paths:<br><ul><li>%s</li></ul>" % "</li><li>".join( bad_paths )
+ message = "Invalid paths:<br><ul><li>%s</li></ul>" % "</li><li>".join( bad_paths )
err_redirect = True
- return None, err_redirect, msg
+ return None, err_redirect, message
return uploaded_datasets, None, None
@web.expose
def add_history_datasets_to_library( self, trans, cntrller, library_id, folder_id, hda_ids='', **kwd ):
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( folder_id ) )
replace_id = params.get( 'replace_id', None )
if replace_id:
@@ -994,14 +994,14 @@
history = trans.get_history()
trans.sa_session.refresh( history )
if not history.active_datasets:
- msg = 'Your current history is empty'
+ message = 'Your current history is empty'
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
if params.get( 'add_history_datasets_to_library_button', False ):
hda_ids = util.listify( hda_ids )
if hda_ids:
@@ -1021,28 +1021,28 @@
# Permissions must be the same on the LibraryDatasetDatasetAssociation and the associated LibraryDataset
trans.app.security_agent.copy_library_permissions( ldda.library_dataset, ldda )
else:
- msg = "The requested HistoryDatasetAssociation id %s is invalid" % str( hda_id )
+ message = "The requested HistoryDatasetAssociation id %s is invalid" % str( hda_id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
if created_ldda_ids:
created_ldda_ids = created_ldda_ids.lstrip( ',' )
ldda_id_list = created_ldda_ids.split( ',' )
total_added = len( ldda_id_list )
if replace_dataset:
- msg = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset.name, folder.name )
+ message = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset.name, folder.name )
else:
if not folder.parent:
# Libraries have the same name as their root_folder
- msg = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name )
+ message = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name )
else:
- msg = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name )
+ message = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name )
if cntrller == 'library_admin':
- msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
+ message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
else:
# Since permissions on all LibraryDatasetDatasetAssociations must be the same at this point, we only need
# to check one of them to see if the current user can manage permissions on them.
@@ -1052,7 +1052,7 @@
if replace_dataset:
default_action = ''
else:
- msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
+ message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
default_action = 'manage_permissions'
else:
default_action = 'add'
@@ -1062,11 +1062,11 @@
id=library_id,
created_ldda_ids=created_ldda_ids,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
else:
- msg = 'Select at least one dataset from the list of active datasets in your current history'
- messagetype = 'error'
+ message = 'Select at least one dataset from the list of active datasets in your current history'
+ status = 'error'
last_used_build = folder.genome_build
upload_option = params.get( 'upload_option', 'import_from_history' )
# Send list of data formats to the form so the "extension" select list can be populated dynamically
@@ -1091,8 +1091,8 @@
history=history,
widgets=[],
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def download_dataset_from_folder( self, trans, cntrller, id, library_id=None, **kwd ):
"""Catches the dataset id and displays file contents as directed"""
@@ -1101,8 +1101,8 @@
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( id ) )
if not ldda.dataset:
- msg = 'Invalid LibraryDatasetDatasetAssociation id %s received for file download' % str( id )
- messagetype = 'error'
+ message = 'Invalid LibraryDatasetDatasetAssociation id %s received for file download' % str( id )
+ status = 'error'
else:
composite_extensions = trans.app.datatypes_registry.get_composite_extensions( )
ext = ldda.extension
@@ -1123,33 +1123,33 @@
try:
return open( ldda.file_name )
except:
- msg = 'This dataset contains no content'
+ message = 'This dataset contains no content'
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
@web.expose
def library_dataset_info( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
library_dataset = trans.sa_session.query( trans.app.model.LibraryDataset ).get( trans.security.decode_id( id ) )
if not library_dataset:
- msg = "Invalid library dataset specified, id: %s" %str( id )
+ message = "Invalid library dataset specified, id: %s" %str( id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
current_user_roles = trans.get_current_user_roles()
# See if we have any associated templates
widgets = []
@@ -1163,18 +1163,18 @@
new_name = util.restore_text( params.get( 'name', '' ) )
new_info = util.restore_text( params.get( 'info', '' ) )
if not new_name:
- msg = 'Enter a valid name'
- messagetype = 'error'
+ message = 'Enter a valid name'
+ status = 'error'
else:
library_dataset.name = new_name
library_dataset.info = new_info
trans.sa_session.add( library_dataset )
trans.sa_session.flush()
- msg = "The information has been updated."
- messagetype = 'done'
+ message = "The information has been updated."
+ status = 'done'
else:
- msg = "You are not authorized to change the attributes of this dataset"
- messagetype = "error"
+ message = "You are not authorized to change the attributes of this dataset"
+ status = "error"
return trans.fill_template( '/library/common/library_dataset_info.mako',
cntrller=cntrller,
use_panels=use_panels,
@@ -1185,26 +1185,26 @@
inherited=inherited,
widgets=widgets,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def library_dataset_permissions( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
library_dataset = trans.sa_session.query( trans.app.model.LibraryDataset ).get( id )
if not library_dataset:
- msg = "Invalid library dataset specified, id: %s" %str( id )
+ message = "Invalid library dataset specified, id: %s" %str( id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
current_user_roles = trans.get_current_user_roles()
if params.get( 'update_roles_button', False ):
if cntrller == 'library_admin' or trans.app.security_agent.can_manage_library_item( current_user_roles, library_dataset ):
@@ -1223,11 +1223,11 @@
# Set the LIBRARY permissions on the LibraryDatasetDatasetAssociation
trans.app.security_agent.set_all_library_permissions( library_dataset.library_dataset_dataset_association, permissions )
trans.sa_session.refresh( library_dataset.library_dataset_dataset_association )
- msg = 'Permissions and roles have been updated for library dataset %s' % library_dataset.name
- messagetype = 'done'
+ message = 'Permissions and roles have been updated for library dataset %s' % library_dataset.name
+ status = 'done'
else:
- msg = "You are not authorized to managed the permissions of this dataset"
- messagetype = "error"
+ message = "You are not authorized to managed the permissions of this dataset"
+ status = "error"
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
roles = trans.app.security_agent.get_legitimate_roles( trans, library, cntrller )
return trans.fill_template( '/library/common/library_dataset_permissions.mako',
@@ -1238,53 +1238,53 @@
roles=roles,
current_user_roles=current_user_roles,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def act_on_multiple_datasets( self, trans, cntrller, library_id, ldda_ids='', **kwd ):
# Perform an action on a list of library datasets.
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
action = params.get( 'do_action', None )
if not ldda_ids:
- msg = "You must select at least one dataset"
- messagetype = 'error'
+ message = "You must select at least one dataset"
+ status = 'error'
elif not action:
- msg = "You must select an action to perform on selected datasets"
- messagetype = 'error'
+ message = "You must select an action to perform on selected datasets"
+ status = 'error'
else:
ldda_ids = util.listify( ldda_ids )
if action == 'import_to_history' or action == 'add':
history = trans.get_history()
if history is None:
# Must be a bot sending a request without having a history.
- msg = "You do not have a current history"
+ message = "You do not have a current history"
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
total_imported_lddas = 0
- msg = ''
- messagetype = 'done'
+ message = ''
+ status = 'done'
for ldda_id in ldda_ids:
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_id ) )
if ldda.dataset.state in [ 'new', 'upload', 'queued', 'running', 'empty', 'discarded' ]:
- msg += "Cannot import dataset (%s) since it's state is (%s). " % ( ldda.name, ldda.dataset.state )
- messagetype = 'error'
+ message += "Cannot import dataset (%s) since it's state is (%s). " % ( ldda.name, ldda.dataset.state )
+ status = 'error'
elif ldda.dataset.state in [ 'ok', 'error' ]:
hda = ldda.to_history_dataset_association( target_history=history, add_to_history=True )
total_imported_lddas += 1
if total_imported_lddas:
trans.sa_session.add( history )
trans.sa_session.flush()
- msg += "%i dataset(s) have been imported into your history. " % total_imported_lddas
+ message += "%i dataset(s) have been imported into your history. " % total_imported_lddas
elif action == 'manage_permissions':
# We need the folder containing the LibraryDatasetDatasetAssociation(s)
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_ids[0] ) )
@@ -1296,8 +1296,8 @@
folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ),
id=",".join( ldda_ids ),
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
elif action == 'delete':
for ldda_id in ldda_ids:
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_id ) )
@@ -1307,7 +1307,7 @@
ld.deleted = True
trans.sa_session.add( ld )
trans.sa_session.flush()
- msg = "The selected datasets have been removed from this data library"
+ message = "The selected datasets have been removed from this data library"
elif action in ['zip','tgz','tbz']:
error = False
killme = string.punctuation + string.whitespace
@@ -1332,13 +1332,13 @@
except (OSError, zipfile.BadZipFile):
error = True
log.exception( "Unable to create archive for download" )
- msg = "Unable to create archive for download, please report this error"
- messagetype = 'error'
+ message = "Unable to create archive for download, please report this error"
+ status = 'error'
except:
error = True
log.exception( "Unexpected error %s in create archive for download" % sys.exc_info()[0])
- msg = "Unable to create archive for download, please report - %s" % sys.exc_info()[0]
- messagetype = 'error'
+ message = "Unable to create archive for download, please report - %s" % sys.exc_info()[0]
+ status = 'error'
if not error:
composite_extensions = trans.app.datatypes_registry.get_composite_extensions( )
seen = []
@@ -1374,8 +1374,8 @@
except IOError:
error = True
log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name)
- msg = "Unable to create archive for download, please report this error"
- messagetype = 'error'
+ message = "Unable to create archive for download, please report this error"
+ status = 'error'
continue
flist = glob.glob(os.path.join(ldda.dataset.extra_files_path,'*.*')) # glob returns full paths
for fpath in flist:
@@ -1387,8 +1387,8 @@
except IOError:
error = True
log.exception( "Unable to add %s to temporary library download archive %s" % (fname,outfname))
- msg = "Unable to create archive for download, please report this error"
- messagetype = 'error'
+ message = "Unable to create archive for download, please report this error"
+ status = 'error'
continue
else: # simple case
try:
@@ -1396,8 +1396,8 @@
except IOError:
error = True
log.exception( "Unable to write %s to temporary library download archive" % ldda.dataset.file_name)
- msg = "Unable to create archive for download, please report this error"
- messagetype = 'error'
+ message = "Unable to create archive for download, please report this error"
+ status = 'error'
if not error:
if action == 'zip':
archive.close()
@@ -1409,8 +1409,8 @@
except OSError:
error = True
log.exception( "Unable to remove temporary library download archive and directory" )
- msg = "Unable to create archive for download, please report this error"
- messagetype = 'error'
+ message = "Unable to create archive for download, please report this error"
+ status = 'error'
if not error:
trans.response.set_content_type( "application/x-zip-compressed" )
trans.response.headers[ "Content-Disposition" ] = "attachment; filename=%s.%s" % (outfname,outext)
@@ -1422,7 +1422,7 @@
archive.wsgi_headeritems = trans.response.wsgi_headeritems()
return archive.stream
else: # unknown action
- msg = '### unknown action = %s in act_on_multiple_datasets' % action
+ message = '### unknown action = %s in act_on_multiple_datasets' % action
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
@@ -1430,8 +1430,8 @@
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
def get_item_and_stuff( self, trans, item_type, library_id, folder_id, ldda_id ):
# Return an item, description, action and an id based on the item_type.
if item_type == 'library':
@@ -1450,14 +1450,14 @@
action = 'ldda_edit_info'
id = ldda_id
else:
- msg = "Invalid library item type ( %s )" % str( item_type )
+ message = "Invalid library item type ( %s )" % str( item_type )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
return item, item_desc, action, id
@web.expose
def add_template( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, **kwd ):
@@ -1466,19 +1466,19 @@
filter=dict( deleted=False ),
form_type=trans.app.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE )
if not forms:
- msg = "There are no forms on which to base the template, so create a form and then add the template."
+ message = "There are no forms on which to base the template, so create a form and then add the template."
trans.response.send_redirect( web.url_for( controller='forms',
action='new',
- msg=msg,
- messagetype='done',
+ message=message,
+ status='done',
form_type=trans.app.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE ) )
else:
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
+ message = util.restore_text( params.get( 'message', '' ) )
action = ''
- messagetype = params.get( 'messagetype', 'done' )
+ status = params.get( 'status', 'done' )
item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id )
# If the inheritable checkbox is checked, the param will be in the request
inheritable = CheckboxField.is_checked( params.get( 'inheritable', '' ) )
@@ -1497,7 +1497,7 @@
assoc = trans.app.model.LibraryDatasetDatasetInfoAssociation( item, form, form_values )
trans.sa_session.add( assoc )
trans.sa_session.flush()
- msg = 'A template based on the form "%s" has been added to this %s.' % ( form.name, item_desc )
+ message = 'A template based on the form "%s" has been added to this %s.' % ( form.name, item_desc )
trans.response.send_redirect( web.url_for( controller='library_common',
action=action,
cntrller=cntrller,
@@ -1506,11 +1506,11 @@
folder_id=folder_id,
id=id,
show_deleted=show_deleted,
- msg=msg,
- messagetype='done' ) )
+ message=message,
+ status='done' ) )
else:
- msg = "Select a form on which to base the template."
- messagetype = "error"
+ message = "Select a form on which to base the template."
+ status = "error"
def generate_template_stuff( trans, forms, form_id ):
# Returns the following:
# - a list of template ids
@@ -1555,22 +1555,22 @@
template_select_list=template_select_list,
inheritable_checked=inheritable,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def manage_template_inheritance( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, **kwd ):
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id )
info_association, inherited = item.get_info_association( restrict=True )
if info_association:
if info_association.inheritable:
- msg = "The template for this %s will no longer be inherited to contained folders and datasets." % item_desc
+ message = "The template for this %s will no longer be inherited to contained folders and datasets." % item_desc
else:
- msg = "The template for this %s will now be inherited to contained folders and datasets." % item_desc
+ message = "The template for this %s will now be inherited to contained folders and datasets." % item_desc
info_association.inheritable = not( info_association.inheritable )
trans.sa_session.add( info_association )
trans.sa_session.flush()
@@ -1582,16 +1582,16 @@
folder_id=folder_id,
id=id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
@web.expose
def edit_template( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, edited=False, **kwd ):
# Edit the template itself, keeping existing field contents, if any.
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id )
# An info_association must exist at this point
info_association, inherited = item.get_info_association( restrict=True )
@@ -1605,7 +1605,7 @@
info_association.template = fdc.latest_form
trans.sa_session.add( info_association )
trans.sa_session.flush()
- msg = "The template for this %s has been updated with your changes." % item_desc
+ message = "The template for this %s has been updated with your changes." % item_desc
return trans.response.send_redirect( web.url_for( controller='library_common',
action=action,
cntrller=cntrller,
@@ -1614,8 +1614,8 @@
folder_id=folder_id,
id=id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
# "template" is a FormDefinition, so since we're changing it, we need to use the latest version of it.
vars = dict( id=trans.security.encode_id( template.form_definition_current_id ),
response_redirect=web.url_for( controller='library_common',
@@ -1634,8 +1634,8 @@
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id )
# Save updated template field contents
field_contents = []
@@ -1681,7 +1681,7 @@
info_association = trans.app.model.LibraryDatasetDatasetInfoAssociation( item, template, form_values )
trans.sa_session.add( info_association )
trans.sa_session.flush()
- msg = 'The information has been updated.'
+ message = 'The information has been updated.'
return trans.response.send_redirect( web.url_for( controller='library_common',
action=action,
cntrller=cntrller,
@@ -1690,8 +1690,8 @@
folder_id=folder_id,
id=id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
@web.expose
def delete_template( self, trans, cntrller, item_type, library_id, id=None, folder_id=None, ldda_id=None, **kwd ):
# Only adding a new template to a library or folder is currently allowed. Editing an existing template is
@@ -1699,19 +1699,19 @@
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id )
info_association, inherited = item.get_info_association()
if not info_association:
- msg = "There is no template for this %s" % item_type
- messagetype = 'error'
+ message = "There is no template for this %s" % item_type
+ status = 'error'
else:
info_association.deleted = True
trans.sa_session.add( info_association )
trans.sa_session.flush()
- msg = 'The template for this %s has been deleted.' % item_type
- messagetype = 'done'
+ message = 'The template for this %s has been deleted.' % item_type
+ status = 'done'
return trans.response.send_redirect( web.url_for( controller='library_common',
action=action,
cntrller=cntrller,
@@ -1720,8 +1720,8 @@
folder_id=folder_id,
id=id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
# ---- Utility methods -------------------------------------------------------
diff -r fabf48e747ae -r 7bdc5202c67e lib/galaxy/web/controllers/requests.py
--- a/lib/galaxy/web/controllers/requests.py Mon Apr 05 14:14:09 2010 -0400
+++ b/lib/galaxy/web/controllers/requests.py Mon Apr 05 14:15:19 2010 -0400
@@ -164,7 +164,7 @@
elif operation == "events":
return self.__request_events( trans, **kwd )
# if there are one or more requests that has been rejected by the admin
- # recently, then show a msg as a reminder to the user
+ # recently, then show a message as a reminder to the user
rlist = trans.sa_session.query( trans.app.model.Request ) \
.filter( trans.app.model.Request.table.c.deleted==False ) \
.filter( trans.app.model.Request.table.c.user_id==trans.user.id )
@@ -182,12 +182,12 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
events_list = []
all_events = request.events
@@ -238,8 +238,8 @@
return request_details
def __show_request(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
add_sample = params.get('add_sample', False)
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
@@ -279,7 +279,7 @@
current_samples=current_samples,
sample_copy=self.__copy_sample(current_samples),
details='hide', edit_mode=util.restore_text( params.get( 'edit_mode', 'False' ) ),
- msg=msg, messagetype=messagetype )
+ message=message, status=status )
def __library_widgets(self, trans, user, sample_index, libraries, sample=None, **kwd):
'''
This method creates the data library & folder selectbox for creating &
@@ -424,8 +424,8 @@
@web.require_login( "create/submit sequencing requests" )
def show_request(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', None ) ) )
except:
@@ -503,28 +503,28 @@
edit_mode=edit_mode)
elif params.get('save_samples_button', False) == 'Save':
# check for duplicate sample names
- msg = ''
+ message = ''
for index in range(len(current_samples)-len(request.samples)):
sample_index = index + len(request.samples)
sample_name = current_samples[sample_index]['name']
if not sample_name.strip():
- msg = 'Please enter the name of sample number %i' % sample_index
+ message = 'Please enter the name of sample number %i' % sample_index
break
count = 0
for i in range(len(current_samples)):
if sample_name == current_samples[i]['name']:
count = count + 1
if count > 1:
- msg = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name)
+ message = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name)
break
- if msg:
+ if message:
return trans.fill_template( '/requests/show_request.mako',
request=request,
request_details=self.request_details(trans, request.id),
current_samples = current_samples,
sample_copy=self.__copy_sample(current_samples),
details=details, edit_mode=edit_mode,
- messagetype='error', msg=msg)
+ status='error', message=message)
# save all the new/unsaved samples entered by the user
if edit_mode == 'False':
for index in range(len(current_samples)-len(request.samples)):
@@ -542,18 +542,18 @@
trans.sa_session.add( s )
trans.sa_session.flush()
else:
- messagetype = 'done'
- msg = 'Changes made to the sample(s) are saved. '
+ status = 'done'
+ message = 'Changes made to the sample(s) are saved. '
for sample_index in range(len(current_samples)):
sample = request.samples[sample_index]
sample.name = current_samples[sample_index]['name']
sample.library = current_samples[sample_index]['library']
sample.folder = current_samples[sample_index]['folder']
if request.submitted():
- bc_msg = self.__validate_barcode(trans, sample, current_samples[sample_index]['barcode'])
- if bc_msg:
- messagetype = 'error'
- msg += bc_msg
+ bc_message = self.__validate_barcode(trans, sample, current_samples[sample_index]['barcode'])
+ if bc_message:
+ status = 'error'
+ message += bc_message
else:
sample.bar_code = current_samples[sample_index]['barcode']
trans.sa_session.add( sample )
@@ -566,8 +566,8 @@
action='list',
operation='show_request',
id=trans.security.encode_id(request.id),
- messagetype=messagetype,
- msg=msg ))
+ status=status,
+ message=message ))
elif params.get('edit_samples_button', False) == 'Edit samples':
edit_mode = 'True'
return trans.fill_template( '/requests/show_request.mako',
@@ -589,15 +589,15 @@
current_samples=current_samples,
sample_copy=self.__copy_sample(current_samples),
details=details, libraries=libraries,
- edit_mode=edit_mode, messagetype=messagetype, msg=msg)
+ edit_mode=edit_mode, status=status, message=message)
@web.expose
@web.require_login( "create/submit sequencing requests" )
def delete_sample(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', 0 ) ) )
current_samples, details, edit_mode = self.__update_samples( request, **kwd )
sample_index = int(params.get('sample_id', 0))
@@ -639,34 +639,34 @@
@web.require_login( "create/submit sequencing requests" )
def new(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
if params.get('select_request_type', False) == 'True':
return trans.fill_template( '/requests/new_request.mako',
select_request_type=self.__select_request_type(trans, 'none'),
widgets=[],
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
elif params.get('create', False) == 'True':
if params.get('create_request_button', False) == 'Save' \
or params.get('create_request_samples_button', False) == 'Add samples':
request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) )
if not util.restore_text(params.get('name', '')):
- msg = 'Please enter the <b>Name</b> of the request'
+ message = 'Please enter the <b>Name</b> of the request'
kwd['create'] = 'True'
- kwd['messagetype'] = 'error'
- kwd['msg'] = msg
+ kwd['status'] = 'error'
+ kwd['message'] = message
kwd['create_request_button'] = None
kwd['create_request_samples_button'] = None
return trans.response.send_redirect( web.url_for( controller='requests',
action='new',
**kwd) )
request = self.__save_request(trans, None, **kwd)
- msg = 'The new request named <b>%s</b> has been created' % request.name
+ message = 'The new request named <b>%s</b> has been created' % request.name
if params.get('create_request_button', False) == 'Save':
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
- message=msg ,
+ message=message ,
status='done') )
elif params.get('create_request_samples_button', False) == 'Add samples':
new_kwd = {}
@@ -675,8 +675,8 @@
new_kwd['add_sample'] = True
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
- msg=msg ,
- messagetype='done',
+ message=message ,
+ status='done',
**new_kwd) )
else:
return self.__show_request_form(trans, **kwd)
@@ -684,16 +684,16 @@
return self.__show_request_form(trans, **kwd)
def __show_request_form(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) )
except:
return trans.fill_template( '/requests/new_request.mako',
select_request_type=self.__select_request_type(trans, 'none'),
widgets=[],
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
form_values = None
select_request_type = self.__select_request_type(trans, request_type.id)
# list of widgets to be rendered on the request form
@@ -711,8 +711,8 @@
select_request_type=select_request_type,
request_type=request_type,
widgets=widgets,
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
def __validate(self, trans, request):
'''
Validates the request entered by the user
@@ -723,14 +723,14 @@
if field['required'] == 'required' and request.values.content[index] in ['', None]:
empty_fields.append(field['label'])
if empty_fields:
- msg = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
+ message = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
for ef in empty_fields:
- msg = msg + '<b>' +ef + '</b><br/>'
+ message = message + '<b>' +ef + '</b><br/>'
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
operation='edit',
- messagetype = 'error',
- msg=msg,
+ status = 'error',
+ message=message,
id=trans.security.encode_id(request.id) ))
# now check the required fields of all the samples of this request
for s in request.samples:
@@ -738,14 +738,14 @@
if field['required'] == 'required' and s.values.content[index] in ['', None]:
empty_fields.append((s.name, field['label']))
if empty_fields:
- msg = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
+ message = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
for sname, ef in empty_fields:
- msg = msg + '<b>%s</b> field of sample <b>%s</b><br/>' % (ef, sname)
+ message = message + '<b>%s</b> field of sample <b>%s</b><br/>' % (ef, sname)
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
operation='show_request',
- messagetype = 'error',
- msg=msg,
+ status = 'error',
+ message=message,
id=trans.security.encode_id(request.id) ))
def __save_request(self, trans, request=None, **kwd):
'''
@@ -823,8 +823,8 @@
@web.require_login( "create/submit sequencing requests" )
def edit(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', None ) ) )
except:
@@ -839,19 +839,19 @@
or params.get('edit_samples_button', False) == 'Edit samples':
request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) )
if not util.restore_text(params.get('name', '')):
- msg = 'Please enter the <b>Name</b> of the request'
- kwd['messagetype'] = 'error'
- kwd['msg'] = msg
+ message = 'Please enter the <b>Name</b> of the request'
+ kwd['status'] = 'error'
+ kwd['message'] = message
kwd['show'] = 'True'
return trans.response.send_redirect( web.url_for( controller='requests',
action='edit',
**kwd) )
request = self.__save_request(trans, request, **kwd)
- msg = 'The changes made to the request named %s has been saved' % request.name
+ message = 'The changes made to the request named %s has been saved' % request.name
if params.get('save_changes_request_button', False) == 'Save changes':
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
- message=msg ,
+ message=message ,
status='done') )
elif params.get('edit_samples_button', False) == 'Edit samples':
new_kwd = {}
@@ -859,8 +859,8 @@
new_kwd['edit_samples_button'] = 'Edit samples'
return trans.response.send_redirect( web.url_for( controller='requests',
action='show_request',
- msg=msg ,
- messagetype='done',
+ message=message ,
+ status='done',
**new_kwd) )
elif params.get('refresh', False) == 'true':
return self.__edit_request(trans, id=trans.security.encode_id(request.id), **kwd)
@@ -869,15 +869,15 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg) )
+ message=message) )
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
select_request_type = self.__select_request_type(trans, request.type.id)
# list of widgets to be rendered on the request form
widgets = []
@@ -901,8 +901,8 @@
request_type=request.type,
request=request,
widgets=widgets,
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
return self.__show_request_form(trans)
def __delete_request(self, trans, **kwd):
id_list = util.listify( kwd['id'] )
@@ -911,12 +911,12 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
# a request cannot be deleted once its submitted
if not request.new():
@@ -926,28 +926,28 @@
trans.sa_session.add( request )
trans.sa_session.flush()
if not len(delete_failed):
- msg = '%i request(s) has been deleted.' % len(id_list)
+ message = '%i request(s) has been deleted.' % len(id_list)
status = 'done'
else:
- msg = '%i request(s) has been deleted. %i request %s could not be deleted as they have been submitted.' % (len(id_list)-len(delete_failed),
+ message = '%i request(s) has been deleted. %i request %s could not be deleted as they have been submitted.' % (len(id_list)-len(delete_failed),
len(delete_failed), str(delete_failed))
status = 'warning'
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status=status,
- message=msg) )
+ message=message) )
def __undelete_request(self, trans, **kwd):
id_list = util.listify( kwd['id'] )
for id in id_list:
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
request.deleted = False
trans.sa_session.add( request )
@@ -960,12 +960,12 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
# check if all the required request and its sample fields have been filled
self.__validate(trans, request)
@@ -994,11 +994,11 @@
sample_id = int(params.get('sample_id', False))
sample = trans.sa_session.query( trans.app.model.Sample ).get( sample_id )
except:
- msg = "Invalid sample ID"
+ message = "Invalid sample ID"
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
events_list = []
all_events = sample.events
@@ -1015,8 +1015,8 @@
@web.require_login( "create/submit sequencing requests" )
def show_datatx_page( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
sample = trans.sa_session.query( trans.app.model.Sample ).get( trans.security.decode_id( kwd['sample_id'] ) )
except:
diff -r fabf48e747ae -r 7bdc5202c67e lib/galaxy/web/controllers/requests_admin.py
--- a/lib/galaxy/web/controllers/requests_admin.py Mon Apr 05 14:14:09 2010 -0400
+++ b/lib/galaxy/web/controllers/requests_admin.py Mon Apr 05 14:15:19 2010 -0400
@@ -289,8 +289,8 @@
@web.require_admin
def edit(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', None ) ) )
except:
@@ -305,19 +305,19 @@
or params.get('edit_samples_button', False) == 'Edit samples':
request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) )
if not util.restore_text(params.get('name', '')):
- msg = 'Please enter the <b>Name</b> of the request'
- kwd['messagetype'] = 'error'
- kwd['msg'] = msg
+ message = 'Please enter the <b>Name</b> of the request'
+ kwd['status'] = 'error'
+ kwd['message'] = message
kwd['show'] = 'True'
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='edit',
**kwd) )
request = self.__save_request(trans, request, **kwd)
- msg = 'The changes made to the request named %s has been saved' % request.name
+ message = 'The changes made to the request named %s has been saved' % request.name
if params.get('save_changes_request_button', False) == 'Save changes':
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
- message=msg ,
+ message=message ,
status='done') )
elif params.get('edit_samples_button', False) == 'Edit samples':
new_kwd = {}
@@ -325,8 +325,8 @@
new_kwd['edit_samples_button'] = 'Edit samples'
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='show_request',
- msg=msg ,
- messagetype='done',
+ message=message ,
+ status='done',
**new_kwd) )
elif params.get('refresh', False) == 'true':
return self.__edit_request(trans, id=trans.security.encode_id(request.id), **kwd)
@@ -335,15 +335,15 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg) )
+ message=message) )
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
select_request_type = self.__select_request_type(trans, request.type.id)
# list of widgets to be rendered on the request form
widgets = []
@@ -367,8 +367,8 @@
request_type=request.type,
request=request,
widgets=widgets,
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
return self.__show_request_form(trans)
def __delete_request(self, trans, **kwd):
id_list = util.listify( kwd['id'] )
@@ -376,34 +376,34 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
request.deleted = True
trans.sa_session.add( request )
trans.sa_session.flush()
- msg = '%i request(s) has been deleted.' % len(id_list)
+ message = '%i request(s) has been deleted.' % len(id_list)
status = 'done'
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status=status,
- message=msg) )
+ message=message) )
def __undelete_request(self, trans, **kwd):
id_list = util.listify( kwd['id'] )
for id in id_list:
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
request.deleted = False
trans.sa_session.add( request )
@@ -416,20 +416,20 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
- msg = self.__validate(trans, request)
- if msg:
+ message = self.__validate(trans, request)
+ if message:
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
operation='edit',
- messagetype = 'error',
- msg=msg,
+ status = 'error',
+ message=message,
id=trans.security.encode_id(request.id) ) )
# change the request state to 'Submitted'
if request.user.email is not trans.user:
@@ -456,12 +456,12 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
return trans.fill_template( '/admin/requests/reject.mako',
request=request)
@@ -477,18 +477,18 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
# validate
if not params.get('comment', ''):
return trans.fill_template( '/admin/requests/reject.mako',
- request=request, messagetype='error',
- msg='A comment is required for rejecting a request.')
+ request=request, status='error',
+ message='A comment is required for rejecting a request.')
# create an event with state 'Rejected' for this request
comments = util.restore_text( params.comment )
event = trans.app.model.RequestEvent(request, request.states.REJECTED, comments)
@@ -503,12 +503,12 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
events_list = []
all_events = request.events
@@ -547,35 +547,35 @@
@web.require_admin
def new(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
if params.get('select_request_type', False) == 'True':
return trans.fill_template( '/admin/requests/new_request.mako',
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/fabf48e747ae
changeset: 3611:fabf48e747ae
user: fubar: ross Lazarus at gmail period com
date: Mon Apr 05 14:14:09 2010 -0400
description:
Fixes to rgQC top table ordering and add offset so can use rgManQQ to make plots
Fixes to rgManQQ to handle unsorted data - now sorts before manhattan plot
diffstat:
test-data/rgtestouts/rgQC/FQNormtinywga_s_het_cum.pdf | 4 +-
test-data/rgtestouts/rgQC/MarkerDetails_rgQCtest1.xls | 27 ++-
test-data/rgtestouts/rgQC/ldp_tinywga.log | 4 +-
test-data/rgtestouts/rgQC/rgQCtest1.html | 104 +++++--
test-data/rgtestouts/rgQC/tinywga.log | 4 +-
test-data/rgtestouts/rgQC/tinywga_All_3x3.pdf | 0
test-data/rgtestouts/rgQC/tinywga_All_Paged-0.jpg | 0
test-data/rgtestouts/rgQC/tinywga_All_Paged-1.jpg | 0
test-data/rgtestouts/rgQC/tinywga_All_Paged-2.jpg | 0
test-data/rgtestouts/rgQC/tinywga_All_Paged-3.jpg | 0
test-data/rgtestouts/rgQC/tinywga_All_Paged-4.jpg | 0
test-data/rgtestouts/rgQC/tinywga_All_Paged.pdf | 0
test-data/rgtestouts/rgQC/tinywga_fracmiss.pdf | 4 +-
test-data/rgtestouts/rgQC/tinywga_fracmiss_cum.pdf | 4 +-
test-data/rgtestouts/rgQC/tinywga_s_het.pdf | 4 +-
test-data/rgtestouts/rgQC/tinywga_s_het_cum.pdf | 4 +-
tools/data_source/upload.py | 8 +-
tools/rgenetics/rgManQQ.py | 9 +-
tools/rgenetics/rgQC.py | 58 +---
tools/rgenetics/rgtest_one_tool.sh | 218 ++++++++++++++++++
20 files changed, 361 insertions(+), 91 deletions(-)
diffs (793 lines):
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/FQNormtinywga_s_het_cum.pdf
--- a/test-data/rgtestouts/rgQC/FQNormtinywga_s_het_cum.pdf Sun Apr 04 19:41:07 2010 -0400
+++ b/test-data/rgtestouts/rgQC/FQNormtinywga_s_het_cum.pdf Mon Apr 05 14:14:09 2010 -0400
@@ -2,8 +2,8 @@
%âãÏÓ\r
1 0 obj
<<
-/CreationDate (D:20100325210120)
-/ModDate (D:20100325210120)
+/CreationDate (D:20100405140521)
+/ModDate (D:20100405140521)
/Title (R Graphics Output)
/Producer (R 2.10.1)
/Creator (R)
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/MarkerDetails_rgQCtest1.xls
--- a/test-data/rgtestouts/rgQC/MarkerDetails_rgQCtest1.xls Sun Apr 04 19:41:07 2010 -0400
+++ b/test-data/rgtestouts/rgQC/MarkerDetails_rgQCtest1.xls Mon Apr 05 14:14:09 2010 -0400
@@ -1,1 +1,26 @@
-snp chrom maf a1 a2 missfrac p_hwe_all logp_hwe_all p_hwe_unaff logp_hwe_unaff N_Mendel
\ No newline at end of file
+snp chromosome offset maf a1 a2 missfrac p_hwe_all logp_hwe_all p_hwe_unaff logp_hwe_unaff N_Mendel
+rs2283802 22 21784722 0.2593 4 2 0 0.638 0.195179 0.638 0.195179 0
+rs2267000 22 21785366 0.4259 4 2 0 1 0 1 0 0
+rs16997606 22 21794754 0.1111 1 3 0 1 0 1 0 0
+rs4820537 22 21794810 0.4444 1 3 0 0.6985 0.155834 0.6985 0.155834 0
+rs3788347 22 21797804 0.463 3 1 0 1 0 1 0 0
+rs756632 22 21799918 0.09259 4 2 0 1 0 1 0 0
+rs4820539 22 21807970 0.2778 1 3 0 0.6298 0.200797 0.6298 0.200797 0
+rs2283804 22 21820335 0.3333 1 2 0 1 0 1 0 0
+rs2267006 22 21820990 0.3333 3 1 0 1 0 1 0 0
+rs4822363 22 21821000 0.07407 4 2 0 1 0 1 0 0
+rs5751592 22 21827674 0.1667 4 2 0 1 0 1 0 0
+rs5759608 22 21832708 0.4259 2 4 0 1 0 1 0 0
+rs5759612 22 21833170 0.4259 3 1 0 1 0 1 0 0
+rs2267009 22 21860168 0.2593 3 4 0 0.638 0.195179 0.638 0.195179 0
+rs2267010 22 21864366 0.03704 3 1 0 1 0 1 0 0
+rs5759636 22 21868698 0.07407 4 2 0.025 1 0 1 0 0
+rs2071436 22 21871488 0.2593 4 2 0 0.638 0.195179 0.638 0.195179 0
+rs2267013 22 21875879 0.1111 3 1 0 1 0 1 0 0
+rs6003566 22 21889806 0.09259 3 1 0 1 0 1 0 0
+rs2256725 22 21892891 0.1111 2 1 0 1 0 1 0 0
+rs12160770 22 21892925 0.01923 1 3 0.075 1 0 1 0 0
+rs5751611 22 21896019 0.4615 2 4 0.025 0.4275 0.369064 0.4275 0.369064 0
+rs762601 22 21898858 0.3333 1 3 0 0.6657 0.176721 0.6657 0.176721 0
+rs2156921 22 21899063 0.3333 3 1 0 0.6657 0.176721 0.6657 0.176721 0
+rs4822375 22 21905642 0.3333 1 3 0 0.6657 0.176721 0.6657 0.176721 0
\ No newline at end of file
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/ldp_tinywga.log
--- a/test-data/rgtestouts/rgQC/ldp_tinywga.log Sun Apr 04 19:41:07 2010 -0400
+++ b/test-data/rgtestouts/rgQC/ldp_tinywga.log Mon Apr 05 14:14:09 2010 -0400
@@ -10,7 +10,7 @@
Skipping web check... [ --noweb ]
Writing this text to log file [ ldp_tinywga.log ]
-Analysis started: Thu Mar 25 21:01:19 2010
+Analysis started: Mon Apr 5 14:05:21 2010
Options in effect:
--noweb
@@ -44,5 +44,5 @@
Writing genotype bitfile to [ ldp_tinywga.bed ]
Using (default) SNP-major mode
-Analysis finished: Thu Mar 25 21:01:19 2010
+Analysis finished: Mon Apr 5 14:05:21 2010
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/rgQCtest1.html
--- a/test-data/rgtestouts/rgQC/rgQCtest1.html Sun Apr 04 19:41:07 2010 -0400
+++ b/test-data/rgtestouts/rgQC/rgQCtest1.html Mon Apr 05 14:14:09 2010 -0400
@@ -10,20 +10,34 @@
<body>
<div class="document">
<h4>
-<div>Output from Rgenetics QC report tool run at 25/03/2010 21:01:23<br>
+<div>Output from Rgenetics QC report tool run at 05/04/2010 14:05:29<br>
</h4>
</div><div><h4>(Click any preview image to download a full sized PDF version)</h4><br><ol>
<table cellpadding="5" border="0">
-<tr><td colspan="3"><a href="MarkerDetails_rgQCtest1.xls" type="application/vnd.ms-excel">Click here to download the Marker QC Detail report file</a> (87 B) tab delimited</td></tr>
+<tr><td colspan="3"><a href="MarkerDetails_rgQCtest1.xls" type="application/vnd.ms-excel">Click here to download the Marker QC Detail report file</a> (1.4 KB) tab delimited</td></tr>
<tr><td colspan="3"><a href="SubjectDetails_rgQCtest1.xls" type="application/vnd.ms-excel">Click here to download the Subject QC Detail report file</a> (1.4 KB) tab delimited</td></tr>
<tr><td><a href="tinywga_All_Paged.pdf"><img src="tinywga_All_Paged-0.jpg" alt="All tinywga QC Plots joined into a single pdf" hspace="10" align="middle">
</a></td><td>All tinywga QC Plots joined into a single pdf</td><td> </td></tr>
-<tr><td><a href="tinywga_All_3x3.pdf"><img src="tinywga_All_3x3.jpg" alt="All tinywga QC Plots 3 by 3 to a page" hspace="10" align="middle">
+<tr><td><a href="tinywga_All_3x3.pdf"><img src="tinywga_All_3x3-0.jpg" alt="All tinywga QC Plots 3 by 3 to a page" hspace="10" align="middle">
</a></td><td>All tinywga QC Plots 3 by 3 to a page</td><td> </td></tr>
+<tr><td><a href="tinywga_logphweunaff.pdf"><img src="tinywga_logphweunaff.jpg" alt="Marker HWE" hspace="10" align="middle">
+</a></td><td>Marker HWE</td><td><a href="Ranked_Marker_HWE.xls">Worst data</a></td></tr>
+<tr><td><a href="tinywga_logphweunaff_cum.pdf"><img src="tinywga_logphweunaff_cum.jpg" alt="Ranked Marker HWE" hspace="10" align="middle">
+</a></td><td>Ranked Marker HWE</td><td> </td></tr>
+<tr><td><a href="QQtinywga_logphweunaff_cum.pdf"><img src="QQtinywga_logphweunaff_cum.jpg" alt="LogQQ plot Marker HWE" hspace="10" align="middle">
+</a></td><td>LogQQ plot Marker HWE</td><td> </td></tr>
+<tr><td><a href="tinywga_missfrac.pdf"><img src="tinywga_missfrac.jpg" alt="Marker Missing Genotype" hspace="10" align="middle">
+</a></td><td>Marker Missing Genotype</td><td><a href="Ranked_Marker_Missing_Genotype.xls">Worst data</a></td></tr>
+<tr><td><a href="tinywga_missfrac_cum.pdf"><img src="tinywga_missfrac_cum.jpg" alt="Ranked Marker Missing Genotype" hspace="10" align="middle">
+</a></td><td>Ranked Marker Missing Genotype</td><td> </td></tr>
+<tr><td><a href="tinywga_maf.pdf"><img src="tinywga_maf.jpg" alt="Marker MAF" hspace="10" align="middle">
+</a></td><td>Marker MAF</td><td><a href="Ranked_Marker_MAF.xls">Worst data</a></td></tr>
+<tr><td><a href="tinywga_maf_cum.pdf"><img src="tinywga_maf_cum.jpg" alt="Ranked Marker MAF" hspace="10" align="middle">
+</a></td><td>Ranked Marker MAF</td><td> </td></tr>
<tr><td><a href="tinywga_fracmiss.pdf"><img src="tinywga_fracmiss.jpg" alt="Subject Missing Genotype" hspace="10" align="middle">
-</a></td><td>Subject Missing Genotype</td><td> </td></tr>
+</a></td><td>Subject Missing Genotype</td><td><a href="Ranked_Subject_Missing_Genotype.xls">Worst data</a></td></tr>
<tr><td><a href="tinywga_fracmiss_cum.pdf"><img src="tinywga_fracmiss_cum.jpg" alt="Ranked Subject Missing Genotype" hspace="10" align="middle">
-</a></td><td>Ranked Subject Missing Genotype</td><td><a href="Ranked_Subject_Missing_Genotype.xls">Worst data</a></td></tr>
+</a></td><td>Ranked Subject Missing Genotype</td><td> </td></tr>
<tr><td><a href="tinywga_s_het.pdf"><img src="tinywga_s_het.jpg" alt="Subject F Statistic" hspace="10" align="middle">
</a></td><td>Subject F Statistic</td><td> </td></tr>
<tr><td><a href="tinywga_s_het_cum.pdf"><img src="tinywga_s_het_cum.jpg" alt="Ranked Subject F Statistic" hspace="10" align="middle">
@@ -35,7 +49,12 @@
<tr><td><a href="FQNormtinywga_s_het_cum.jpg">FQNormtinywga_s_het_cum.jpg</a> (30.2 KB)</td></tr>
<tr><td><a href="FQNormtinywga_s_het_cum.pdf">FQNormtinywga_s_het_cum.pdf</a> (7.1 KB)</td></tr>
-<tr><td><a href="MarkerDetails_rgQCtest1.xls">MarkerDetails_rgQCtest1.xls</a> (87 B)</td></tr>
+<tr><td><a href="MarkerDetails_rgQCtest1.xls">MarkerDetails_rgQCtest1.xls</a> (1.4 KB)</td></tr>
+<tr><td><a href="QQtinywga_logphweunaff_cum.jpg">QQtinywga_logphweunaff_cum.jpg</a> (33.0 KB)</td></tr>
+<tr><td><a href="QQtinywga_logphweunaff_cum.pdf">QQtinywga_logphweunaff_cum.pdf</a> (6.6 KB)</td></tr>
+<tr><td><a href="Ranked_Marker_HWE.xls">Ranked_Marker_HWE.xls</a> (763 B)</td></tr>
+<tr><td><a href="Ranked_Marker_MAF.xls">Ranked_Marker_MAF.xls</a> (564 B)</td></tr>
+<tr><td><a href="Ranked_Marker_Missing_Genotype.xls">Ranked_Marker_Missing_Genotype.xls</a> (659 B)</td></tr>
<tr><td><a href="Ranked_Subject_Missing_Genotype.xls">Ranked_Subject_Missing_Genotype.xls</a> (804 B)</td></tr>
<tr><td><a href="SubjectDetails_rgQCtest1.xls">SubjectDetails_rgQCtest1.xls</a> (1.4 KB)</td></tr>
<tr><td><a href="ldp_tinywga.bed">ldp_tinywga.bed</a> (143 B)</td></tr>
@@ -55,28 +74,47 @@
<tr><td><a href="tinywga.prune.in">tinywga.prune.in</a> (140 B)</td></tr>
<tr><td><a href="tinywga.prune.out">tinywga.prune.out</a> (110 B)</td></tr>
<tr><td><a href="tinywga.sexcheck">tinywga.sexcheck</a> (2.5 KB)</td></tr>
-<tr><td><a href="tinywga_All_3x3.jpg">tinywga_All_3x3.jpg</a> (27.6 KB)</td></tr>
-<tr><td><a href="tinywga_All_3x3.pdf">tinywga_All_3x3.pdf</a> (37.4 KB)</td></tr>
-<tr><td><a href="tinywga_All_Paged-0.jpg">tinywga_All_Paged-0.jpg</a> (11.9 KB)</td></tr>
-<tr><td><a href="tinywga_All_Paged-1.jpg">tinywga_All_Paged-1.jpg</a> (29.6 KB)</td></tr>
-<tr><td><a href="tinywga_All_Paged-2.jpg">tinywga_All_Paged-2.jpg</a> (17.9 KB)</td></tr>
-<tr><td><a href="tinywga_All_Paged-3.jpg">tinywga_All_Paged-3.jpg</a> (31.4 KB)</td></tr>
-<tr><td><a href="tinywga_All_Paged-4.jpg">tinywga_All_Paged-4.jpg</a> (29.8 KB)</td></tr>
-<tr><td><a href="tinywga_All_Paged.pdf">tinywga_All_Paged.pdf</a> (36.9 KB)</td></tr>
+<tr><td><a href="tinywga_All_3x3-0.jpg">tinywga_All_3x3-0.jpg</a> (45.2 KB)</td></tr>
+<tr><td><a href="tinywga_All_3x3-1.jpg">tinywga_All_3x3-1.jpg</a> (19.3 KB)</td></tr>
+<tr><td><a href="tinywga_All_3x3.pdf">tinywga_All_3x3.pdf</a> (82.4 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-0.jpg">tinywga_All_Paged-0.jpg</a> (13.6 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-1.jpg">tinywga_All_Paged-1.jpg</a> (26.3 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-10.jpg">tinywga_All_Paged-10.jpg</a> (31.4 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-11.jpg">tinywga_All_Paged-11.jpg</a> (29.8 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-2.jpg">tinywga_All_Paged-2.jpg</a> (32.3 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-3.jpg">tinywga_All_Paged-3.jpg</a> (11.1 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-4.jpg">tinywga_All_Paged-4.jpg</a> (26.7 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-5.jpg">tinywga_All_Paged-5.jpg</a> (18.4 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-6.jpg">tinywga_All_Paged-6.jpg</a> (28.1 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-7.jpg">tinywga_All_Paged-7.jpg</a> (11.9 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-8.jpg">tinywga_All_Paged-8.jpg</a> (29.6 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged-9.jpg">tinywga_All_Paged-9.jpg</a> (17.9 KB)</td></tr>
+<tr><td><a href="tinywga_All_Paged.pdf">tinywga_All_Paged.pdf</a> (81.9 KB)</td></tr>
<tr><td><a href="tinywga_fracmiss.jpg">tinywga_fracmiss.jpg</a> (12.0 KB)</td></tr>
<tr><td><a href="tinywga_fracmiss.pdf">tinywga_fracmiss.pdf</a> (6.4 KB)</td></tr>
<tr><td><a href="tinywga_fracmiss_cum.jpg">tinywga_fracmiss_cum.jpg</a> (30.0 KB)</td></tr>
<tr><td><a href="tinywga_fracmiss_cum.pdf">tinywga_fracmiss_cum.pdf</a> (7.0 KB)</td></tr>
+<tr><td><a href="tinywga_logphweunaff.jpg">tinywga_logphweunaff.jpg</a> (13.6 KB)</td></tr>
+<tr><td><a href="tinywga_logphweunaff.pdf">tinywga_logphweunaff.pdf</a> (5.7 KB)</td></tr>
+<tr><td><a href="tinywga_logphweunaff_cum.jpg">tinywga_logphweunaff_cum.jpg</a> (26.8 KB)</td></tr>
+<tr><td><a href="tinywga_logphweunaff_cum.pdf">tinywga_logphweunaff_cum.pdf</a> (5.8 KB)</td></tr>
+<tr><td><a href="tinywga_maf.jpg">tinywga_maf.jpg</a> (18.5 KB)</td></tr>
+<tr><td><a href="tinywga_maf.pdf">tinywga_maf.pdf</a> (6.4 KB)</td></tr>
+<tr><td><a href="tinywga_maf_cum.jpg">tinywga_maf_cum.jpg</a> (28.5 KB)</td></tr>
+<tr><td><a href="tinywga_maf_cum.pdf">tinywga_maf_cum.pdf</a> (6.0 KB)</td></tr>
+<tr><td><a href="tinywga_missfrac.jpg">tinywga_missfrac.jpg</a> (11.1 KB)</td></tr>
+<tr><td><a href="tinywga_missfrac.pdf">tinywga_missfrac.pdf</a> (5.9 KB)</td></tr>
+<tr><td><a href="tinywga_missfrac_cum.jpg">tinywga_missfrac_cum.jpg</a> (27.3 KB)</td></tr>
+<tr><td><a href="tinywga_missfrac_cum.pdf">tinywga_missfrac_cum.pdf</a> (5.9 KB)</td></tr>
<tr><td><a href="tinywga_s_het.jpg">tinywga_s_het.jpg</a> (18.0 KB)</td></tr>
<tr><td><a href="tinywga_s_het.pdf">tinywga_s_het.pdf</a> (6.8 KB)</td></tr>
<tr><td><a href="tinywga_s_het_cum.jpg">tinywga_s_het_cum.jpg</a> (31.9 KB)</td></tr>
<tr><td><a href="tinywga_s_het_cum.pdf">tinywga_s_het_cum.pdf</a> (7.3 KB)</td></tr>
-</table><h4>QC run log contents</h4><pre>## subject reports starting at 25/03/2010 21:01:19
+</table><h4>QC run log contents</h4><pre>## subject reports starting at 05/04/2010 14:05:21
## imissfile /opt/galaxy/test-data/rgtestouts/rgQC/tinywga.imiss contained 40 ids
-### writing /opt/galaxy/test-data/rgtestouts/rgQC/SubjectDetails_rgQCtest1.xls report with ['famId', 'iId', 'FracMiss', 'Mendel_errors', 'Ped_sex', 'SNP_sex', 'Status', 'XHomEst', 'F_Stat']## marker reports starting at 25/03/2010 21:01:19
-## error - no hwefile /opt/galaxy/test-data/rgtestouts/rgQC.hwe found
-No /opt/galaxy/test-data/rgtestouts/rgQC.lmendel file - assuming not family data
-## starting plotpage, newfpath=/opt/galaxy/test-data/rgtestouts/rgQC,m=[['snp', 'chrom', 'maf', 'a1', 'a2', 'missfrac', 'p_hwe_all', 'logp_hwe_all', 'p_hwe_unaff', 'logp_hwe_unaff', 'N_Mendel']],s=[['famId', 'iId', 'FracMiss', 'Mendel_errors', 'Ped_sex', 'SNP_sex', 'Status', 'XHomEst', 'F_Stat'], ['101', '1', '0.04', '0', '2', '0', 'PROBLEM', 'nan', '-0.03355']]/n## Rgenetics: http://rgenetics.org Galaxy Tools rgQC.py Plink runner
+### writing /opt/galaxy/test-data/rgtestouts/rgQC/SubjectDetails_rgQCtest1.xls report with ['famId', 'iId', 'FracMiss', 'Mendel_errors', 'Ped_sex', 'SNP_sex', 'Status', 'XHomEst', 'F_Stat']## marker reports starting at 05/04/2010 14:05:21
+hwe header testpos=2,ppos=8,snppos=1
+## starting plotpage, newfpath=/opt/galaxy/test-data/rgtestouts/rgQC,m=[['snp', 'chromosome', 'offset', 'maf', 'a1', 'a2', 'missfrac', 'p_hwe_all', 'logp_hwe_all', 'p_hwe_unaff', 'logp_hwe_unaff', 'N_Mendel'], ['rs2283802', '22', '21784722', '0.2593', '4', '2', '0', '0.638', '0.195179', '0.638', '0.195179', '0']],s=[['famId', 'iId', 'FracMiss', 'Mendel_errors', 'Ped_sex', 'SNP_sex', 'Status', 'XHomEst', 'F_Stat'], ['101', '1', '0.04', '0', '2', '0', 'PROBLEM', 'nan', '-0.03355']]/n## Rgenetics: http://rgenetics.org Galaxy Tools rgQC.py Plink runner
@----------------------------------------------------------@
| PLINK! | v1.06 | 24/Apr/2009 |
@@ -89,7 +127,7 @@
Skipping web check... [ --noweb ]
Writing this text to log file [ tinywga.log ]
-Analysis started: Thu Mar 25 21:01:19 2010
+Analysis started: Mon Apr 5 14:05:21 2010
Options in effect:
--noweb
@@ -115,7 +153,7 @@
27 founders and 13 non-founders found
Writing allele frequencies (founders-only) to [ tinywga.frq ]
-Analysis finished: Thu Mar 25 21:01:19 2010
+Analysis finished: Mon Apr 5 14:05:21 2010
@----------------------------------------------------------@
@@ -129,7 +167,7 @@
Skipping web check... [ --noweb ]
Writing this text to log file [ tinywga.log ]
-Analysis started: Thu Mar 25 21:01:19 2010
+Analysis started: Mon Apr 5 14:05:21 2010
Options in effect:
--noweb
@@ -168,7 +206,7 @@
After filtering, 10 cases, 30 controls and 0 missing
After filtering, 21 males, 19 females, and 0 of unspecified sex
-Analysis finished: Thu Mar 25 21:01:19 2010
+Analysis finished: Mon Apr 5 14:05:21 2010
@----------------------------------------------------------@
@@ -182,7 +220,7 @@
Skipping web check... [ --noweb ]
Writing this text to log file [ tinywga.log ]
-Analysis started: Thu Mar 25 21:01:19 2010
+Analysis started: Mon Apr 5 14:05:21 2010
Options in effect:
--noweb
@@ -224,7 +262,7 @@
Writing per-locus Mendel summary to [ tinywga.lmendel ]
0 Mendel errors detected in total
-Analysis finished: Thu Mar 25 21:01:19 2010
+Analysis finished: Mon Apr 5 14:05:21 2010
@----------------------------------------------------------@
@@ -238,7 +276,7 @@
Skipping web check... [ --noweb ]
Writing this text to log file [ tinywga.log ]
-Analysis started: Thu Mar 25 21:01:19 2010
+Analysis started: Mon Apr 5 14:05:21 2010
Options in effect:
--noweb
@@ -271,7 +309,7 @@
Converting data to Individual-major format
Writing X-chromosome sex check results to [ tinywga.sexcheck ]
-Analysis finished: Thu Mar 25 21:01:19 2010
+Analysis finished: Mon Apr 5 14:05:21 2010
## Rgenetics: http://rgenetics.org Galaxy Tools rgQC.py Plink pruneLD runner
@@ -299,7 +337,7 @@
Writing this text to log file [ tinywga.log ]
-Analysis started: Thu Mar 25 21:01:19 2010
+Analysis started: Mon Apr 5 14:05:21 2010
@@ -369,7 +407,7 @@
-Analysis finished: Thu Mar 25 21:01:19 2010
+Analysis finished: Mon Apr 5 14:05:21 2010
@@ -399,7 +437,7 @@
Writing this text to log file [ ldp_tinywga.log ]
-Analysis started: Thu Mar 25 21:01:19 2010
+Analysis started: Mon Apr 5 14:05:21 2010
@@ -467,7 +505,7 @@
-Analysis finished: Thu Mar 25 21:01:19 2010
+Analysis finished: Mon Apr 5 14:05:21 2010
@@ -497,7 +535,7 @@
Writing this text to log file [ tinywga.log ]
-Analysis started: Thu Mar 25 21:01:19 2010
+Analysis started: Mon Apr 5 14:05:21 2010
@@ -565,7 +603,7 @@
-Analysis finished: Thu Mar 25 21:01:19 2010
+Analysis finished: Mon Apr 5 14:05:21 2010
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga.log
--- a/test-data/rgtestouts/rgQC/tinywga.log Sun Apr 04 19:41:07 2010 -0400
+++ b/test-data/rgtestouts/rgQC/tinywga.log Mon Apr 05 14:14:09 2010 -0400
@@ -10,7 +10,7 @@
Skipping web check... [ --noweb ]
Writing this text to log file [ tinywga.log ]
-Analysis started: Thu Mar 25 21:01:19 2010
+Analysis started: Mon Apr 5 14:05:21 2010
Options in effect:
--noweb
@@ -44,5 +44,5 @@
Converting data to Individual-major format
Writing individual heterozygosity information to [ tinywga.het ]
-Analysis finished: Thu Mar 25 21:01:19 2010
+Analysis finished: Mon Apr 5 14:05:21 2010
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga_All_3x3.pdf
Binary file test-data/rgtestouts/rgQC/tinywga_All_3x3.pdf has changed
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga_All_Paged-0.jpg
Binary file test-data/rgtestouts/rgQC/tinywga_All_Paged-0.jpg has changed
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga_All_Paged-1.jpg
Binary file test-data/rgtestouts/rgQC/tinywga_All_Paged-1.jpg has changed
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga_All_Paged-2.jpg
Binary file test-data/rgtestouts/rgQC/tinywga_All_Paged-2.jpg has changed
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga_All_Paged-3.jpg
Binary file test-data/rgtestouts/rgQC/tinywga_All_Paged-3.jpg has changed
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga_All_Paged-4.jpg
Binary file test-data/rgtestouts/rgQC/tinywga_All_Paged-4.jpg has changed
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga_All_Paged.pdf
Binary file test-data/rgtestouts/rgQC/tinywga_All_Paged.pdf has changed
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga_fracmiss.pdf
--- a/test-data/rgtestouts/rgQC/tinywga_fracmiss.pdf Sun Apr 04 19:41:07 2010 -0400
+++ b/test-data/rgtestouts/rgQC/tinywga_fracmiss.pdf Mon Apr 05 14:14:09 2010 -0400
@@ -2,8 +2,8 @@
%âãÏÓ\r
1 0 obj
<<
-/CreationDate (D:20100325210119)
-/ModDate (D:20100325210119)
+/CreationDate (D:20100405140521)
+/ModDate (D:20100405140521)
/Title (R Graphics Output)
/Producer (R 2.10.1)
/Creator (R)
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga_fracmiss_cum.pdf
--- a/test-data/rgtestouts/rgQC/tinywga_fracmiss_cum.pdf Sun Apr 04 19:41:07 2010 -0400
+++ b/test-data/rgtestouts/rgQC/tinywga_fracmiss_cum.pdf Mon Apr 05 14:14:09 2010 -0400
@@ -2,8 +2,8 @@
%âãÏÓ\r
1 0 obj
<<
-/CreationDate (D:20100325210120)
-/ModDate (D:20100325210120)
+/CreationDate (D:20100405140521)
+/ModDate (D:20100405140521)
/Title (R Graphics Output)
/Producer (R 2.10.1)
/Creator (R)
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga_s_het.pdf
--- a/test-data/rgtestouts/rgQC/tinywga_s_het.pdf Sun Apr 04 19:41:07 2010 -0400
+++ b/test-data/rgtestouts/rgQC/tinywga_s_het.pdf Mon Apr 05 14:14:09 2010 -0400
@@ -2,8 +2,8 @@
%âãÏÓ\r
1 0 obj
<<
-/CreationDate (D:20100325210120)
-/ModDate (D:20100325210120)
+/CreationDate (D:20100405140521)
+/ModDate (D:20100405140521)
/Title (R Graphics Output)
/Producer (R 2.10.1)
/Creator (R)
diff -r f00f2d0699fa -r fabf48e747ae test-data/rgtestouts/rgQC/tinywga_s_het_cum.pdf
--- a/test-data/rgtestouts/rgQC/tinywga_s_het_cum.pdf Sun Apr 04 19:41:07 2010 -0400
+++ b/test-data/rgtestouts/rgQC/tinywga_s_het_cum.pdf Mon Apr 05 14:14:09 2010 -0400
@@ -2,8 +2,8 @@
%âãÏÓ\r
1 0 obj
<<
-/CreationDate (D:20100325210120)
-/ModDate (D:20100325210120)
+/CreationDate (D:20100405140521)
+/ModDate (D:20100405140521)
/Title (R Graphics Output)
/Producer (R 2.10.1)
/Creator (R)
diff -r f00f2d0699fa -r fabf48e747ae tools/data_source/upload.py
--- a/tools/data_source/upload.py Sun Apr 04 19:41:07 2010 -0400
+++ b/tools/data_source/upload.py Mon Apr 05 14:14:09 2010 -0400
@@ -178,7 +178,7 @@
# See if we have a gzipped file, which, if it passes our restrictions, we'll uncompress
is_gzipped, is_valid = check_gzip( dataset.path )
if is_gzipped and not is_valid:
- file_err( 'The uploaded file contains inappropriate content', dataset, json_file )
+ file_err( 'The gzipped uploaded file contains inappropriate content', dataset, json_file )
return
elif is_gzipped and is_valid:
# We need to uncompress the temp_name file, but BAM files must remain compressed in the BGZF format
@@ -206,7 +206,7 @@
# See if we have a zip archive
is_zipped, is_valid, test_ext = check_zip( dataset.path )
if is_zipped and not is_valid:
- file_err( 'The uploaded file contains inappropriate content', dataset, json_file )
+ file_err( 'The zipped uploaded file contains inappropriate content', dataset, json_file )
return
elif is_zipped and is_valid:
# Currently, we force specific tools to handle this case. We also require the user
@@ -231,7 +231,7 @@
if len( parts ) > 1:
ext = parts[1].strip().lower()
if ext not in unsniffable_binary_formats:
- file_err( 'The uploaded file contains inappropriate content', dataset, json_file )
+ file_err( 'The uploaded binary file contains inappropriate content', dataset, json_file )
return
elif ext in unsniffable_binary_formats and dataset.file_type != ext:
err_msg = "You must manually set the 'File Format' to '%s' when uploading %s files." % ( ext.capitalize(), ext )
@@ -240,7 +240,7 @@
if not data_type:
# We must have a text file
if check_html( dataset.path ):
- file_err( 'The uploaded file contains inappropriate content', dataset, json_file )
+ file_err( 'The uploaded file contains inappropriate HTML content', dataset, json_file )
return
if data_type != 'binary' and data_type != 'zip':
# don't convert newlines on data we're only going to symlink
diff -r f00f2d0699fa -r fabf48e747ae tools/rgenetics/rgManQQ.py
--- a/tools/rgenetics/rgManQQ.py Sun Apr 04 19:41:07 2010 -0400
+++ b/tools/rgenetics/rgManQQ.py Mon Apr 05 14:14:09 2010 -0400
@@ -124,7 +124,14 @@
rcode2 = """rgqqMan = function(infile="%s",chromcolumn=%d, offsetcolumn=%d, pvalscolumns=%s,
title="%s",grey=%d) {
-d = read.table(infile,head=T,sep='\t')
+rawd = read.table(infile,head=T,sep='\t')
+dn = names(rawd)
+cc = dn[chromcolumn]
+oc = dn[offsetcolumn]
+nams = c(cc,oc)
+d = rawd[do.call(order,rawd[nams]),]
+# mmmf - suggested by http://onertipaday.blogspot.com/2007/08/sortingordering-dataframe-according…
+# in case not yet ordered
print(paste('###',length(d[,1]),'values read from',infile,'read - now running plots',sep=' '))
for (pvalscolumn in pvalscolumns) {
if (pvalscolumn > 0)
diff -r f00f2d0699fa -r fabf48e747ae tools/rgenetics/rgQC.py
--- a/tools/rgenetics/rgQC.py Sun Apr 04 19:41:07 2010 -0400
+++ b/tools/rgenetics/rgQC.py Mon Apr 05 14:14:09 2010 -0400
@@ -994,7 +994,7 @@
mapdict = {}
if maplist <> None:
rslist = [x[1] for x in maplist]
- offset = [x[3] for x in maplist]
+ offset = [(x[0],x[3]) for x in maplist]
mapdict = dict(zip(rslist,offset))
hwefile = '%s.hwe' % froot
lmissfile = '%s.lmiss' % froot
@@ -1009,8 +1009,9 @@
lmenddict = {}
Tops = {}
Tnames = ['Ranked Marker MAF', 'Ranked Marker Missing Genotype', 'Ranked Marker HWE', 'Ranked Marker Mendel']
- Tsorts = [2,5,9,10]
+ Tsorts = [3,6,10,11]
Treverse = [False,True,True,True] # so first values are worse(r)
+ #res.append([rs,chrom,offset,maf,a1,a2,f_missing,hwe_all[0],hwe_all[1],hwe_unaff[0],hwe_unaff[1],nmend])
#rhead = ['snp','chrom','maf','a1','a2','missfrac','p_hwe_all','logp_hwe_all','p_hwe_unaff','logp_hwe_unaff','N_Mendel']
# -------------------hwe--------------------------
# hwe has SNP TEST GENO O(HET) E(HET) P_HWD
@@ -1057,12 +1058,13 @@
hwedict[rs] = {}
markerlist.append(rs)
chromlist.append(chrom) # one place to find it?
+ lpvals = 0
if ps.upper() <> 'NA' and ps.upper() <> 'NAN': # worth keeping
lpvals = '0'
if ps <> '1':
try:
pval = float(ps)
- lpvals = '%f6' % -math.log10(pval)
+ lpvals = '%f' % -math.log10(pval)
except:
pass
hwedict[rs][test] = (ps,lpvals)
@@ -1147,49 +1149,33 @@
rhead = ['snp','chromosome','offset','maf','a1','a2','missfrac','p_hwe_all','logp_hwe_all','p_hwe_unaff','logp_hwe_unaff','N_Mendel']
res = []
fres = []
- for i in xrange(len(markerlist)): # for each snp in found order
- chrom = chromlist[i]
- rs = markerlist[i]
+ for rs in markerlist: # for each snp in found order
f_missing = lmissdict.get(rs,'NA')
maf,a1,a2 = freqdict.get(rs,('NA','NA','NA'))
hwe_all = hwedict[rs].get('ALL',('NA','NA')) # hope this doesn't change...
hwe_unaff = hwedict[rs].get('UNAFF',('NA','NA'))
nmend = lmenddict.get(rs,'NA')
- offset=mapdict.get(rs,'0')
+ (chrom,offset)=mapdict.get(rs,('?','0'))
res.append([rs,chrom,offset,maf,a1,a2,f_missing,hwe_all[0],hwe_all[1],hwe_unaff[0],hwe_unaff[1],nmend])
+ ntokeep = max(10,len(res)/keepfrac)
+
+ def msortk(item=None):
+ """
+ deal with non numeric sorting
+ """
try:
- fmaf = '%f' % float(maf)
+ return float(item)
except:
- fmaf = 'NA'
- try:
- inmend = '%d' % int(nmend)
- except:
- inmend = 'NA'
- try:
- fhweall = '%f' % float(hwe_all[1]) # the log value
- except:
- fhweall = 'NA'
- try:
- fhweunaff = '%f' % float(hwe_unaff[1]) # the log value
- except:
- fhweunaff = 'NA'
- try:
- ff_missing = '%f' % float(f_missing) # the log value
- except:
- ff_missing = 'NA'
- #fres.append([rs,chrom,fmaf,a1,a2,ff_missing,hwe_all[0],hwe_all[1],hwe_unaff[0],fhwe,inmend])
- arow = [rs,chrom,offset,fmaf,a1,a2,ff_missing,hwe_all[0],fhweall,hwe_unaff[0],fhweunaff,inmend]
- fres.append(arow)
- ntokeep = max(10,len(res)/keepfrac)
+ return item
+
for i,col in enumerate(Tsorts):
- fres.sort(key=operator.itemgetter(col))
+ res.sort(key=msortk(lambda x:x[col]))
if Treverse[i]:
- fres.reverse()
+ res.reverse()
repname = Tnames[i]
- Tops[repname] = fres[0:ntokeep]
- #Tops[repname] = [map(str,x) for x in Tops[repname]]
+ Tops[repname] = res[0:ntokeep]
Tops[repname].insert(0,rhead)
- res.sort()
+ res.sort(key=lambda x: '%s_%10d' % (x[1].ljust(4,'0'),int(x[2]))) # in chrom offset order
res.insert(0,rhead)
f = open(outfile,'w')
f.write('\n'.join(['\t'.join(x) for x in res]))
@@ -1315,10 +1301,6 @@
dat = subjectTops.get(ttitle,None)
if not dat:
dat = markerTops.get(ttitle,None)
- if not dat:
- print '## iterating plotpage - cannot find title=%s/ttitle=%s' % (title,ttitle)
- else:
- print '## iterating plotpage - found title=%s/ttitle=%s' % (title,ttitle)
imghref = '%s.jpg' % os.path.splitext(url)[0] # removes .pdf
thumbnail = os.path.join(newfpath,imghref)
if not os.path.exists(thumbnail): # for multipage pdfs, mogrify makes multiple jpgs - fugly hack
diff -r f00f2d0699fa -r fabf48e747ae tools/rgenetics/rgtest_one_tool.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/rgenetics/rgtest_one_tool.sh Mon Apr 05 14:14:09 2010 -0400
@@ -0,0 +1,218 @@
+#!/bin/sh
+# script to generate all functional test outputs for each rgenetics tool
+# could be run at installation to ensure all dependencies are in place?
+case $# in 0) echo "USAGE: ${0##*/} TooltoTest"; exit 1;;
+ [2-10]*) echo "Too many arguments - name of tool only"; exit 2;;
+ *)
+esac
+GALAXYROOT=`pwd`
+echo "using $GALAXYROOT"
+# change this as needed for your local install
+INPATH="${GALAXYROOT}/test-data"
+BINPATH="${GALAXYROOT}/tool-data/rg/bin"
+TOOLPATH="${GALAXYROOT}/tools/rgenetics"
+OROOT="${GALAXYROOT}/test-data/rgtestouts"
+NORMALOROOT="${GALAXYROOT}/test-data"
+case "$1" in
+'rgManQQ')
+
+TOOL="rgManQQ"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+rm -rf $OUTPATH/*
+CL="python $TOOLPATH/$TOOL.py "$INPATH/smallwgaP.xls" $NPRE ${OUTPATH}/${NPRE}.html $OUTPATH 1 2 5,7 0"
+# rgManQQ.py '$input_file' "$name" '$out_html' '$out_html.files_path' '$chrom_col' '$offset_col'
+# '$pval_col'
+#python /opt/galaxy/tools/rgenetics/rgManQQ.py /opt/galaxy/test-data/smallwgaP.xls rgManQQtest1
+#/opt/galaxy/test-data/rgtestouts/rgManQQ/rgManQQtest1.html /opt/galaxy/test-data/rgtestouts/rgManQQ 1 2 5,7
+echo "Testing $TOOL using $CL"
+python $TOOLPATH/$TOOL.py "$INPATH/smallwgaP.xls" $NPRE ${OUTPATH}/${NPRE}.html $OUTPATH 1 2 5,7 0
+;;
+
+'rgfakePhe')
+TOOL="rgfakePhe"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+rm -rf $OUTPATH/*
+PSSCRIPT="$OUTPATH/script_file"
+echo "{'pN':'normtest','pT':'rnorm','pP':\"{'Mean':'100', 'SD':'10'}\"}" > $PSSCRIPT
+echo "{'pN':'cattest','pT':'cat','pP':\"{'values':'red,green,blue'}\"}" >> $PSSCRIPT
+echo "{'pN':'uniftest','pT':'$f.series.phetype','pP':\"{'low':'1','hi':'100'}\"}" >> $PSSCRIPT
+echo "{'pN':'gammatest','pT':'rgamma','pP':\"{'Alpha':'1', 'Beta':'0.1'}\"}" >> $PSSCRIPT
+echo "{'pN':'poissontest','pT':'poisson','pP':\"{'lamb':'1.0',}\"}" >> $PSSCRIPT
+echo "{'pN':'exptest','pT':'exponential','pP':\"{'Mean':'100.0',}\"}" >> $PSSCRIPT
+echo "{'pN':'weibtest','pT':'weibull','pP':\"{'Alpha':'1.0', 'Beta':'0.1'}\"}" >> $PSSCRIPT
+echo "now doing $TOOL"
+python $TOOLPATH/$TOOL.py ${INPATH}/tinywga $NPRE $NPRE.pphe $OUTPATH $PSSCRIPT
+# <command interpreter="python">rgfakePhe.py '$infile1.extra_files_path/$infile1.metadata.base_name'
+# "$title1" '$ppheout' '$ppheout.files_path' '$script_file'
+#
+;;
+'rgQC')
+
+TOOL="rgQC"
+NPRE=${TOOL}test1
+echo "now doing $TOOL"
+OUTPATH="$OROOT/$TOOL"
+rm -rf $OUTPATH/*
+python $TOOLPATH/$TOOL.py -i "$INPATH/tinywga" -o $NPRE -s ${OUTPATH}/${NPRE}.html -p $OUTPATH
+# rgQC.py -i '$input_file.extra_files_path/$input_file.metadata.base_name' -o "$out_prefix"
+# -s '$html_file' -p '$html_file.files_path'
+#
+;;
+
+'rgGRR')
+TOOL="rgGRR"
+NPRE=${TOOL}test1
+echo "now doing $TOOL"
+OUTPATH="$OROOT/$TOOL"
+rm -rf $OUTPATH/*
+python $TOOLPATH/$TOOL.py "$INPATH/tinywga" "tinywga" $OUTPATH/${NPRE}.html $OUTPATH "$NPRE" '100' '6'
+# rgGRR.py $i.extra_files_path/$i.metadata.base_name "$i.metadata.base_name"
+#'$out_file1' '$out_file1.files_path' "$title" '$n' '$Z'
+;;
+'rgLDIndep')
+TOOL="rgLDIndep"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+rm -rf $OUTPATH/*
+python $TOOLPATH/$TOOL.py "$INPATH" "tinywga" "$NPRE" 1 1 0 0 1 1 $OUTPATH/${NPRE}.pbed $OUTPATH 10000 5000 0.1
+#rgLDIndep.py '$input_file.extra_files_path' '$input_file.metadata.base_name' '$title' '$mind'
+# '$geno' '$hwe' '$maf' '$mef' '$mei' '$out_file1'
+#'$out_file1.files_path' '$window' '$step' '$r2'
+;;
+
+'rgPedSub')
+TOOL="rgPedSub"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+rm -rf $OUTPATH/*
+PSSCRIPT="$OUTPATH/pedsub.script"
+echo "title~~~~$NPRE" > $PSSCRIPT
+echo "output1~~~~${OUTPATH}/${NPRE}.lped" >> $PSSCRIPT
+echo "outformat~~~~lped" >> $PSSCRIPT
+echo "basename~~~~tinywga" >> $PSSCRIPT
+echo "inped~~~~$INPATH/tinywga" >> $PSSCRIPT
+echo "outdir~~~~$OUTPATH" >> $PSSCRIPT
+echo "region~~~~" >> $PSSCRIPT
+echo "relfilter~~~~all" >> $PSSCRIPT
+echo "rslist~~~~rs2283802Xrs2267000Xrs16997606Xrs4820537Xrs3788347Xrs756632Xrs4820539Xrs2283804Xrs2267006Xrs4822363X" >> $PSSCRIPT
+echo "now doing $TOOL"
+python $TOOLPATH/$TOOL.py $PSSCRIPT
+rm -rf $PSSCRIPT
+;;
+
+'rgfakePhe')
+
+TOOL="rgfakePhe"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+rm -rf $OUTPATH/*
+PSSCRIPT="$OUTPATH/script_file"
+echo "{'pN':'normtest','pT':'rnorm','pP':\"{'Mean':'100', 'SD':'10'}\"}" > $PSSCRIPT
+echo "{'pN':'cattest','pT':'cat','pP':\"{'values':'red,green,blue'}\"}" >> $PSSCRIPT
+echo "{'pN':'uniftest','pT':'$f.series.phetype','pP':\"{'low':'1','hi':'100'}\"}" >> $PSSCRIPT
+echo "{'pN':'gammatest','pT':'rgamma','pP':\"{'Alpha':'1', 'Beta':'0.1'}\"}" >> $PSSCRIPT
+echo "{'pN':'poissontest','pT':'poisson','pP':\"{'lamb':'1.0',}\"}" >> $PSSCRIPT
+echo "{'pN':'exptest','pT':'exponential','pP':\"{'Mean':'100.0',}\"}" >> $PSSCRIPT
+echo "{'pN':'weibtest','pT':'weibull','pP':\"{'Alpha':'1.0', 'Beta':'0.1'}\"}" >> $PSSCRIPT
+echo "now doing $TOOL"
+python $TOOLPATH/$TOOL.py $PSSCRIPT
+;;
+
+'rgClean')
+TOOL="rgClean"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+rm -rf $OUTPATH/*
+python $TOOLPATH/$TOOL.py $INPATH "tinywga" "$NPRE" 1 1 0 0 1 1 $OUTPATH/${NPRE}.pbed $OUTPATH 0 0 0 0
+# rgClean.py '$input_file.extra_files_path' '$input_file.metadata.base_name' '$title' '$mind'
+# '$geno' '$hwe' '$maf' '$mef' '$mei' '$out_file1' '$out_file1.files_path'
+# '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink' '$relfilter' '$afffilter' '$sexfilter' '$fixaff'
+#
+;;
+
+'rgEigPCA')
+
+TOOL="rgEigPCA"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+rm -rf $OUTPATH/*
+python $TOOLPATH/$TOOL.py "$INPATH/tinywga" "$NPRE" ${OUTPATH}/${NPRE}.html $OUTPATH 4 2 2 2 $OUTPATH/rgEigPCAtest1.txt
+# rgEigPCA.py "$i.extra_files_path/$i.metadata.base_name" "$title" "$out_file1"
+# "$out_file1.files_path" "$k" "$m" "$t" "$s" "$pca"
+#
+;;
+
+'rgfakePed')
+TOOL="rgfakePed"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+rm -rf $OUTPATH/*
+echo "now doing $TOOL"
+python $TOOLPATH/$TOOL.py --title "$NPRE" -o $OUTPATH/${NPRE}.lped -p $OUTPATH -c "20" -n "40" -s "10" -w "0" -v "0" -l "pbed" -d "T" -m "0" -M "0"
+#rgfakePed.py --title '$title1'
+# -o '$out_file1' -p '$out_file1.extra_files_path' -c '$ncases' -n '$ntotal'
+# -s '$nsnp' -w '$lowmaf' -v '$missingValue' -l '$outFormat'
+# -d '$mafdist' -m '$missingRate' -M '$mendelRate'
+;;
+
+'rgHaploView')
+
+TOOL="rgHaploView"
+NPRE=${TOOL}test1
+OUTPATH="$OROOT/$TOOL"
+rm -rf $OUTPATH/*
+python $TOOLPATH/$TOOL.py "" "rs2283802Xrs2267000Xrs16997606Xrs4820537Xrs3788347Xrs756632Xrs4820539Xrs2283804Xrs2267006Xrs4822363X" \
+"$NPRE" $OUTPATH/${NPRE}.html "$INPATH" "tinywga" 0.0 200000 "RSQ" "lo" "2048" "$OUTPATH" "noinfo" "0.8" \
+"YRI" $BINPATH/haploview.jar
+# rgHaploView.py "$ucsc_region" "$rslist" "$title" "$output1"
+# "$lhistIn.extra_files_path" "$lhistIn.metadata.base_name"
+# "$minmaf" "$maxdist" "$ldtype" "$hires" "$memsize" "$output1.files_path"
+# "$infoTrack" "$tagr2" "$hmpanel" ${GALAXY_DATA_INDEX_DIR}/rg/bin/haploview.jar
+# note these statistical tools do NOT generate composite outputs
+;;
+
+'rgGLM')
+TOOL="rgGLM"
+NPRE=${TOOL}test1
+OUTPATH=$NORMALOROOT
+python $TOOLPATH/$TOOL.py "$INPATH/tinywga" $INPATH/tinywga "$NPRE" "c1" "" $OUTPATH/${NPRE}_GLM.xls \
+$OUTPATH/${NPRE}_GLM_log.txt "tinywga" "" "" "" 1 1 0 0 $OUTPATH/${NPRE}_GLM_topTable.gff
+## rgGLM.py '$i.extra_files_path/$i.metadata.base_name' '$phef.extra_files_path/$phef.metadata.base_name'
+## "$title1" '$predvar' '$covar' '$out_file1' '$logf' '$dbkey' '$i.metadata.base_name'
+## '$inter' '$cond' '$gender' '$mind' '$geno' '$maf' '$logistic' '$gffout'
+;;
+
+'rgTDT')
+TOOL="rgTDT"
+NPRE=${TOOL}test1
+OUTPATH=$NORMALOROOT
+python $TOOLPATH/$TOOL.py -i "$INPATH/tinywga" -o "$NPRE" -r $OUTPATH/${NPRE}_TDT.xls \
+-l $OUTPATH/${NPRE}_TDT_log.txt -g $OUTPATH/${NPRE}_TDT_topTable.gff
+## rgTDT.py -i '$infile.extra_files_path/$infile.metadata.base_name' -o '$title'
+## -r '$out_file1' -l '$logf' -x '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink'
+## -g '$gffout'
+;;
+
+'rgCaCo')
+TOOL="rgCaCo"
+NPRE=${TOOL}test1
+OUTPATH=$NORMALOROOT
+echo "now doing $TOOL"
+python $TOOLPATH/rgCaCo.py $INPATH/tinywga "$NPRE" $OUTPATH/${NPRE}_CaCo.xls $OUTPATH/${NPRE}_CaCo_log.txt $OUTPATH $OUTPATH/${NPRE}_CaCo_topTable.gff
+# echo tp=$TOOLPATH t=$TOOL op=$OUTPATH b=$BINPATH
+# rgCaCo.py '$i.extra_files_path/$i.metadata.base_name' "$name" '$out_file1' '$logf' '$logf.files_path' '$gffout'
+;;
+
+'rgQQ')
+TOOL="rgQQ"
+echo "now doing $TOOL"
+NPRE=${TOOL}test1
+OUTPATH=$NORMALOROOT
+CL="python $TOOLPATH/$TOOL.py "$INPATH/tinywga.pphe" "$NPRE" 1 3 $OUTPATH/$NPRE.pdf 8 10 "false" 1 $OUTPATH"
+echo "running $TOOL using $CL"
+python $TOOLPATH/$TOOL.py "$INPATH/tinywga.pphe" "$NPRE" 1 3 $OUTPATH/$NPRE.pdf 8 10 "false" 1 $OUTPATH
+# rgQQ.py "$input1" "$name" $sample "$cols" $allqq $height $width $log $allqq.id $__new_file_path__
+;;
+esac
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/f00f2d0699fa
changeset: 3610:f00f2d0699fa
user: fubar: ross Lazarus at gmail period com
date: Sun Apr 04 19:41:07 2010 -0400
description:
Add offset to marker reports so can use manhattan plots
Fix spelling of manhattan
diffstat:
tools/rgenetics/rgManQQ.xml | 4 ++--
tools/rgenetics/rgQC.py | 26 +++++++++++++++++++++-----
2 files changed, 23 insertions(+), 7 deletions(-)
diffs (98 lines):
diff -r b95a24c9187e -r f00f2d0699fa tools/rgenetics/rgManQQ.xml
--- a/tools/rgenetics/rgManQQ.xml Fri Apr 02 14:23:55 2010 -0400
+++ b/tools/rgenetics/rgManQQ.xml Sun Apr 04 19:41:07 2010 -0400
@@ -24,7 +24,7 @@
help='Select "None" if offset not available or no Manhattan plot required'
dynamic_options="get_phecols(i,True,'offs')" />
<param name="grey" type="boolean" checked="false" truevalue="true" falsevalue="false"
- label="Grey scale for Manhatten plot (default is colour"/>
+ label="Grey scale for Manhattan plot (default is colour"/>
</page>
</inputs>
@@ -76,7 +76,7 @@
**Summary**
This tool will create a qq plot and a Manhattan plot for one or more GWA P value columns from a tabular
-dataset. For Manhatten plots, the data must include the chromosome (eg use 23,24,25 for x,y,mt...) and
+dataset. For Manhattan plots, the data must include the chromosome (eg use 23,24,25 for x,y,mt...) and
offset. Many analysis files contain the required fields but even without chromosome and offset, a qq plot
can be created.
diff -r b95a24c9187e -r f00f2d0699fa tools/rgenetics/rgQC.py
--- a/tools/rgenetics/rgQC.py Fri Apr 02 14:23:55 2010 -0400
+++ b/tools/rgenetics/rgQC.py Sun Apr 04 19:41:07 2010 -0400
@@ -984,13 +984,18 @@
f.close()
return res,Tops
-def markerRep(froot='cleantest',outfname="mrep",newfpath='.',logf=None ):
+def markerRep(froot='cleantest',outfname="mrep",newfpath='.',logf=None,maplist=None ):
"""by marker (hwe = .hwe, missingness=.lmiss, freq = .frq)
keep a list of marker order but keep all stats in dicts
write out a fake xls file for R or SAS etc
kinda clunky, but..
TODO: ensure stable if any file not found?
"""
+ mapdict = {}
+ if maplist <> None:
+ rslist = [x[1] for x in maplist]
+ offset = [x[3] for x in maplist]
+ mapdict = dict(zip(rslist,offset))
hwefile = '%s.hwe' % froot
lmissfile = '%s.lmiss' % froot
freqfile = '%s.frq' % froot
@@ -1139,7 +1144,7 @@
else:
logf.write('No %s file - assuming not family data\n' % lmendfile)
# now assemble result list
- rhead = ['snp','chrom','maf','a1','a2','missfrac','p_hwe_all','logp_hwe_all','p_hwe_unaff','logp_hwe_unaff','N_Mendel']
+ rhead = ['snp','chromosome','offset','maf','a1','a2','missfrac','p_hwe_all','logp_hwe_all','p_hwe_unaff','logp_hwe_unaff','N_Mendel']
res = []
fres = []
for i in xrange(len(markerlist)): # for each snp in found order
@@ -1150,7 +1155,8 @@
hwe_all = hwedict[rs].get('ALL',('NA','NA')) # hope this doesn't change...
hwe_unaff = hwedict[rs].get('UNAFF',('NA','NA'))
nmend = lmenddict.get(rs,'NA')
- res.append([rs,chrom,maf,a1,a2,f_missing,hwe_all[0],hwe_all[1],hwe_unaff[0],hwe_unaff[1],nmend])
+ offset=mapdict.get(rs,'0')
+ res.append([rs,chrom,offset,maf,a1,a2,f_missing,hwe_all[0],hwe_all[1],hwe_unaff[0],hwe_unaff[1],nmend])
try:
fmaf = '%f' % float(maf)
except:
@@ -1172,7 +1178,7 @@
except:
ff_missing = 'NA'
#fres.append([rs,chrom,fmaf,a1,a2,ff_missing,hwe_all[0],hwe_all[1],hwe_unaff[0],fhwe,inmend])
- arow = [rs,chrom,fmaf,a1,a2,ff_missing,hwe_all[0],fhweall,hwe_unaff[0],fhweunaff,inmend]
+ arow = [rs,chrom,offset,fmaf,a1,a2,ff_missing,hwe_all[0],fhweall,hwe_unaff[0],fhweunaff,inmend]
fres.append(arow)
ntokeep = max(10,len(res)/keepfrac)
for i,col in enumerate(Tsorts):
@@ -1256,6 +1262,16 @@
pass
ofn = basename
bfn = options.infile
+ try:
+ mapf = '%s.bim' % bfn
+ maplist = file(mapf,'r').readlines()
+ maplist = [x.split() for x in maplist]
+ except:
+ maplist = None
+ alogf.write('## error - cannot open %s to read map - no offsets will be available for output files')
+ #rerla@beast galaxy]$ head test-data/tinywga.bim
+ #22 rs2283802 0 21784722 4 2
+ #22 rs2267000 0 21785366 4 2
rgbin = os.path.split(rexe)[0] # get our rg bin path
#plinktasks = [' --freq',' --missing',' --mendel',' --hardy',' --check-sex'] # plink v1 fixes that bug!
# if we could, do all at once? Nope. Probably never.
@@ -1276,7 +1292,7 @@
subjects,subjectTops = subjectRep(froot=repout,outfname=asubjf,newfpath=newfpath,
logf=alogf) # writes the subject_froot.xls file
markers,markerTops = markerRep(froot=repout,outfname=amarkf,newfpath=newfpath,
- logf=alogf) # marker_froot.xls
+ logf=alogf,maplist=maplist) # marker_froot.xls
nbreaks = 100
s = '## starting plotpage, newfpath=%s,m=%s,s=%s/n' % (newfpath,markers[:2],subjects[:2])
alogf.write(s)
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/23fb19105d96
changeset: 3609:23fb19105d96
user: Dan Blankenberg <dan(a)bx.psu.edu>
date: Mon Apr 05 13:57:19 2010 -0400
description:
Fix a bug where using repeat grouping constructs and change_format tags or output data label templates in a tool would cause a JSON server error. Lists were not being properly psuedo-deepcopied before being wrapped for usage.
diffstat:
lib/galaxy/tools/actions/__init__.py | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diffs (31 lines):
diff -r 59645595001f -r 23fb19105d96 lib/galaxy/tools/actions/__init__.py
--- a/lib/galaxy/tools/actions/__init__.py Fri Apr 02 17:29:15 2010 -0400
+++ b/lib/galaxy/tools/actions/__init__.py Mon Apr 05 13:57:19 2010 -0400
@@ -107,14 +107,27 @@
Makes a copy of input dictionary from_dict such that all values that are dictionaries
result in creation of a new dictionary ( a sort of deepcopy ). We may need to handle
other complex types ( e.g., lists, etc ), but not sure...
+ Yes, we need to handle lists (and now are)...
"""
copy_from_dict = {}
for key, value in from_dict.items():
if type( value ).__name__ == 'dict':
copy_from_dict[ key ] = make_dict_copy( value )
+ elif isinstance( value, list ):
+ copy_from_dict[ key ] = make_list_copy( value )
else:
copy_from_dict[ key ] = value
return copy_from_dict
+ def make_list_copy( from_list ):
+ new_list = []
+ for value in from_list:
+ if isinstance( value, dict ):
+ new_list.append( make_dict_copy( value ) )
+ elif isinstance( value, list ):
+ new_list.append( make_list_copy( value ) )
+ else:
+ new_list.append( value )
+ return new_list
def wrap_values( inputs, input_values ):
# Wrap tool inputs as necessary
for input in inputs.itervalues():
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/59645595001f
changeset: 3608:59645595001f
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Fri Apr 02 17:29:15 2010 -0400
description:
Generalize the dbkey text + autocomplete feature to work with any select box and replace all select boxes with >20 options--mostly the dbkey and dataset format selects--with text + autocomplete inputs. Also add icon to text + autocomplete inputs so that it's clearer that they're text + autocomplete, not just text.
diffstat:
static/images/fugue/plus-white.png | 0
static/june_2007_style/base.css.tmpl | 6 +
static/june_2007_style/blue/base.css | 2 +-
static/scripts/galaxy.base.js | 87 +++++++++++++++-----------
static/scripts/packed/galaxy.base.js | 2 +-
templates/dataset/edit_attributes.mako | 6 -
templates/library/common/common.mako | 2 +-
templates/library/common/ldda_edit_info.mako | 7 --
templates/tool_form.mako | 5 +-
9 files changed, 60 insertions(+), 57 deletions(-)
diffs (227 lines):
diff -r 2b6910fd7d93 -r 59645595001f static/images/fugue/plus-white.png
Binary file static/images/fugue/plus-white.png has changed
diff -r 2b6910fd7d93 -r 59645595001f static/june_2007_style/base.css.tmpl
--- a/static/june_2007_style/base.css.tmpl Fri Apr 02 16:48:35 2010 -0400
+++ b/static/june_2007_style/base.css.tmpl Fri Apr 02 17:29:15 2010 -0400
@@ -838,4 +838,10 @@
.editable-text:hover {
cursor: text;
border: dotted #999999 1px;
+}
+
+.text-and-autocomplete-select {
+ background-image:url(/static/images/fugue/plus-white.png);
+ background-repeat: no-repeat;
+ background-position:top right;
}
\ No newline at end of file
diff -r 2b6910fd7d93 -r 59645595001f static/june_2007_style/blue/base.css
--- a/static/june_2007_style/blue/base.css Fri Apr 02 16:48:35 2010 -0400
+++ b/static/june_2007_style/blue/base.css Fri Apr 02 17:29:15 2010 -0400
@@ -146,4 +146,4 @@
.tipsy-west{background-position:left center;}
.editable-text{cursor:pointer;}
.editable-text:hover{cursor: text;border: dotted #999999 1px;}
-
+.text-and-autocomplete-select{background-image:url(/static/images/fugue/plus-white.png);background-repeat: no-repeat;background-position:top right;}
diff -r 2b6910fd7d93 -r 59645595001f static/scripts/galaxy.base.js
--- a/static/scripts/galaxy.base.js Fri Apr 02 16:48:35 2010 -0400
+++ b/static/scripts/galaxy.base.js Fri Apr 02 17:29:15 2010 -0400
@@ -1,3 +1,7 @@
+$(document).ready(function() {
+ replace_big_select_inputs();
+});
+
$.fn.makeAbsolute = function(rebase) {
return this.each(function() {
var el = $(this);
@@ -115,13 +119,21 @@
return count;
}
-// Replace dbkey select box with text input box & autocomplete.
-function replace_dbkey_select() {
- var select_elt = $('select[name=dbkey]');
- var start_value = select_elt.attr('value');
- if (select_elt.length !== 0) {
+// Replace any select box with 20+ options with a text input box + autocomplete.
+// TODO: make this work _well_ on pages with multiple forms; currently, value is reverted when any form is submitted -
+// value should be reverted when only the form that element is in is submitted.
+function replace_big_select_inputs() {
+ $('select').each( function() {
+ var select_elt = $(this);
+ // Skip if there are < 20 options.
+ if (select_elt.find('option').length < 20)
+ return;
+
+ // Replace select with text + autocomplete.
+ var start_value = select_elt.attr('value');
+
// Set up text input + autocomplete element.
- var text_input_elt = $("<input id='dbkey-input' type='text'></input>");
+ var text_input_elt = $("<input type='text' class='text-and-autocomplete-select'></input>");
text_input_elt.attr('size', 40);
text_input_elt.attr('name', select_elt.attr('name'));
text_input_elt.click( function() {
@@ -133,61 +145,62 @@
$(this).select();
});
- // Get options for dbkey for autocomplete.
- var dbkey_options = [];
- var dbkey_mapping = {};
+ // Get options for select for autocomplete.
+ var select_options = [];
+ var select_mapping = {};
select_elt.children('option').each( function() {
// Get text, value for option.
var text = $(this).text();
var value = $(this).attr('value');
-
+
// Ignore values that are '?'
if (value == '?') {
return;
}
-
+
// Set options and mapping. Mapping is (i) [from text to value] AND (ii) [from value to value]. This
// enables a user to type the value directly rather than select the text that represents the value.
- dbkey_options.push( text );
- dbkey_mapping[ text ] = value;
- dbkey_mapping[ value ] = value;
-
+ select_options.push( text );
+ select_mapping[ text ] = value;
+ select_mapping[ value ] = value;
+
// If this is the start value, set value of input element.
if ( value == start_value ) {
text_input_elt.attr('value', text);
}
});
+
+ // Set initial text if it's empty.
if ( text_input_elt.attr('value') == '' ) {
- text_input_elt.attr('value', 'Click to Search or Select Build');
+ text_input_elt.attr('value', 'Click to Search or Select');
}
-
+
// Do autocomplete.
var autocomplete_options = { selectFirst: false, autoFill: false, mustMatch: false, matchContains: true, max: 1000, minChars : 0, hideForLessThanMinChars : false };
- text_input_elt.autocomplete(dbkey_options, autocomplete_options);
+ text_input_elt.autocomplete(select_options, autocomplete_options);
+
+ // Replace select with text input.
+ select_elt.replaceWith(text_input_elt);
- // Replace select with text input.
- select_elt.replaceWith(text_input_elt);
-
- // When form is submitted, change the text entered into the input to the corresponding value. If text doesn't correspond to value, remove it.
- $('form').submit( function() {
- var dbkey_text_input = $('#dbkey-input');
- if (dbkey_text_input.length !== 0) {
- // Try to convert text to value.
- var cur_value = dbkey_text_input.attr('value');
- var new_value = dbkey_mapping[cur_value];
- if (new_value !== null && new_value !== undefined) {
- dbkey_text_input.attr('value', new_value);
+ // Set trigger to replace text with value when element's form is submitted. If text doesn't correspond to value, default to start value.
+ text_input_elt.parents('form').submit( function() {
+ // Try to convert text to value.
+ var cur_value = text_input_elt.attr('value');
+ var new_value = select_mapping[cur_value];
+ if (new_value !== null && new_value !== undefined) {
+ text_input_elt.attr('value', new_value);
+ }
+ else {
+ // If there is a non-empty start value, use that; otherwise unknown.
+ if (start_value != "") {
+ text_input_elt.attr('value', start_value);
} else {
- // If there is a non-empty start value, use that; otherwise unknown.
- if (start_value != "") {
- dbkey_text_input.attr('value', start_value);
- } else {
- dbkey_text_input.attr('value', '?');
- }
+ // This is needed to make the DB key work.
+ text_input_elt.attr('value', '?');
}
}
});
- }
+ });
}
// Edit and save text asynchronously.
diff -r 2b6910fd7d93 -r 59645595001f static/scripts/packed/galaxy.base.js
--- a/static/scripts/packed/galaxy.base.js Fri Apr 02 16:48:35 2010 -0400
+++ b/static/scripts/packed/galaxy.base.js Fri Apr 02 17:29:15 2010 -0400
@@ -1,1 +1,1 @@
-$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function ensure_popup_helper(){if($("#popup-helper").length===0){$("<div id='popup-helper'/>").css({background:"white",opacity:0,zIndex:15000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}}function attach_popupmenu(b,d){var a=function(){d.unbind().hide();$("#popup-helper").unbind("click.popupmenu").hide()};var c=function(g){$("#popup-helper").bind("click.popupmenu",a).show();d.click(a).css({left:0,top:-1000}).show();var f=g.pageX-d.width()/2;f=Math.min(f,$(document).scrollLeft()+$(window).width()-$(d).width()-20);f=Math.max(f,$(document).scrollLeft()+20);d.css({top:g.pageY-5,left:f});return false};$(b).click(c)}function make_popupmenu(c,b){ensure_popup_helper();var a=$("<ul id='"+c.attr("id"!
)+"-menu'></ul>");$.each(b,function(f,e){if(e){$("<li/>").html(f).click(e).appendTo(a)}else{$("<li class='head'/>").html(f).appendTo(a)}});var d=$("<div class='popmenu-wrapper'>");d.append(a).append("<div class='overlay-border'>").css("position","absolute").appendTo("body").hide();attach_popupmenu(c,d)}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var c={};$(this).find("a").each(function(){var b=$(this).attr("confirm"),d=$(this).attr("href"),e=$(this).attr("target");c[$(this).text()]=function(){if(!b||confirm(b)){var g=window;if(e=="_parent"){g=window.parent}else{if(e=="_top"){g=window.top}}g.location=d}}});var a=$("#"+$(this).attr("popupmenu"));make_popupmenu(a,c);$(this).remove();a.addClass("popup").show()})}function array_length(b){if(b.length){return b.length}var c=0;for(var a in b){c++}return c}function replace_dbkey_select(){var c=$("select[name=dbkey]");var d=c.attr("value");if(c.length!==0){var e=$("<input id='dbkey-input' type='text'></input>!
");e.attr("size",40);e.attr("name",c.attr("name"));e.click(function(){
var g=$(this).attr("value");$(this).attr("value","Loading...");$(this).showAllInCache();$(this).attr("value",g);$(this).select()});var b=[];var a={};c.children("option").each(function(){var h=$(this).text();var g=$(this).attr("value");if(g=="?"){return}b.push(h);a[h]=g;a[g]=g;if(g==d){e.attr("value",h)}});if(e.attr("value")==""){e.attr("value","Click to Search or Select Build")}var f={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:1000,minChars:0,hideForLessThanMinChars:false};e.autocomplete(b,f);c.replaceWith(e);$("form").submit(function(){var i=$("#dbkey-input");if(i.length!==0){var h=i.attr("value");var g=a[h];if(g!==null&&g!==undefined){i.attr("value",g)}else{if(d!=""){i.attr("value",d)}else{i.attr("value","?")}}}})}}function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({!
rows:i,cols:c}).text(k)}else{j=$("<input type='text'></input>").attr({value:k,size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){l.text(o);if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}$(document).ready(function(){$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tipsy){$(".tooltip").tipsy({gravity:"s"})}make_popup_menus()});
\ No newline at end of file
+$(document).ready(function(){replace_big_select_inputs()});$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function ensure_popup_helper(){if($("#popup-helper").length===0){$("<div id='popup-helper'/>").css({background:"white",opacity:0,zIndex:15000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}}function attach_popupmenu(b,d){var a=function(){d.unbind().hide();$("#popup-helper").unbind("click.popupmenu").hide()};var c=function(g){$("#popup-helper").bind("click.popupmenu",a).show();d.click(a).css({left:0,top:-1000}).show();var f=g.pageX-d.width()/2;f=Math.min(f,$(document).scrollLeft()+$(window).width()-$(d).width()-20);f=Math.max(f,$(document).scrollLeft()+20);d.css({top:g.pageY-5,left:f});return false};$(b).click(c)}function make_popupmen!
u(c,b){ensure_popup_helper();var a=$("<ul id='"+c.attr("id")+"-menu'></ul>");$.each(b,function(f,e){if(e){$("<li/>").html(f).click(e).appendTo(a)}else{$("<li class='head'/>").html(f).appendTo(a)}});var d=$("<div class='popmenu-wrapper'>");d.append(a).append("<div class='overlay-border'>").css("position","absolute").appendTo("body").hide();attach_popupmenu(c,d)}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var c={};$(this).find("a").each(function(){var b=$(this).attr("confirm"),d=$(this).attr("href"),e=$(this).attr("target");c[$(this).text()]=function(){if(!b||confirm(b)){var g=window;if(e=="_parent"){g=window.parent}else{if(e=="_top"){g=window.top}}g.location=d}}});var a=$("#"+$(this).attr("popupmenu"));make_popupmenu(a,c);$(this).remove();a.addClass("popup").show()})}function array_length(b){if(b.length){return b.length}var c=0;for(var a in b){c++}return c}function replace_big_select_inputs(){$("select").each(function(){var a=$(this);if(a.find("optio!
n").length<20){return}var b=a.attr("value");var c=$("<input type='text
' class='text-and-autocomplete-select'></input>");c.attr("size",40);c.attr("name",a.attr("name"));c.click(function(){var g=$(this).attr("value");$(this).attr("value","Loading...");$(this).showAllInCache();$(this).attr("value",g);$(this).select()});var f=[];var e={};a.children("option").each(function(){var h=$(this).text();var g=$(this).attr("value");if(g=="?"){return}f.push(h);e[h]=g;e[g]=g;if(g==b){c.attr("value",h)}});if(c.attr("value")==""){c.attr("value","Click to Search or Select")}var d={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:1000,minChars:0,hideForLessThanMinChars:false};c.autocomplete(f,d);a.replaceWith(c);c.parents("form").submit(function(){var h=c.attr("value");var g=e[h];if(g!==null&&g!==undefined){c.attr("value",g)}else{if(b!=""){c.attr("value",b)}else{c.attr("value","?")}}})})}function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0!
){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text(k)}else{j=$("<input type='text'></input>").attr({value:k,size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){l.text(o);if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}$(document).ready(function(){$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tipsy){$(".tooltip").tipsy({gravity:"s"})}make_popup_menus()});
\ No newline at end of file
diff -r 2b6910fd7d93 -r 59645595001f templates/dataset/edit_attributes.mako
--- a/templates/dataset/edit_attributes.mako Fri Apr 02 16:48:35 2010 -0400
+++ b/templates/dataset/edit_attributes.mako Fri Apr 02 17:29:15 2010 -0400
@@ -10,12 +10,6 @@
<%def name="javascripts()">
${parent.javascripts()}
${h.js( "galaxy.base", "jquery.autocomplete", "autocomplete_tagging" )}
- <script type="text/javascript">
- $(document).ready(function()
- {
- replace_dbkey_select('${data.dbkey}');
- });
- </script>
</%def>
<%def name="datatype( dataset, datatypes )">
diff -r 2b6910fd7d93 -r 59645595001f templates/library/common/common.mako
--- a/templates/library/common/common.mako Fri Apr 02 16:48:35 2010 -0400
+++ b/templates/library/common/common.mako Fri Apr 02 17:29:15 2010 -0400
@@ -321,7 +321,7 @@
<script type="text/javascript">
// Replace dbkey select with search+select.
jQuery(document).ready( function() {
- replace_dbkey_select();
+ replace_big_select_inputs();
});
</script>
%elif upload_option == 'import_from_history':
diff -r 2b6910fd7d93 -r 59645595001f templates/library/common/ldda_edit_info.mako
--- a/templates/library/common/ldda_edit_info.mako Fri Apr 02 16:48:35 2010 -0400
+++ b/templates/library/common/ldda_edit_info.mako Fri Apr 02 17:29:15 2010 -0400
@@ -6,13 +6,6 @@
<%def name="javascripts()">
${parent.javascripts()}
${h.js("jquery.autocomplete", "autocomplete_tagging" )}
- ## Script to replace dbkey select with select+search.
- <script type="text/javascript">
- // Replace dbkey select with search+select.
- jQuery(document).ready( function() {
- replace_dbkey_select();
- });
- </script>
</%def>
<%def name="stylesheets()">
diff -r 2b6910fd7d93 -r 59645595001f templates/tool_form.mako
--- a/templates/tool_form.mako Fri Apr 02 16:48:35 2010 -0400
+++ b/templates/tool_form.mako Fri Apr 02 17:29:15 2010 -0400
@@ -48,10 +48,7 @@
} );
$( "#tool_form" ).submit();
}
- });
-
- // Replace dbkey select with search+select.
- replace_dbkey_select();
+ });
});
%if not add_frame.debug:
if( window.name != "galaxy_main" ) {
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/2b6910fd7d93
changeset: 3607:2b6910fd7d93
user: Kanwei Li <kanwei(a)gmail.com>
date: Fri Apr 02 16:48:35 2010 -0400
description:
Only preview for non-binary files. Closes #283
diffstat:
lib/galaxy/web/controllers/dataset.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diffs (12 lines):
diff -r f2b6d4f3189c -r 2b6910fd7d93 lib/galaxy/web/controllers/dataset.py
--- a/lib/galaxy/web/controllers/dataset.py Fri Apr 02 16:06:43 2010 -0400
+++ b/lib/galaxy/web/controllers/dataset.py Fri Apr 02 16:48:35 2010 -0400
@@ -352,7 +352,7 @@
return open( data.file_name )
if os.path.exists( data.file_name ):
max_peek_size = 1000000 # 1 MB
- if preview and os.stat( data.file_name ).st_size > max_peek_size:
+ if preview and (not isinstance(data.datatype, datatypes.binary.Binary)) and os.stat( data.file_name ).st_size > max_peek_size:
trans.response.set_content_type( "text/html" )
return trans.stream_template_mako( "/dataset/large_file.mako",
truncated_data = open( data.file_name ).read(max_peek_size),
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/f2b6d4f3189c
changeset: 3606:f2b6d4f3189c
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Fri Apr 02 16:06:43 2010 -0400
description:
Move toward standardizing the way messages are displayed on Galaxy forms by using params 'message' and 'status' instead of 'msg' and 'messagetype'.
diffstat:
lib/galaxy/web/controllers/admin.py | 140 +-
lib/galaxy/web/controllers/forms.py | 76 +-
lib/galaxy/web/controllers/history.py | 7 +-
lib/galaxy/web/controllers/library.py | 16 +-
lib/galaxy/web/controllers/library_admin.py | 46 +-
lib/galaxy/web/controllers/library_common.py | 548 +++++++-------
lib/galaxy/web/controllers/requests.py | 164 ++--
lib/galaxy/web/controllers/requests_admin.py | 298 +++---
lib/galaxy/web/controllers/root.py | 32 +-
lib/galaxy/web/controllers/user.py | 200 ++--
templates/admin/dataset_security/group/group.mako | 4 +-
templates/admin/dataset_security/group/group_create.mako | 4 +-
templates/admin/dataset_security/group/group_rename.mako | 4 +-
templates/admin/dataset_security/role/role.mako | 4 +-
templates/admin/dataset_security/role/role_create.mako | 4 +-
templates/admin/dataset_security/role/role_rename.mako | 4 +-
templates/admin/forms/create_form.mako | 4 +-
templates/admin/forms/edit_form.mako | 4 +-
templates/admin/forms/show_form_read_only.mako | 4 +-
templates/admin/jobs.mako | 4 +-
templates/admin/library/new_library.mako | 4 +-
templates/admin/memdump.mako | 4 +-
templates/admin/reload_tool.mako | 4 +-
templates/admin/requests/add_states.mako | 4 +-
templates/admin/requests/create_request_type.mako | 4 +-
templates/admin/requests/edit_request.mako | 4 +-
templates/admin/requests/edit_request_type.mako | 4 +-
templates/admin/requests/events.mako | 4 +-
templates/admin/requests/get_data.mako | 4 +-
templates/admin/requests/new_request.mako | 4 +-
templates/admin/requests/reject.mako | 4 +-
templates/admin/requests/show_request.mako | 4 +-
templates/admin/requests/view_request_type.mako | 4 +-
templates/admin/samples/bar_codes.mako | 4 +-
templates/admin/samples/events.mako | 4 +-
templates/admin/user/reset_password.mako | 4 +-
templates/admin/user/user.mako | 4 +-
templates/dataset/edit_attributes.mako | 4 +-
templates/history/sharing.mako | 4 +-
templates/library/browse_libraries.mako | 4 +-
templates/library/common/browse_library.mako | 4 +-
templates/library/common/edit_template.mako | 4 +-
templates/library/common/folder_info.mako | 4 +-
templates/library/common/folder_permissions.mako | 4 +-
templates/library/common/ldda_edit_info.mako | 4 +-
templates/library/common/ldda_info.mako | 4 +-
templates/library/common/ldda_permissions.mako | 4 +-
templates/library/common/library_dataset_info.mako | 4 +-
templates/library/common/library_dataset_permissions.mako | 4 +-
templates/library/common/library_info.mako | 4 +-
templates/library/common/library_permissions.mako | 4 +-
templates/library/common/new_folder.mako | 4 +-
templates/library/common/select_template.mako | 4 +-
templates/library/common/upload.mako | 4 +-
templates/mobile/manage_library.mako | 4 +-
templates/requests/edit_request.mako | 4 +-
templates/requests/events.mako | 4 +-
templates/requests/new_request.mako | 4 +-
templates/requests/show_data.mako | 4 +-
templates/requests/show_request.mako | 4 +-
templates/sample/sample_events.mako | 4 +-
templates/user/edit_address.mako | 4 +-
templates/user/index.mako | 4 +-
templates/user/info.mako | 4 +-
templates/user/login.mako | 4 +-
templates/user/logout.mako | 4 +-
templates/user/new_address.mako | 4 +-
templates/user/register.mako | 4 +-
templates/user/reset_password.mako | 4 +-
69 files changed, 883 insertions(+), 880 deletions(-)
diffs (truncated from 4762 to 3000 lines):
diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/admin.py
--- a/lib/galaxy/web/controllers/admin.py Fri Apr 02 15:09:29 2010 -0400
+++ b/lib/galaxy/web/controllers/admin.py Fri Apr 02 16:06:43 2010 -0400
@@ -263,9 +263,9 @@
@web.require_admin
def index( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
- return trans.fill_template( '/admin/index.mako', msg=msg, messagetype=messagetype )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ return trans.fill_template( '/admin/index.mako', message=message, status=status )
@web.expose
@web.require_admin
def center( self, trans, **kwd ):
@@ -274,17 +274,17 @@
@web.require_admin
def reload_tool( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
- return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, msg=msg, messagetype=messagetype )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, message=message, status=status )
@web.expose
@web.require_admin
def tool_reload( self, trans, tool_version=None, **kwd ):
params = util.Params( kwd )
tool_id = params.tool_id
self.app.toolbox.reload( tool_id )
- msg = 'Reloaded tool: ' + tool_id
- return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, msg=msg, messagetype='done' )
+ message = 'Reloaded tool: ' + tool_id
+ return trans.fill_template( '/admin/reload_tool.mako', toolbox=self.app.toolbox, message=message, status='done' )
# Galaxy Role Stuff
@web.expose
@@ -312,8 +312,8 @@
@web.require_admin
def create_role( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
if params.get( 'create_role_button', False ):
name = util.restore_text( params.name )
description = util.restore_text( params.description )
@@ -321,9 +321,9 @@
in_groups = util.listify( params.get( 'in_groups', [] ) )
create_group_for_role = params.get( 'create_group_for_role', 'no' )
if not name or not description:
- msg = "Enter a valid name and a description"
+ message = "Enter a valid name and a description"
elif trans.sa_session.query( trans.app.model.Role ).filter( trans.app.model.Role.table.c.name==name ).first():
- msg = "A role with that name already exists"
+ message = "A role with that name already exists"
else:
# Create the role
role = trans.app.model.Role( name=name, description=description, type=trans.app.model.Role.types.ADMIN )
@@ -340,13 +340,13 @@
# Create the group
group = trans.app.model.Group( name=name )
trans.sa_session.add( group )
- msg = "Group '%s' has been created, and role '%s' has been created with %d associated users and %d associated groups" % \
+ message = "Group '%s' has been created, and role '%s' has been created with %d associated users and %d associated groups" % \
( group.name, role.name, len( in_users ), len( in_groups ) )
else:
- msg = "Role '%s' has been created with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) )
+ message = "Role '%s' has been created with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) )
trans.sa_session.flush()
- trans.response.send_redirect( web.url_for( controller='admin', action='roles', message=util.sanitize_text( msg ), status='done' ) )
- trans.response.send_redirect( web.url_for( controller='admin', action='create_role', msg=util.sanitize_text( msg ), messagetype='error' ) )
+ trans.response.send_redirect( web.url_for( controller='admin', action='roles', message=util.sanitize_text( message ), status='done' ) )
+ trans.response.send_redirect( web.url_for( controller='admin', action='create_role', message=util.sanitize_text( message ), status='error' ) )
out_users = []
for user in trans.sa_session.query( trans.app.model.User ) \
.filter( trans.app.model.User.table.c.deleted==False ) \
@@ -362,39 +362,39 @@
out_users=out_users,
in_groups=[],
out_groups=out_groups,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
@web.require_admin
def rename_role( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
role = get_role( trans, params.id )
if params.get( 'rename_role_button', False ):
old_name = role.name
new_name = util.restore_text( params.name )
new_description = util.restore_text( params.description )
if not new_name:
- msg = 'Enter a valid name'
- return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, msg=msg, messagetype='error' )
+ message = 'Enter a valid name'
+ return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, message=message, status='error' )
elif trans.sa_session.query( trans.app.model.Role ).filter( trans.app.model.Role.table.c.name==new_name ).first():
- msg = 'A role with that name already exists'
- return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, msg=msg, messagetype='error' )
+ message = 'A role with that name already exists'
+ return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, message=message, status='error' )
else:
role.name = new_name
role.description = new_description
trans.sa_session.add( role )
trans.sa_session.flush()
- msg = "Role '%s' has been renamed to '%s'" % ( old_name, new_name )
- return trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( msg ), status='done' ) )
- return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, msg=msg, messagetype=messagetype )
+ message = "Role '%s' has been renamed to '%s'" % ( old_name, new_name )
+ return trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( message ), status='done' ) )
+ return trans.fill_template( '/admin/dataset_security/role/role_rename.mako', role=role, message=message, status=status )
@web.expose
@web.require_admin
def manage_users_and_groups_for_role( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
role = get_role( trans, params.id )
if params.get( 'role_members_edit_button', False ):
in_users = [ trans.sa_session.query( trans.app.model.User ).get( x ) for x in util.listify( params.in_users ) ]
@@ -414,8 +414,8 @@
in_groups = [ trans.sa_session.query( trans.app.model.Group ).get( x ) for x in util.listify( params.in_groups ) ]
trans.app.security_agent.set_entity_role_associations( roles=[ role ], users=in_users, groups=in_groups )
trans.sa_session.refresh( role )
- msg = "Role '%s' has been updated with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) )
- trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( msg ), status=messagetype ) )
+ message = "Role '%s' has been updated with %d associated users and %d associated groups" % ( role.name, len( in_users ), len( in_groups ) )
+ trans.response.send_redirect( web.url_for( action='roles', message=util.sanitize_text( message ), status=status ) )
in_users = []
out_users = []
in_groups = []
@@ -467,8 +467,8 @@
in_groups=in_groups,
out_groups=out_groups,
library_dataset_actions=library_dataset_actions,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
@web.require_admin
def mark_role_deleted( self, trans, **kwd ):
@@ -554,39 +554,39 @@
@web.require_admin
def rename_group( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
group = get_group( trans, params.id )
if params.get( 'rename_group_button', False ):
old_name = group.name
new_name = util.restore_text( params.name )
if not new_name:
- msg = 'Enter a valid name'
- return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, msg=msg, messagetype='error' )
+ message = 'Enter a valid name'
+ return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, message=message, status='error' )
elif trans.sa_session.query( trans.app.model.Group ).filter( trans.app.model.Group.table.c.name==new_name ).first():
- msg = 'A group with that name already exists'
- return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, msg=msg, messagetype='error' )
+ message = 'A group with that name already exists'
+ return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, message=message, status='error' )
else:
group.name = new_name
trans.sa_session.add( group )
trans.sa_session.flush()
- msg = "Group '%s' has been renamed to '%s'" % ( old_name, new_name )
- return trans.response.send_redirect( web.url_for( action='groups', msg=util.sanitize_text( msg ), messagetype='done' ) )
- return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, msg=msg, messagetype=messagetype )
+ message = "Group '%s' has been renamed to '%s'" % ( old_name, new_name )
+ return trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='done' ) )
+ return trans.fill_template( '/admin/dataset_security/group/group_rename.mako', group=group, message=message, status=status )
@web.expose
@web.require_admin
def manage_users_and_roles_for_group( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
group = get_group( trans, params.id )
if params.get( 'group_roles_users_edit_button', False ):
in_roles = [ trans.sa_session.query( trans.app.model.Role ).get( x ) for x in util.listify( params.in_roles ) ]
in_users = [ trans.sa_session.query( trans.app.model.User ).get( x ) for x in util.listify( params.in_users ) ]
trans.app.security_agent.set_entity_group_associations( groups=[ group ], roles=in_roles, users=in_users )
trans.sa_session.refresh( group )
- msg += "Group '%s' has been updated with %d associated roles and %d associated users" % ( group.name, len( in_roles ), len( in_users ) )
- trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status=messagetype ) )
+ message += "Group '%s' has been updated with %d associated roles and %d associated users" % ( group.name, len( in_roles ), len( in_users ) )
+ trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status=status ) )
in_roles = []
out_roles = []
in_users = []
@@ -605,29 +605,29 @@
in_users.append( ( user.id, user.email ) )
else:
out_users.append( ( user.id, user.email ) )
- msg += 'Group %s is currently associated with %d roles and %d users' % ( group.name, len( in_roles ), len( in_users ) )
+ message += 'Group %s is currently associated with %d roles and %d users' % ( group.name, len( in_roles ), len( in_users ) )
return trans.fill_template( '/admin/dataset_security/group/group.mako',
group=group,
in_roles=in_roles,
out_roles=out_roles,
in_users=in_users,
out_users=out_users,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
@web.require_admin
def create_group( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
if params.get( 'create_group_button', False ):
name = util.restore_text( params.name )
in_users = util.listify( params.get( 'in_users', [] ) )
in_roles = util.listify( params.get( 'in_roles', [] ) )
if not name:
- msg = "Enter a valid name"
+ message = "Enter a valid name"
elif trans.sa_session.query( trans.app.model.Group ).filter( trans.app.model.Group.table.c.name==name ).first():
- msg = "A group with that name already exists"
+ message = "A group with that name already exists"
else:
# Create the group
group = trans.app.model.Group( name=name )
@@ -643,9 +643,9 @@
gra = trans.app.model.GroupRoleAssociation( group, role )
trans.sa_session.add( gra )
trans.sa_session.flush()
- msg = "Group '%s' has been created with %d associated users and %d associated roles" % ( name, len( in_users ), len( in_roles ) )
- trans.response.send_redirect( web.url_for( controller='admin', action='groups', message=util.sanitize_text( msg ), status='done' ) )
- trans.response.send_redirect( web.url_for( controller='admin', action='create_group', msg=util.sanitize_text( msg ), messagetype='error' ) )
+ message = "Group '%s' has been created with %d associated users and %d associated roles" % ( name, len( in_users ), len( in_roles ) )
+ trans.response.send_redirect( web.url_for( controller='admin', action='groups', message=util.sanitize_text( message ), status='done' ) )
+ trans.response.send_redirect( web.url_for( controller='admin', action='create_group', message=util.sanitize_text( message ), status='error' ) )
out_users = []
for user in trans.sa_session.query( trans.app.model.User ) \
.filter( trans.app.model.User.table.c.deleted==False ) \
@@ -661,8 +661,8 @@
out_users=out_users,
in_roles=[],
out_roles=out_roles,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
@web.require_admin
def mark_group_deleted( self, trans, **kwd ):
@@ -671,8 +671,8 @@
group.deleted = True
trans.sa_session.add( group )
trans.sa_session.flush()
- msg = "Group '%s' has been marked as deleted." % group.name
- trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status='done' ) )
+ message = "Group '%s' has been marked as deleted." % group.name
+ trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='done' ) )
@web.expose
@web.require_admin
def undelete_group( self, trans, **kwd ):
@@ -681,8 +681,8 @@
group.deleted = False
trans.sa_session.add( group )
trans.sa_session.flush()
- msg = "Group '%s' has been marked as not deleted." % group.name
- trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status='done' ) )
+ message = "Group '%s' has been marked as not deleted." % group.name
+ trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='done' ) )
@web.expose
@web.require_admin
def purge_group( self, trans, **kwd ):
@@ -692,8 +692,8 @@
group = get_group( trans, params.id )
if not group.deleted:
# We should never reach here, but just in case there is a bug somewhere...
- msg = "Group '%s' has not been deleted, so it cannot be purged." % group.name
- trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( msg ), status='error' ) )
+ message = "Group '%s' has not been deleted, so it cannot be purged." % group.name
+ trans.response.send_redirect( web.url_for( action='groups', message=util.sanitize_text( message ), status='error' ) )
# Delete UserGroupAssociations
for uga in group.users:
trans.sa_session.delete( uga )
@@ -972,8 +972,8 @@
out_roles=out_roles,
in_groups=in_groups,
out_groups=out_groups,
- msg=message,
- messagetype=status )
+ message=message,
+ status=status )
@web.expose
@web.require_admin
def memdump( self, trans, ids = 'None', sorts = 'None', pages = 'None', new_id = None, new_sort = None, **kwd ):
@@ -1020,11 +1020,11 @@
def jobs( self, trans, stop = [], stop_msg = None, cutoff = 180, **kwd ):
deleted = []
msg = None
- messagetype = None
+ status = None
job_ids = util.listify( stop )
if job_ids and stop_msg in [ None, '' ]:
msg = 'Please enter an error message to display to the user describing why the job was terminated'
- messagetype = 'error'
+ status = 'error'
elif job_ids:
if stop_msg[-1] not in string.punctuation:
stop_msg += '.'
@@ -1037,7 +1037,7 @@
msg += 's'
msg += ' for deletion: '
msg += ', '.join( deleted )
- messagetype = 'done'
+ status = 'done'
cutoff_time = datetime.utcnow() - timedelta( seconds=int( cutoff ) )
jobs = trans.sa_session.query( trans.app.model.Job ) \
.filter( and_( trans.app.model.Job.table.c.update_time < cutoff_time,
@@ -1053,7 +1053,7 @@
last_updated[job.id] = '%s hours' % int( delta.seconds / 60 / 60 )
else:
last_updated[job.id] = '%s minutes' % int( delta.seconds / 60 )
- return trans.fill_template( '/admin/jobs.mako', jobs = jobs, last_updated = last_updated, cutoff = cutoff, msg = msg, messagetype = messagetype )
+ return trans.fill_template( '/admin/jobs.mako', jobs = jobs, last_updated = last_updated, cutoff = cutoff, msg = msg, status = status )
## ---- Utility methods -------------------------------------------------------
diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/forms.py
--- a/lib/galaxy/web/controllers/forms.py Fri Apr 02 15:09:29 2010 -0400
+++ b/lib/galaxy/web/controllers/forms.py Fri Apr 02 16:06:43 2010 -0400
@@ -102,8 +102,8 @@
except:
return trans.response.send_redirect( web.url_for( controller='forms',
action='manage',
- msg='Invalid form',
- messagetype='error' ) )
+ message='Invalid form',
+ status='error' ) )
return trans.fill_template( '/admin/forms/show_form_read_only.mako',
form=fdc.latest_form )
def __form_types_widget(self, trans, selected='none'):
@@ -127,16 +127,16 @@
@web.require_admin
def new( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
self.__imported_from_file = False
if params.get( 'create_form_button', False ):
- fd, msg = self.__save_form( trans, fdc_id=None, **kwd )
+ fd, message = self.__save_form( trans, fdc_id=None, **kwd )
if not fd:
return trans.response.send_redirect( web.url_for( controller='forms',
action='new',
- msg=msg,
- messagetype='error',
+ message=message,
+ status='error',
name=util.restore_text( params.get( 'name', '' ) ),
description=util.restore_text( params.get( 'description', '' ) ) ))
self.__get_saved_form( fd )
@@ -158,8 +158,8 @@
( 'Import from csv file (Optional)', FileField( 'file_data', 40, '' ) ) ]
return trans.fill_template( '/admin/forms/create_form.mako',
inputs=inputs,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
def __delete( self, trans, **kwd ):
id_list = util.listify( kwd['id'] )
delete_failed = []
@@ -205,8 +205,8 @@
edit_template() method in the library_common controller.
'''
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
fdc = trans.sa_session.query( trans.app.model.FormDefinitionCurrent ).get( trans.security.decode_id(kwd['id']) )
except:
@@ -219,22 +219,22 @@
# Save changes
#
if params.get( 'save_changes_button', False ):
- fd_new, msg = self.__save_form( trans, fdc_id=fd.form_definition_current.id, **kwd )
+ fd_new, message = self.__save_form( trans, fdc_id=fd.form_definition_current.id, **kwd )
# if validation error encountered while saving the form, show the
# unsaved form, with the error message
if not fd_new:
current_form = self.__get_form( trans, **kwd )
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype='error', response_redirect=response_redirect, **kwd )
+ message=message, status='error', response_redirect=response_redirect, **kwd )
# everything went fine. form saved successfully. Show the saved form or redirect
# to response_redirect if appropriate.
if response_redirect:
return trans.response.send_redirect( response_redirect )
fd = fd_new
current_form = self.__get_saved_form( fd )
- msg = "The form '%s' has been updated with the changes." % fd.name
+ message = "The form '%s' has been updated with the changes." % fd.name
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Add a layout grid
#
@@ -243,7 +243,7 @@
current_form['layout'].append('')
# show the form again
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Delete a layout grid
#
@@ -252,7 +252,7 @@
index = int( kwd[ 'remove_layout_grid_button' ].split( ' ' )[2] ) - 1
del current_form['layout'][index]
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Add a field
#
@@ -261,7 +261,7 @@
current_form['fields'].append( self.empty_field )
# show the form again with one empty field
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Delete a field
#
@@ -271,33 +271,33 @@
index = int( kwd[ 'remove_button' ].split( ' ' )[2] ) - 1
del current_form['fields'][index]
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Add SelectField option
#
elif 'Add' in kwd.values():
- return self.__add_selectbox_option(trans, fd, msg, messagetype, response_redirect=response_redirect, **kwd)
+ return self.__add_selectbox_option(trans, fd, message, status, response_redirect=response_redirect, **kwd)
#
# Remove SelectField option
#
elif 'Remove' in kwd.values():
- return self.__remove_selectbox_option(trans, fd, msg, messagetype, response_redirect=response_redirect, **kwd)
+ return self.__remove_selectbox_option(trans, fd, message, status, response_redirect=response_redirect, **kwd)
#
# Refresh page
#
elif params.get( 'refresh', False ):
current_form = self.__get_form( trans, **kwd )
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
#
# Show the form for editing
#
else:
current_form = self.__get_saved_form( fd )
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
- def __add_selectbox_option( self, trans, fd, msg, messagetype, response_redirect=None, **kwd ):
+ def __add_selectbox_option( self, trans, fd, message, status, response_redirect=None, **kwd ):
'''
This method adds a selectbox option. The kwd dict searched for
the field index which needs to be removed
@@ -313,13 +313,13 @@
if index == -1:
# something wrong happened
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg='Error in adding selectfield option',
- messagetype='error', response_redirect=response_redirect, **kwd )
+ message='Error in adding selectfield option',
+ status='error', response_redirect=response_redirect, **kwd )
# add an empty option
current_form[ 'fields' ][ index ][ 'selectlist' ].append( '' )
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
- def __remove_selectbox_option( self, trans, fd, msg, messagetype, response_redirect=None, **kwd ):
+ message=message, status=status, response_redirect=response_redirect, **kwd )
+ def __remove_selectbox_option( self, trans, fd, message, status, response_redirect=None, **kwd ):
'''
This method removes a selectbox option. The kwd dict searched for
the field index and option index which needs to be removed
@@ -336,12 +336,12 @@
if option == -1:
# something wrong happened
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg='Error in removing selectfield option',
- messagetype='error', response_redirect=response_redirect, **kwd )
+ message='Error in removing selectfield option',
+ status='error', response_redirect=response_redirect, **kwd )
# remove the option
del current_form[ 'fields' ][ index ][ 'selectlist' ][ option ]
return self.__show( trans=trans, form=fd, current_form=current_form,
- msg=msg, messagetype=messagetype, response_redirect=response_redirect, **kwd )
+ message=message, status=status, response_redirect=response_redirect, **kwd )
def __get_field(self, index, **kwd):
@@ -497,9 +497,9 @@
This method saves the current form
'''
# check the form for invalid inputs
- flag, msg = self.__validate_form(**kwd)
+ flag, message = self.__validate_form(**kwd)
if not flag:
- return None, msg
+ return None, message
current_form = self.__get_form( trans, **kwd )
# validate fields
for field in current_form[ 'fields' ]:
@@ -523,8 +523,8 @@
fdc.latest_form = fd
trans.sa_session.add( fdc )
trans.sa_session.flush()
- msg = "The new form named '%s' has been created. " % (fd.name)
- return fd, msg
+ message = "The new form named '%s' has been created. " % (fd.name)
+ return fd, message
class FieldUI(object):
def __init__(self, trans, layout_grids, index, field=None, field_type=None, form_type=None):
@@ -631,7 +631,7 @@
def label(self):
return str(self.index)+'.'+self.label
- def __show( self, trans, form, current_form, msg='', messagetype='done', response_redirect=None, **kwd ):
+ def __show( self, trans, form, current_form, message='', status='done', response_redirect=None, **kwd ):
'''
This method displays the form and any of the changes made to it,
The empty_form param allows for this method to simulate clicking
@@ -662,8 +662,8 @@
field_details=field_details,
form=form,
field_types=BaseField.form_field_types(),
- msg=msg,
- messagetype=messagetype,
+ message=message,
+ status=status,
current_form_type=current_form[ 'type' ],
layout_grids=form_layout,
response_redirect=response_redirect )
diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/history.py
--- a/lib/galaxy/web/controllers/history.py Fri Apr 02 15:09:29 2010 -0400
+++ b/lib/galaxy/web/controllers/history.py Fri Apr 02 16:06:43 2010 -0400
@@ -648,8 +648,11 @@
elif 'unshare_user' in kwargs:
user = trans.sa_session.query( trans.app.model.User ).get( trans.security.decode_id( kwargs[ 'unshare_user' ] ) )
if not user:
- msg = 'History (%s) does not seem to be shared with user (%s)' % ( history.name, user.email )
- return trans.fill_template( 'history/sharing.mako', histories=histories, msg=msg, messagetype='error' )
+ message = 'History (%s) does not seem to be shared with user (%s)' % ( history.name, user.email )
+ return trans.fill_template( 'history/sharing.mako',
+ histories=histories,
+ message=message,
+ status='error' )
husas = trans.sa_session.query( trans.app.model.HistoryUserShareAssociation ).filter_by( user=user, history=history ).all()
if husas:
for husa in husas:
diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/library.py
--- a/lib/galaxy/web/controllers/library.py Fri Apr 02 15:09:29 2010 -0400
+++ b/lib/galaxy/web/controllers/library.py Fri Apr 02 16:06:43 2010 -0400
@@ -10,17 +10,17 @@
@web.expose
def index( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
return trans.fill_template( "/library/index.mako",
default_action=params.get( 'default_action', None ),
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def browse_libraries( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
current_user_roles = trans.get_current_user_roles()
all_libraries = trans.sa_session.query( trans.app.model.Library ) \
.filter( trans.app.model.Library.table.c.deleted==False ) \
@@ -32,5 +32,5 @@
return trans.fill_template( '/library/browse_libraries.mako',
libraries=authorized_libraries,
default_action=params.get( 'default_action', None ),
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/library_admin.py
--- a/lib/galaxy/web/controllers/library_admin.py Fri Apr 02 15:09:29 2010 -0400
+++ b/lib/galaxy/web/controllers/library_admin.py Fri Apr 02 16:06:43 2010 -0400
@@ -92,8 +92,8 @@
@web.require_admin
def create_library( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
if params.get( 'create_library_button', False ):
name = util.restore_text( params.get( 'name', 'No name' ) )
description = util.restore_text( params.get( 'description', '' ) )
@@ -105,14 +105,14 @@
library.root_folder = root_folder
trans.sa_session.add_all( ( library, root_folder ) )
trans.sa_session.flush()
- msg = "The new library named '%s' has been created" % library.name
+ message = "The new library named '%s' has been created" % library.name
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller='library_admin',
id=trans.security.encode_id( library.id ),
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
- return trans.fill_template( '/admin/library/new_library.mako', msg=msg, messagetype=messagetype )
+ message=util.sanitize_text( message ),
+ status='done' ) )
+ return trans.fill_template( '/admin/library/new_library.mako', message=message, status=status )
@web.expose
@web.require_admin
def purge_library( self, trans, **kwd ):
@@ -146,20 +146,20 @@
trans.sa_session.add( library_folder )
trans.sa_session.flush()
if not library.deleted:
- msg = "Library '%s' has not been marked deleted, so it cannot be purged" % ( library.name )
+ message = "Library '%s' has not been marked deleted, so it cannot be purged" % ( library.name )
return trans.response.send_redirect( web.url_for( controller='library_admin',
action='browse_libraries',
- message=util.sanitize_text( msg ),
+ message=util.sanitize_text( message ),
status='error' ) )
else:
purge_folder( library.root_folder )
library.purged = True
trans.sa_session.add( library )
trans.sa_session.flush()
- msg = "Library '%s' and all of its contents have been purged, datasets will be removed from disk via the cleanup_datasets script" % library.name
+ message = "Library '%s' and all of its contents have been purged, datasets will be removed from disk via the cleanup_datasets script" % library.name
return trans.response.send_redirect( web.url_for( controller='library_admin',
action='browse_libraries',
- message=util.sanitize_text( msg ),
+ message=util.sanitize_text( message ),
status='done' ) )
@web.expose
@web.require_admin
@@ -176,8 +176,8 @@
'folder': trans.app.model.LibraryFolder,
'library_dataset': trans.app.model.LibraryDataset }
if item_type not in item_types:
- msg = 'Bad item_type specified: %s' % str( item_type )
- messagetype = 'error'
+ message = 'Bad item_type specified: %s' % str( item_type )
+ status = 'error'
else:
if item_type == 'library_dataset':
item_desc = 'Dataset'
@@ -187,18 +187,18 @@
library_item.deleted = True
trans.sa_session.add( library_item )
trans.sa_session.flush()
- msg = util.sanitize_text( "%s '%s' has been marked deleted" % ( item_desc, library_item.name ) )
- messagetype = 'done'
+ message = util.sanitize_text( "%s '%s' has been marked deleted" % ( item_desc, library_item.name ) )
+ status = 'done'
if item_type == 'library':
- return self.browse_libraries( trans, message=msg, status=messagetype )
+ return self.browse_libraries( trans, message=message, status=status )
else:
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller='library_admin',
id=library_id,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype ) )
+ message=message,
+ status=status ) )
@web.expose
@web.require_admin
def undelete_library_item( self, trans, library_id, item_id, item_type, **kwd ):
@@ -208,7 +208,7 @@
'folder': trans.app.model.LibraryFolder,
'library_dataset': trans.app.model.LibraryDataset }
if item_type not in item_types:
- msg = 'Bad item_type specified: %s' % str( item_type )
+ message = 'Bad item_type specified: %s' % str( item_type )
status = ERROR
else:
if item_type == 'library_dataset':
@@ -217,21 +217,21 @@
item_desc = item_type.capitalize()
library_item = trans.sa_session.query( item_types[ item_type ] ).get( trans.security.decode_id( item_id ) )
if library_item.purged:
- msg = '%s %s has been purged, so it cannot be undeleted' % ( item_desc, library_item.name )
+ message = '%s %s has been purged, so it cannot be undeleted' % ( item_desc, library_item.name )
status = ERROR
else:
library_item.deleted = False
trans.sa_session.add( library_item )
trans.sa_session.flush()
- msg = util.sanitize_text( "%s '%s' has been marked undeleted" % ( item_desc, library_item.name ) )
+ message = util.sanitize_text( "%s '%s' has been marked undeleted" % ( item_desc, library_item.name ) )
status = SUCCESS
if item_type == 'library':
- return self.browse_libraries( trans, message=msg, status=status )
+ return self.browse_libraries( trans, message=message, status=status )
else:
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller='library_admin',
id=library_id,
show_deleted=show_deleted,
- msg=msg,
- messagetype=status ) )
+ message=message,
+ status=status ) )
diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/library_common.py
--- a/lib/galaxy/web/controllers/library_common.py Fri Apr 02 15:09:29 2010 -0400
+++ b/lib/galaxy/web/controllers/library_common.py Fri Apr 02 16:06:43 2010 -0400
@@ -79,18 +79,18 @@
@web.expose
def browse_library( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
library_id = params.get( 'id', None )
if not library_id:
# To handle bots
- msg = "You must specify a library id."
- messagetype = 'error'
+ message = "You must specify a library id."
+ status = 'error'
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
if not library:
# To handle bots
- msg = "Invalid library id ( %s )." % str( library_id )
- messagetype = 'error'
+ message = "Invalid library id ( %s )." % str( library_id )
+ status = 'error'
else:
# If use_panels is True, the library is being accessed via an external link
# which did not originate from within the Galaxy instance, and the library will
@@ -100,12 +100,12 @@
created_ldda_ids = params.get( 'created_ldda_ids', '' )
hidden_folder_ids = util.listify( params.get( 'hidden_folder_ids', '' ) )
current_user_roles = trans.get_current_user_roles()
- if created_ldda_ids and not msg:
- msg = "%d datasets are uploading in the background to the library '%s' (each is selected). " % \
+ if created_ldda_ids and not message:
+ message = "%d datasets are uploading in the background to the library '%s' (each is selected). " % \
( len( created_ldda_ids.split( ',' ) ), library.name )
- msg += "Don't navigate away from Galaxy or use the browser's \"stop\" or \"reload\" buttons (on this tab) until the "
- msg += "message \"This job is running\" is cleared from the \"Information\" column below for each selected dataset."
- messagetype = "info"
+ message += "Don't navigate away from Galaxy or use the browser's \"stop\" or \"reload\" buttons (on this tab) until the "
+ message += "message \"This job is running\" is cleared from the \"Information\" column below for each selected dataset."
+ status = "info"
return trans.fill_template( '/library/common/browse_library.mako',
cntrller=cntrller,
use_panels=use_panels,
@@ -115,19 +115,19 @@
show_deleted=show_deleted,
comptypes=comptypes,
current_user_roles=current_user_roles,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
return trans.response.send_redirect( web.url_for( use_panels=use_panels,
controller=cntrller,
action='browse_libraries',
default_action=params.get( 'default_action', None ),
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
@web.expose
def library_info( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
library_id = params.get( 'id', None )
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
@@ -140,8 +140,8 @@
old_name = library.name
new_name = util.restore_text( params.get( 'name', 'No name' ) )
if not new_name:
- msg = 'Enter a valid name'
- messagetype='error'
+ message = 'Enter a valid name'
+ status='error'
else:
new_description = util.restore_text( params.get( 'description', '' ) )
new_synopsis = util.restore_text( params.get( 'synopsis', '' ) )
@@ -155,15 +155,15 @@
library.root_folder.description = new_description
trans.sa_session.add_all( ( library, library.root_folder ) )
trans.sa_session.flush()
- msg = "The information has been updated."
+ message = "The information has been updated."
return trans.response.send_redirect( web.url_for( controller='library_common',
action='library_info',
cntrller=cntrller,
use_panels=use_panels,
id=trans.security.encode_id( library.id ),
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
return trans.fill_template( '/library/common/library_info.mako',
cntrller=cntrller,
use_panels=use_panels,
@@ -173,13 +173,13 @@
show_deleted=show_deleted,
info_association=info_association,
inherited=inherited,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def library_permissions( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
library_id = params.get( 'id', None )
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
@@ -195,15 +195,15 @@
trans.sa_session.refresh( library )
# Copy the permissions to the root folder
trans.app.security_agent.copy_library_permissions( library, library.root_folder )
- msg = "Permissions updated for library '%s'" % library.name
+ message = "Permissions updated for library '%s'" % library.name
return trans.response.send_redirect( web.url_for( controller='library_common',
action='library_permissions',
cntrller=cntrller,
use_panels=use_panels,
id=trans.security.encode_id( library.id ),
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
roles = trans.app.security_agent.get_legitimate_roles( trans, library, cntrller )
return trans.fill_template( '/library/common/library_permissions.mako',
cntrller=cntrller,
@@ -212,26 +212,26 @@
current_user_roles=current_user_roles,
roles=roles,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def create_folder( self, trans, cntrller, parent_id, library_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
parent_folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( parent_id ) )
if not parent_folder:
- msg = "Invalid parent folder id (%s) specified" % str( parent_id )
+ message = "Invalid parent folder id (%s) specified" % str( parent_id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
if params.get( 'new_folder_button', False ):
new_folder = trans.app.model.LibraryFolder( name=util.restore_text( params.name ),
description=util.restore_text( params.description ) )
@@ -252,8 +252,8 @@
widgets = new_folder.get_template_widgets( trans )
if info_association:
current_user_roles = trans.get_current_user_roles()
- msg = "The new folder named '%s' has been added to the data library. " % new_folder.name
- msg += "Additional information about this folder may be added using the inherited template."
+ message = "The new folder named '%s' has been added to the data library. " % new_folder.name
+ message += "Additional information about this folder may be added using the inherited template."
return trans.fill_template( '/library/common/folder_info.mako',
cntrller=cntrller,
use_panels=use_panels,
@@ -264,18 +264,18 @@
show_deleted=show_deleted,
info_association=info_association,
inherited=inherited,
- msg=msg,
- messagetype='done' )
+ message=message,
+ status='done' )
# If not inheritable info_association, redirect to the library.
- msg = "The new folder named '%s' has been added to the data library." % new_folder.name
+ message = "The new folder named '%s' has been added to the data library." % new_folder.name
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
# We do not render any template widgets on creation pages since saving the info_association
# cannot occur before the associated item is saved.
return trans.fill_template( '/library/common/new_folder.mako',
@@ -284,13 +284,13 @@
library_id=library_id,
folder=parent_folder,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def folder_info( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( id ) )
@@ -306,18 +306,18 @@
new_name = util.restore_text( params.name )
new_description = util.restore_text( params.description )
if not new_name:
- msg = 'Enter a valid name'
- messagetype='error'
+ message = 'Enter a valid name'
+ status='error'
else:
folder.name = new_name
folder.description = new_description
trans.sa_session.add( folder )
trans.sa_session.flush()
- msg = "The information has been updated."
- messagetype='done'
+ message = "The information has been updated."
+ status='done'
else:
- msg = "You are not authorized to edit this folder"
- messagetype='error'
+ message = "You are not authorized to edit this folder"
+ status='error'
return trans.fill_template( '/library/common/folder_info.mako',
cntrller=cntrller,
use_panels=use_panels,
@@ -328,26 +328,26 @@
show_deleted=show_deleted,
info_association=info_association,
inherited=inherited,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def folder_permissions( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( id ) )
if not folder:
- msg = "Invalid folder specified, id: %s" % str( id )
+ message = "Invalid folder specified, id: %s" % str( id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
current_user_roles = trans.get_current_user_roles()
if params.get( 'update_roles_button', False ):
# The user clicked the Save button on the 'Associate With Roles' form
@@ -361,11 +361,11 @@
permissions[ trans.app.security_agent.get_action( v.action ) ] = in_roles
trans.app.security_agent.set_all_library_permissions( folder, permissions )
trans.sa_session.refresh( folder )
- msg = 'Permissions updated for folder %s' % folder.name
- messagetype='done'
+ message = 'Permissions updated for folder %s' % folder.name
+ status='done'
else:
- msg = "You are not authorized to manage permissions on this folder"
- messagetype = "error"
+ message = "You are not authorized to manage permissions on this folder"
+ status = "error"
return trans.response.send_redirect( web.url_for( controller='library_common',
action='folder_permissions',
cntrller=cntrller,
@@ -373,8 +373,8 @@
id=trans.security.encode_id( folder.id ),
library_id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
# If the library is public all roles are legitimate, but if the library is restricted, only those
# roles associated with the LIBRARY_ACCESS permission are legitimate.
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
@@ -387,26 +387,26 @@
current_user_roles=current_user_roles,
roles=roles,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def ldda_edit_info( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( id ) )
if not ldda:
- msg = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id )
+ message = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
dbkey = params.get( 'dbkey', '?' )
if isinstance( dbkey, list ):
dbkey = dbkey[0]
@@ -424,14 +424,14 @@
if ldda.datatype.allow_datatype_change and trans.app.datatypes_registry.get_datatype_by_extension( params.datatype ).allow_datatype_change:
trans.app.datatypes_registry.change_datatype( ldda, params.datatype )
trans.sa_session.flush()
- msg = "Data type changed for library dataset '%s'" % ldda.name
- messagetype = 'done'
+ message = "Data type changed for library dataset '%s'" % ldda.name
+ status = 'done'
else:
- msg = "You are unable to change datatypes in this manner. Changing %s to %s is not allowed." % ( ldda.extension, params.datatype )
- messagetype = 'error'
+ message = "You are unable to change datatypes in this manner. Changing %s to %s is not allowed." % ( ldda.extension, params.datatype )
+ status = 'error'
else:
- msg = "You are not authorized to change the data type of dataset '%s'" % ldda.name
- messagetype = 'error'
+ message = "You are not authorized to change the data type of dataset '%s'" % ldda.name
+ status = 'error'
elif params.get( 'save', False ):
# The user clicked the Save button on the 'Edit Attributes' form
if cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda ):
@@ -440,8 +440,8 @@
new_info = util.restore_text( params.get( 'info', '' ) )
new_message = util.restore_text( params.get( 'message', '' ) )
if not new_name:
- msg = 'Enter a valid name'
- messagetype = 'error'
+ message = 'Enter a valid name'
+ status = 'error'
else:
ldda.name = new_name
ldda.info = new_info
@@ -459,11 +459,11 @@
ldda.metadata.dbkey = dbkey
ldda.datatype.after_setting_metadata( ldda )
trans.sa_session.flush()
- msg = 'Attributes updated for library dataset %s' % ldda.name
- messagetype = 'done'
+ message = 'Attributes updated for library dataset %s' % ldda.name
+ status = 'done'
else:
- msg = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name
- messagetype = 'error'
+ message = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name
+ status = 'error'
elif params.get( 'detect', False ):
# The user clicked the Auto-detect button on the 'Edit Attributes' form
if cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda ):
@@ -475,11 +475,11 @@
ldda.datatype.set_meta( ldda )
ldda.datatype.after_setting_metadata( ldda )
trans.sa_session.flush()
- msg = 'Attributes updated for library dataset %s' % ldda.name
- messagetype = 'done'
+ message = 'Attributes updated for library dataset %s' % ldda.name
+ status = 'done'
else:
- msg = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name
- messagetype = 'error'
+ message = "You are not authorized to edit the attributes of dataset '%s'" % ldda.name
+ status = 'error'
if cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda ):
if "dbkey" in ldda.datatype.metadata_spec and not ldda.metadata.dbkey:
# Copy dbkey into metadata, for backwards compatability
@@ -499,26 +499,26 @@
show_deleted=show_deleted,
info_association=info_association,
inherited=inherited,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def ldda_info( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( id ) )
if not ldda:
- msg = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id )
+ message = "Invalid LibraryDatasetDatasetAssociation specified, id: %s" % str( id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
# See if we have any associated templates
widgets = []
@@ -536,13 +536,13 @@
current_user_roles=current_user_roles,
info_association=info_association,
inherited=inherited,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def ldda_permissions( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
ids = util.listify( id )
@@ -550,15 +550,15 @@
for id in [ trans.security.decode_id( id ) for id in ids ]:
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( id )
if ldda is None:
- msg = 'You specified an invalid LibraryDatasetDatasetAssociation id: %s' %str( id )
+ message = 'You specified an invalid LibraryDatasetDatasetAssociation id: %s' %str( id )
trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
lddas.append( ldda )
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
# If access to the dataset is restricted, then use the roles associated with the DATASET_ACCESS permission to
@@ -577,7 +577,7 @@
if cntrller=='library_admin' or ( trans.app.security_agent.can_manage_library_item( current_user_roles, ldda ) and \
trans.app.security_agent.can_manage_dataset( current_user_roles, ldda.dataset ) ):
a = trans.app.security_agent.get_action( trans.app.security_agent.permitted_actions.DATASET_ACCESS.action )
- permissions, in_roles, error, msg = \
+ permissions, in_roles, error, message = \
trans.app.security_agent.derive_roles_from_access( trans, trans.app.security.decode_id( library_id ), cntrller, library=True, **kwd )
for ldda in lddas:
# Set the DATASET permissions on the Dataset.
@@ -601,13 +601,13 @@
trans.app.security_agent.set_all_library_permissions( ldda, permissions )
trans.sa_session.refresh( ldda )
if error:
- messagetype = 'error'
+ status = 'error'
else:
- msg = 'Permissions have been updated on %d datasets.' % len( lddas )
- messagetype= 'done'
+ message = 'Permissions have been updated on %d datasets.' % len( lddas )
+ status= 'done'
else:
- msg = "You are not authorized to change the permissions of dataset '%s'" % ldda.name
- messagetype = 'error'
+ message = "You are not authorized to change the permissions of dataset '%s'" % ldda.name
+ status = 'error'
return trans.fill_template( "/library/common/ldda_permissions.mako",
cntrller=cntrller,
use_panels=use_panels,
@@ -615,8 +615,8 @@
library_id=library_id,
roles=roles,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
if len( ids ) > 1:
# Ensure that the permissions across all library items are identical, otherwise we can't update them together.
check_list = []
@@ -634,15 +634,15 @@
if not check_list:
check_list = permissions
if permissions != check_list:
- msg = 'The datasets you selected do not have identical permissions, so they can not be updated together'
+ message = 'The datasets you selected do not have identical permissions, so they can not be updated together'
trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
# Display permission form, permissions will be updated for all lddas simultaneously.
return trans.fill_template( "/library/common/ldda_permissions.mako",
cntrller=cntrller,
@@ -651,13 +651,13 @@
library_id=library_id,
roles=roles,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def upload_library_dataset( self, trans, cntrller, library_id, folder_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
deleted = util.string_as_bool( params.get( 'deleted', False ) )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
dbkey = params.get( 'dbkey', '?' )
@@ -694,10 +694,10 @@
error = None
if roles:
vars = dict( DATASET_ACCESS_in=roles )
- permissions, in_roles, error, msg = \
+ permissions, in_roles, error, message = \
trans.app.security_agent.derive_roles_from_access( trans, trans.app.security.decode_id( library_id ), cntrller, library=True, **vars )
if error:
- messagetype = 'error'
+ status = 'error'
trans.response.send_redirect( web.url_for( controller='library_common',
action='upload_library_dataset',
cntrller=cntrller,
@@ -706,8 +706,8 @@
replace_id=replace_id,
upload_option=upload_option,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
else:
# See if we have any inherited templates, but do not inherit contents.
@@ -731,16 +731,16 @@
ldda_id_list = [ str( v.id ) for k, v in created_outputs_dict.items() ]
created_ldda_ids=",".join( ldda_id_list )
if replace_dataset:
- msg = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset_name, folder.name )
+ message = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset_name, folder.name )
else:
if not folder.parent:
# Libraries have the same name as their root_folder
- msg = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name )
+ message = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name )
else:
- msg = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name )
+ message = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name )
if cntrller == 'library_admin':
- msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
- messagetype='done'
+ message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
+ status='done'
else:
# Since permissions on all LibraryDatasetDatasetAssociations must be the same at this point, we only need
# to check one of them to see if the current user can manage permissions on them.
@@ -749,7 +749,7 @@
if replace_dataset:
default_action = ''
else:
- msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
+ message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
default_action = 'manage_permissions'
else:
default_action = 'add'
@@ -760,21 +760,21 @@
default_action=default_action,
created_ldda_ids=created_ldda_ids,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
else:
created_ldda_ids = ''
- msg = "Upload failed"
- messagetype='error'
+ message = "Upload failed"
+ status='error'
trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
id=library_id,
created_ldda_ids=created_ldda_ids,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
# See if we have any inherited templates, but do not inherit contents.
info_association, inherited = folder.get_info_association( inherited=True )
if info_association and info_association.inheritable:
@@ -819,8 +819,8 @@
history=history,
widgets=widgets,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
def upload_dataset( self, trans, cntrller, library_id, folder_id, replace_dataset=None, **kwd ):
# Set up the traditional tool state/params
tool_id = 'upload1'
@@ -836,8 +836,8 @@
params = util.Params( kwd ) # is this filetoolparam safe?
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
library_bunch = upload_common.handle_library_params( trans, params, folder_id, replace_dataset )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
server_dir = util.restore_text( params.get( 'server_dir', '' ) )
if replace_dataset not in [ None, 'None' ]:
replace_id = trans.security.encode_id( replace_dataset.id )
@@ -860,21 +860,21 @@
else:
full_dir = os.path.join( import_dir, trans.user.email, server_dir )
if import_dir:
- msg = 'Select a directory'
+ message = 'Select a directory'
else:
- msg = '"%s" is not defined in the Galaxy configuration file' % import_dir_desc
+ message = '"%s" is not defined in the Galaxy configuration file' % import_dir_desc
# Proceed with (mostly) regular upload processing
precreated_datasets = upload_common.get_precreated_datasets( trans, tool_params, trans.app.model.LibraryDatasetDatasetAssociation, controller=cntrller )
if upload_option == 'upload_file':
tool_params = upload_common.persist_uploads( tool_params )
uploaded_datasets = upload_common.get_uploaded_datasets( trans, cntrller, tool_params, precreated_datasets, dataset_upload_inputs, library_bunch=library_bunch )
elif upload_option == 'upload_directory':
- uploaded_datasets, err_redirect, msg = self.get_server_dir_uploaded_datasets( trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, msg )
+ uploaded_datasets, err_redirect, message = self.get_server_dir_uploaded_datasets( trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, message )
elif upload_option == 'upload_paths':
- uploaded_datasets, err_redirect, msg = self.get_path_paste_uploaded_datasets( trans, cntrller, params, library_bunch, err_redirect, msg )
+ uploaded_datasets, err_redirect, message = self.get_path_paste_uploaded_datasets( trans, cntrller, params, library_bunch, err_redirect, message )
upload_common.cleanup_unused_precreated_datasets( precreated_datasets )
if upload_option == 'upload_file' and not uploaded_datasets:
- msg = 'Select a file, enter a URL or enter text'
+ message = 'Select a file, enter a URL or enter text'
err_redirect = True
if err_redirect:
trans.response.send_redirect( web.url_for( controller='library_common',
@@ -885,8 +885,8 @@
replace_id=replace_id,
upload_option=upload_option,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
json_file_path = upload_common.create_paramfile( trans, uploaded_datasets )
data_list = [ ud.data for ud in uploaded_datasets ]
return upload_common.create_job( trans, tool_params, tool, json_file_path, data_list, folder=library_bunch.folder )
@@ -909,7 +909,7 @@
trans.sa_session.add( uploaded_dataset.data )
trans.sa_session.flush()
return uploaded_dataset
- def get_server_dir_uploaded_datasets( self, trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, msg ):
+ def get_server_dir_uploaded_datasets( self, trans, cntrller, params, full_dir, import_dir_desc, library_bunch, err_redirect, message ):
files = []
try:
for entry in os.listdir( full_dir ):
@@ -925,23 +925,23 @@
if os.path.isfile( path ):
files.append( path )
except Exception, e:
- msg = "Unable to get file list for configured %s, error: %s" % ( import_dir_desc, str( e ) )
+ message = "Unable to get file list for configured %s, error: %s" % ( import_dir_desc, str( e ) )
err_redirect = True
- return None, err_redirect, msg
+ return None, err_redirect, message
if not files:
- msg = "The directory '%s' contains no valid files" % full_dir
+ message = "The directory '%s' contains no valid files" % full_dir
err_redirect = True
- return None, err_redirect, msg
+ return None, err_redirect, message
uploaded_datasets = []
for file in files:
name = os.path.basename( file )
uploaded_datasets.append( self.make_library_uploaded_dataset( trans, cntrller, params, name, file, 'server_dir', library_bunch ) )
return uploaded_datasets, None, None
- def get_path_paste_uploaded_datasets( self, trans, cntrller, params, library_bunch, err_redirect, msg ):
+ def get_path_paste_uploaded_datasets( self, trans, cntrller, params, library_bunch, err_redirect, message ):
if params.get( 'filesystem_paths', '' ) == '':
- msg = "No paths entered in the upload form"
+ message = "No paths entered in the upload form"
err_redirect = True
- return None, err_redirect, msg
+ return None, err_redirect, message
preserve_dirs = True
if params.get( 'dont_preserve_dirs', False ):
preserve_dirs = False
@@ -974,16 +974,16 @@
library_bunch,
in_folder ) )
if bad_paths:
- msg = "Invalid paths:<br><ul><li>%s</li></ul>" % "</li><li>".join( bad_paths )
+ message = "Invalid paths:<br><ul><li>%s</li></ul>" % "</li><li>".join( bad_paths )
err_redirect = True
- return None, err_redirect, msg
+ return None, err_redirect, message
return uploaded_datasets, None, None
@web.expose
def add_history_datasets_to_library( self, trans, cntrller, library_id, folder_id, hda_ids='', **kwd ):
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
folder = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( folder_id ) )
replace_id = params.get( 'replace_id', None )
if replace_id:
@@ -994,14 +994,14 @@
history = trans.get_history()
trans.sa_session.refresh( history )
if not history.active_datasets:
- msg = 'Your current history is empty'
+ message = 'Your current history is empty'
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
if params.get( 'add_history_datasets_to_library_button', False ):
hda_ids = util.listify( hda_ids )
if hda_ids:
@@ -1021,28 +1021,28 @@
# Permissions must be the same on the LibraryDatasetDatasetAssociation and the associated LibraryDataset
trans.app.security_agent.copy_library_permissions( ldda.library_dataset, ldda )
else:
- msg = "The requested HistoryDatasetAssociation id %s is invalid" % str( hda_id )
+ message = "The requested HistoryDatasetAssociation id %s is invalid" % str( hda_id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
if created_ldda_ids:
created_ldda_ids = created_ldda_ids.lstrip( ',' )
ldda_id_list = created_ldda_ids.split( ',' )
total_added = len( ldda_id_list )
if replace_dataset:
- msg = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset.name, folder.name )
+ message = "Added %d dataset versions to the library dataset '%s' in the folder '%s'." % ( total_added, replace_dataset.name, folder.name )
else:
if not folder.parent:
# Libraries have the same name as their root_folder
- msg = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name )
+ message = "Added %d datasets to the library '%s' (each is selected). " % ( total_added, folder.name )
else:
- msg = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name )
+ message = "Added %d datasets to the folder '%s' (each is selected). " % ( total_added, folder.name )
if cntrller == 'library_admin':
- msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
+ message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
else:
# Since permissions on all LibraryDatasetDatasetAssociations must be the same at this point, we only need
# to check one of them to see if the current user can manage permissions on them.
@@ -1052,7 +1052,7 @@
if replace_dataset:
default_action = ''
else:
- msg += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
+ message += "Click the Go button at the bottom of this page to edit the permissions on these datasets if necessary."
default_action = 'manage_permissions'
else:
default_action = 'add'
@@ -1062,11 +1062,11 @@
id=library_id,
created_ldda_ids=created_ldda_ids,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
else:
- msg = 'Select at least one dataset from the list of active datasets in your current history'
- messagetype = 'error'
+ message = 'Select at least one dataset from the list of active datasets in your current history'
+ status = 'error'
last_used_build = folder.genome_build
upload_option = params.get( 'upload_option', 'import_from_history' )
# Send list of data formats to the form so the "extension" select list can be populated dynamically
@@ -1091,8 +1091,8 @@
history=history,
widgets=[],
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def download_dataset_from_folder( self, trans, cntrller, id, library_id=None, **kwd ):
"""Catches the dataset id and displays file contents as directed"""
@@ -1101,8 +1101,8 @@
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( id ) )
if not ldda.dataset:
- msg = 'Invalid LibraryDatasetDatasetAssociation id %s received for file download' % str( id )
- messagetype = 'error'
+ message = 'Invalid LibraryDatasetDatasetAssociation id %s received for file download' % str( id )
+ status = 'error'
else:
composite_extensions = trans.app.datatypes_registry.get_composite_extensions( )
ext = ldda.extension
@@ -1123,33 +1123,33 @@
try:
return open( ldda.file_name )
except:
- msg = 'This dataset contains no content'
+ message = 'This dataset contains no content'
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
@web.expose
def library_dataset_info( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
library_dataset = trans.sa_session.query( trans.app.model.LibraryDataset ).get( trans.security.decode_id( id ) )
if not library_dataset:
- msg = "Invalid library dataset specified, id: %s" %str( id )
+ message = "Invalid library dataset specified, id: %s" %str( id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
current_user_roles = trans.get_current_user_roles()
# See if we have any associated templates
widgets = []
@@ -1163,18 +1163,18 @@
new_name = util.restore_text( params.get( 'name', '' ) )
new_info = util.restore_text( params.get( 'info', '' ) )
if not new_name:
- msg = 'Enter a valid name'
- messagetype = 'error'
+ message = 'Enter a valid name'
+ status = 'error'
else:
library_dataset.name = new_name
library_dataset.info = new_info
trans.sa_session.add( library_dataset )
trans.sa_session.flush()
- msg = "The information has been updated."
- messagetype = 'done'
+ message = "The information has been updated."
+ status = 'done'
else:
- msg = "You are not authorized to change the attributes of this dataset"
- messagetype = "error"
+ message = "You are not authorized to change the attributes of this dataset"
+ status = "error"
return trans.fill_template( '/library/common/library_dataset_info.mako',
cntrller=cntrller,
use_panels=use_panels,
@@ -1185,26 +1185,26 @@
inherited=inherited,
widgets=widgets,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def library_dataset_permissions( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
library_dataset = trans.sa_session.query( trans.app.model.LibraryDataset ).get( id )
if not library_dataset:
- msg = "Invalid library dataset specified, id: %s" %str( id )
+ message = "Invalid library dataset specified, id: %s" %str( id )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
current_user_roles = trans.get_current_user_roles()
if params.get( 'update_roles_button', False ):
if cntrller == 'library_admin' or trans.app.security_agent.can_manage_library_item( current_user_roles, library_dataset ):
@@ -1223,11 +1223,11 @@
# Set the LIBRARY permissions on the LibraryDatasetDatasetAssociation
trans.app.security_agent.set_all_library_permissions( library_dataset.library_dataset_dataset_association, permissions )
trans.sa_session.refresh( library_dataset.library_dataset_dataset_association )
- msg = 'Permissions and roles have been updated for library dataset %s' % library_dataset.name
- messagetype = 'done'
+ message = 'Permissions and roles have been updated for library dataset %s' % library_dataset.name
+ status = 'done'
else:
- msg = "You are not authorized to managed the permissions of this dataset"
- messagetype = "error"
+ message = "You are not authorized to managed the permissions of this dataset"
+ status = "error"
library = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) )
roles = trans.app.security_agent.get_legitimate_roles( trans, library, cntrller )
return trans.fill_template( '/library/common/library_dataset_permissions.mako',
@@ -1238,53 +1238,53 @@
roles=roles,
current_user_roles=current_user_roles,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def act_on_multiple_datasets( self, trans, cntrller, library_id, ldda_ids='', **kwd ):
# Perform an action on a list of library datasets.
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
action = params.get( 'do_action', None )
if not ldda_ids:
- msg = "You must select at least one dataset"
- messagetype = 'error'
+ message = "You must select at least one dataset"
+ status = 'error'
elif not action:
- msg = "You must select an action to perform on selected datasets"
- messagetype = 'error'
+ message = "You must select an action to perform on selected datasets"
+ status = 'error'
else:
ldda_ids = util.listify( ldda_ids )
if action == 'import_to_history' or action == 'add':
history = trans.get_history()
if history is None:
# Must be a bot sending a request without having a history.
- msg = "You do not have a current history"
+ message = "You do not have a current history"
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
total_imported_lddas = 0
- msg = ''
- messagetype = 'done'
+ message = ''
+ status = 'done'
for ldda_id in ldda_ids:
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_id ) )
if ldda.dataset.state in [ 'new', 'upload', 'queued', 'running', 'empty', 'discarded' ]:
- msg += "Cannot import dataset (%s) since it's state is (%s). " % ( ldda.name, ldda.dataset.state )
- messagetype = 'error'
+ message += "Cannot import dataset (%s) since it's state is (%s). " % ( ldda.name, ldda.dataset.state )
+ status = 'error'
elif ldda.dataset.state in [ 'ok', 'error' ]:
hda = ldda.to_history_dataset_association( target_history=history, add_to_history=True )
total_imported_lddas += 1
if total_imported_lddas:
trans.sa_session.add( history )
trans.sa_session.flush()
- msg += "%i dataset(s) have been imported into your history. " % total_imported_lddas
+ message += "%i dataset(s) have been imported into your history. " % total_imported_lddas
elif action == 'manage_permissions':
# We need the folder containing the LibraryDatasetDatasetAssociation(s)
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_ids[0] ) )
@@ -1296,8 +1296,8 @@
folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ),
id=",".join( ldda_ids ),
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
elif action == 'delete':
for ldda_id in ldda_ids:
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_id ) )
@@ -1307,7 +1307,7 @@
ld.deleted = True
trans.sa_session.add( ld )
trans.sa_session.flush()
- msg = "The selected datasets have been removed from this data library"
+ message = "The selected datasets have been removed from this data library"
elif action in ['zip','tgz','tbz']:
error = False
killme = string.punctuation + string.whitespace
@@ -1332,13 +1332,13 @@
except (OSError, zipfile.BadZipFile):
error = True
log.exception( "Unable to create archive for download" )
- msg = "Unable to create archive for download, please report this error"
- messagetype = 'error'
+ message = "Unable to create archive for download, please report this error"
+ status = 'error'
except:
error = True
log.exception( "Unexpected error %s in create archive for download" % sys.exc_info()[0])
- msg = "Unable to create archive for download, please report - %s" % sys.exc_info()[0]
- messagetype = 'error'
+ message = "Unable to create archive for download, please report - %s" % sys.exc_info()[0]
+ status = 'error'
if not error:
composite_extensions = trans.app.datatypes_registry.get_composite_extensions( )
seen = []
@@ -1374,8 +1374,8 @@
except IOError:
error = True
log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name)
- msg = "Unable to create archive for download, please report this error"
- messagetype = 'error'
+ message = "Unable to create archive for download, please report this error"
+ status = 'error'
continue
flist = glob.glob(os.path.join(ldda.dataset.extra_files_path,'*.*')) # glob returns full paths
for fpath in flist:
@@ -1387,8 +1387,8 @@
except IOError:
error = True
log.exception( "Unable to add %s to temporary library download archive %s" % (fname,outfname))
- msg = "Unable to create archive for download, please report this error"
- messagetype = 'error'
+ message = "Unable to create archive for download, please report this error"
+ status = 'error'
continue
else: # simple case
try:
@@ -1396,8 +1396,8 @@
except IOError:
error = True
log.exception( "Unable to write %s to temporary library download archive" % ldda.dataset.file_name)
- msg = "Unable to create archive for download, please report this error"
- messagetype = 'error'
+ message = "Unable to create archive for download, please report this error"
+ status = 'error'
if not error:
if action == 'zip':
archive.close()
@@ -1409,8 +1409,8 @@
except OSError:
error = True
log.exception( "Unable to remove temporary library download archive and directory" )
- msg = "Unable to create archive for download, please report this error"
- messagetype = 'error'
+ message = "Unable to create archive for download, please report this error"
+ status = 'error'
if not error:
trans.response.set_content_type( "application/x-zip-compressed" )
trans.response.headers[ "Content-Disposition" ] = "attachment; filename=%s.%s" % (outfname,outext)
@@ -1422,7 +1422,7 @@
archive.wsgi_headeritems = trans.response.wsgi_headeritems()
return archive.stream
else: # unknown action
- msg = '### unknown action = %s in act_on_multiple_datasets' % action
+ message = '### unknown action = %s in act_on_multiple_datasets' % action
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
@@ -1430,8 +1430,8 @@
use_panels=use_panels,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
def get_item_and_stuff( self, trans, item_type, library_id, folder_id, ldda_id ):
# Return an item, description, action and an id based on the item_type.
if item_type == 'library':
@@ -1450,14 +1450,14 @@
action = 'ldda_edit_info'
id = ldda_id
else:
- msg = "Invalid library item type ( %s )" % str( item_type )
+ message = "Invalid library item type ( %s )" % str( item_type )
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
id=library_id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='error' ) )
+ message=util.sanitize_text( message ),
+ status='error' ) )
return item, item_desc, action, id
@web.expose
def add_template( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, **kwd ):
@@ -1466,19 +1466,19 @@
filter=dict( deleted=False ),
form_type=trans.app.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE )
if not forms:
- msg = "There are no forms on which to base the template, so create a form and then add the template."
+ message = "There are no forms on which to base the template, so create a form and then add the template."
trans.response.send_redirect( web.url_for( controller='forms',
action='new',
- msg=msg,
- messagetype='done',
+ message=message,
+ status='done',
form_type=trans.app.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE ) )
else:
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
+ message = util.restore_text( params.get( 'message', '' ) )
action = ''
- messagetype = params.get( 'messagetype', 'done' )
+ status = params.get( 'status', 'done' )
item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id )
# If the inheritable checkbox is checked, the param will be in the request
inheritable = CheckboxField.is_checked( params.get( 'inheritable', '' ) )
@@ -1497,7 +1497,7 @@
assoc = trans.app.model.LibraryDatasetDatasetInfoAssociation( item, form, form_values )
trans.sa_session.add( assoc )
trans.sa_session.flush()
- msg = 'A template based on the form "%s" has been added to this %s.' % ( form.name, item_desc )
+ message = 'A template based on the form "%s" has been added to this %s.' % ( form.name, item_desc )
trans.response.send_redirect( web.url_for( controller='library_common',
action=action,
cntrller=cntrller,
@@ -1506,11 +1506,11 @@
folder_id=folder_id,
id=id,
show_deleted=show_deleted,
- msg=msg,
- messagetype='done' ) )
+ message=message,
+ status='done' ) )
else:
- msg = "Select a form on which to base the template."
- messagetype = "error"
+ message = "Select a form on which to base the template."
+ status = "error"
def generate_template_stuff( trans, forms, form_id ):
# Returns the following:
# - a list of template ids
@@ -1555,22 +1555,22 @@
template_select_list=template_select_list,
inheritable_checked=inheritable,
show_deleted=show_deleted,
- msg=msg,
- messagetype=messagetype )
+ message=message,
+ status=status )
@web.expose
def manage_template_inheritance( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, **kwd ):
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id )
info_association, inherited = item.get_info_association( restrict=True )
if info_association:
if info_association.inheritable:
- msg = "The template for this %s will no longer be inherited to contained folders and datasets." % item_desc
+ message = "The template for this %s will no longer be inherited to contained folders and datasets." % item_desc
else:
- msg = "The template for this %s will now be inherited to contained folders and datasets." % item_desc
+ message = "The template for this %s will now be inherited to contained folders and datasets." % item_desc
info_association.inheritable = not( info_association.inheritable )
trans.sa_session.add( info_association )
trans.sa_session.flush()
@@ -1582,16 +1582,16 @@
folder_id=folder_id,
id=id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
@web.expose
def edit_template( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, edited=False, **kwd ):
# Edit the template itself, keeping existing field contents, if any.
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id )
# An info_association must exist at this point
info_association, inherited = item.get_info_association( restrict=True )
@@ -1605,7 +1605,7 @@
info_association.template = fdc.latest_form
trans.sa_session.add( info_association )
trans.sa_session.flush()
- msg = "The template for this %s has been updated with your changes." % item_desc
+ message = "The template for this %s has been updated with your changes." % item_desc
return trans.response.send_redirect( web.url_for( controller='library_common',
action=action,
cntrller=cntrller,
@@ -1614,8 +1614,8 @@
folder_id=folder_id,
id=id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
# "template" is a FormDefinition, so since we're changing it, we need to use the latest version of it.
vars = dict( id=trans.security.encode_id( template.form_definition_current_id ),
response_redirect=web.url_for( controller='library_common',
@@ -1634,8 +1634,8 @@
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id )
# Save updated template field contents
field_contents = []
@@ -1681,7 +1681,7 @@
info_association = trans.app.model.LibraryDatasetDatasetInfoAssociation( item, template, form_values )
trans.sa_session.add( info_association )
trans.sa_session.flush()
- msg = 'The information has been updated.'
+ message = 'The information has been updated.'
return trans.response.send_redirect( web.url_for( controller='library_common',
action=action,
cntrller=cntrller,
@@ -1690,8 +1690,8 @@
folder_id=folder_id,
id=id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype='done' ) )
+ message=util.sanitize_text( message ),
+ status='done' ) )
@web.expose
def delete_template( self, trans, cntrller, item_type, library_id, id=None, folder_id=None, ldda_id=None, **kwd ):
# Only adding a new template to a library or folder is currently allowed. Editing an existing template is
@@ -1699,19 +1699,19 @@
params = util.Params( kwd )
show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) )
use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
item, item_desc, action, id = self.get_item_and_stuff( trans, item_type, library_id, folder_id, ldda_id )
info_association, inherited = item.get_info_association()
if not info_association:
- msg = "There is no template for this %s" % item_type
- messagetype = 'error'
+ message = "There is no template for this %s" % item_type
+ status = 'error'
else:
info_association.deleted = True
trans.sa_session.add( info_association )
trans.sa_session.flush()
- msg = 'The template for this %s has been deleted.' % item_type
- messagetype = 'done'
+ message = 'The template for this %s has been deleted.' % item_type
+ status = 'done'
return trans.response.send_redirect( web.url_for( controller='library_common',
action=action,
cntrller=cntrller,
@@ -1720,8 +1720,8 @@
folder_id=folder_id,
id=id,
show_deleted=show_deleted,
- msg=util.sanitize_text( msg ),
- messagetype=messagetype ) )
+ message=util.sanitize_text( message ),
+ status=status ) )
# ---- Utility methods -------------------------------------------------------
diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/requests.py
--- a/lib/galaxy/web/controllers/requests.py Fri Apr 02 15:09:29 2010 -0400
+++ b/lib/galaxy/web/controllers/requests.py Fri Apr 02 16:06:43 2010 -0400
@@ -164,7 +164,7 @@
elif operation == "events":
return self.__request_events( trans, **kwd )
# if there are one or more requests that has been rejected by the admin
- # recently, then show a msg as a reminder to the user
+ # recently, then show a message as a reminder to the user
rlist = trans.sa_session.query( trans.app.model.Request ) \
.filter( trans.app.model.Request.table.c.deleted==False ) \
.filter( trans.app.model.Request.table.c.user_id==trans.user.id )
@@ -182,12 +182,12 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
events_list = []
all_events = request.events
@@ -238,8 +238,8 @@
return request_details
def __show_request(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
add_sample = params.get('add_sample', False)
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
@@ -279,7 +279,7 @@
current_samples=current_samples,
sample_copy=self.__copy_sample(current_samples),
details='hide', edit_mode=util.restore_text( params.get( 'edit_mode', 'False' ) ),
- msg=msg, messagetype=messagetype )
+ message=message, status=status )
def __library_widgets(self, trans, user, sample_index, libraries, sample=None, **kwd):
'''
This method creates the data library & folder selectbox for creating &
@@ -424,8 +424,8 @@
@web.require_login( "create/submit sequencing requests" )
def show_request(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', None ) ) )
except:
@@ -503,28 +503,28 @@
edit_mode=edit_mode)
elif params.get('save_samples_button', False) == 'Save':
# check for duplicate sample names
- msg = ''
+ message = ''
for index in range(len(current_samples)-len(request.samples)):
sample_index = index + len(request.samples)
sample_name = current_samples[sample_index]['name']
if not sample_name.strip():
- msg = 'Please enter the name of sample number %i' % sample_index
+ message = 'Please enter the name of sample number %i' % sample_index
break
count = 0
for i in range(len(current_samples)):
if sample_name == current_samples[i]['name']:
count = count + 1
if count > 1:
- msg = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name)
+ message = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name)
break
- if msg:
+ if message:
return trans.fill_template( '/requests/show_request.mako',
request=request,
request_details=self.request_details(trans, request.id),
current_samples = current_samples,
sample_copy=self.__copy_sample(current_samples),
details=details, edit_mode=edit_mode,
- messagetype='error', msg=msg)
+ status='error', message=message)
# save all the new/unsaved samples entered by the user
if edit_mode == 'False':
for index in range(len(current_samples)-len(request.samples)):
@@ -542,18 +542,18 @@
trans.sa_session.add( s )
trans.sa_session.flush()
else:
- messagetype = 'done'
- msg = 'Changes made to the sample(s) are saved. '
+ status = 'done'
+ message = 'Changes made to the sample(s) are saved. '
for sample_index in range(len(current_samples)):
sample = request.samples[sample_index]
sample.name = current_samples[sample_index]['name']
sample.library = current_samples[sample_index]['library']
sample.folder = current_samples[sample_index]['folder']
if request.submitted():
- bc_msg = self.__validate_barcode(trans, sample, current_samples[sample_index]['barcode'])
- if bc_msg:
- messagetype = 'error'
- msg += bc_msg
+ bc_message = self.__validate_barcode(trans, sample, current_samples[sample_index]['barcode'])
+ if bc_message:
+ status = 'error'
+ message += bc_message
else:
sample.bar_code = current_samples[sample_index]['barcode']
trans.sa_session.add( sample )
@@ -566,8 +566,8 @@
action='list',
operation='show_request',
id=trans.security.encode_id(request.id),
- messagetype=messagetype,
- msg=msg ))
+ status=status,
+ message=message ))
elif params.get('edit_samples_button', False) == 'Edit samples':
edit_mode = 'True'
return trans.fill_template( '/requests/show_request.mako',
@@ -589,15 +589,15 @@
current_samples=current_samples,
sample_copy=self.__copy_sample(current_samples),
details=details, libraries=libraries,
- edit_mode=edit_mode, messagetype=messagetype, msg=msg)
+ edit_mode=edit_mode, status=status, message=message)
@web.expose
@web.require_login( "create/submit sequencing requests" )
def delete_sample(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', 0 ) ) )
current_samples, details, edit_mode = self.__update_samples( request, **kwd )
sample_index = int(params.get('sample_id', 0))
@@ -639,34 +639,34 @@
@web.require_login( "create/submit sequencing requests" )
def new(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
if params.get('select_request_type', False) == 'True':
return trans.fill_template( '/requests/new_request.mako',
select_request_type=self.__select_request_type(trans, 'none'),
widgets=[],
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
elif params.get('create', False) == 'True':
if params.get('create_request_button', False) == 'Save' \
or params.get('create_request_samples_button', False) == 'Add samples':
request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) )
if not util.restore_text(params.get('name', '')):
- msg = 'Please enter the <b>Name</b> of the request'
+ message = 'Please enter the <b>Name</b> of the request'
kwd['create'] = 'True'
- kwd['messagetype'] = 'error'
- kwd['msg'] = msg
+ kwd['status'] = 'error'
+ kwd['message'] = message
kwd['create_request_button'] = None
kwd['create_request_samples_button'] = None
return trans.response.send_redirect( web.url_for( controller='requests',
action='new',
**kwd) )
request = self.__save_request(trans, None, **kwd)
- msg = 'The new request named <b>%s</b> has been created' % request.name
+ message = 'The new request named <b>%s</b> has been created' % request.name
if params.get('create_request_button', False) == 'Save':
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
- message=msg ,
+ message=message ,
status='done') )
elif params.get('create_request_samples_button', False) == 'Add samples':
new_kwd = {}
@@ -675,8 +675,8 @@
new_kwd['add_sample'] = True
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
- msg=msg ,
- messagetype='done',
+ message=message ,
+ status='done',
**new_kwd) )
else:
return self.__show_request_form(trans, **kwd)
@@ -684,16 +684,16 @@
return self.__show_request_form(trans, **kwd)
def __show_request_form(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) )
except:
return trans.fill_template( '/requests/new_request.mako',
select_request_type=self.__select_request_type(trans, 'none'),
widgets=[],
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
form_values = None
select_request_type = self.__select_request_type(trans, request_type.id)
# list of widgets to be rendered on the request form
@@ -711,8 +711,8 @@
select_request_type=select_request_type,
request_type=request_type,
widgets=widgets,
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
def __validate(self, trans, request):
'''
Validates the request entered by the user
@@ -723,14 +723,14 @@
if field['required'] == 'required' and request.values.content[index] in ['', None]:
empty_fields.append(field['label'])
if empty_fields:
- msg = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
+ message = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
for ef in empty_fields:
- msg = msg + '<b>' +ef + '</b><br/>'
+ message = message + '<b>' +ef + '</b><br/>'
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
operation='edit',
- messagetype = 'error',
- msg=msg,
+ status = 'error',
+ message=message,
id=trans.security.encode_id(request.id) ))
# now check the required fields of all the samples of this request
for s in request.samples:
@@ -738,14 +738,14 @@
if field['required'] == 'required' and s.values.content[index] in ['', None]:
empty_fields.append((s.name, field['label']))
if empty_fields:
- msg = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
+ message = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
for sname, ef in empty_fields:
- msg = msg + '<b>%s</b> field of sample <b>%s</b><br/>' % (ef, sname)
+ message = message + '<b>%s</b> field of sample <b>%s</b><br/>' % (ef, sname)
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
operation='show_request',
- messagetype = 'error',
- msg=msg,
+ status = 'error',
+ message=message,
id=trans.security.encode_id(request.id) ))
def __save_request(self, trans, request=None, **kwd):
'''
@@ -823,8 +823,8 @@
@web.require_login( "create/submit sequencing requests" )
def edit(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', None ) ) )
except:
@@ -839,19 +839,19 @@
or params.get('edit_samples_button', False) == 'Edit samples':
request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) )
if not util.restore_text(params.get('name', '')):
- msg = 'Please enter the <b>Name</b> of the request'
- kwd['messagetype'] = 'error'
- kwd['msg'] = msg
+ message = 'Please enter the <b>Name</b> of the request'
+ kwd['status'] = 'error'
+ kwd['message'] = message
kwd['show'] = 'True'
return trans.response.send_redirect( web.url_for( controller='requests',
action='edit',
**kwd) )
request = self.__save_request(trans, request, **kwd)
- msg = 'The changes made to the request named %s has been saved' % request.name
+ message = 'The changes made to the request named %s has been saved' % request.name
if params.get('save_changes_request_button', False) == 'Save changes':
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
- message=msg ,
+ message=message ,
status='done') )
elif params.get('edit_samples_button', False) == 'Edit samples':
new_kwd = {}
@@ -859,8 +859,8 @@
new_kwd['edit_samples_button'] = 'Edit samples'
return trans.response.send_redirect( web.url_for( controller='requests',
action='show_request',
- msg=msg ,
- messagetype='done',
+ message=message ,
+ status='done',
**new_kwd) )
elif params.get('refresh', False) == 'true':
return self.__edit_request(trans, id=trans.security.encode_id(request.id), **kwd)
@@ -869,15 +869,15 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg) )
+ message=message) )
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
select_request_type = self.__select_request_type(trans, request.type.id)
# list of widgets to be rendered on the request form
widgets = []
@@ -901,8 +901,8 @@
request_type=request.type,
request=request,
widgets=widgets,
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
return self.__show_request_form(trans)
def __delete_request(self, trans, **kwd):
id_list = util.listify( kwd['id'] )
@@ -911,12 +911,12 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
# a request cannot be deleted once its submitted
if not request.new():
@@ -926,28 +926,28 @@
trans.sa_session.add( request )
trans.sa_session.flush()
if not len(delete_failed):
- msg = '%i request(s) has been deleted.' % len(id_list)
+ message = '%i request(s) has been deleted.' % len(id_list)
status = 'done'
else:
- msg = '%i request(s) has been deleted. %i request %s could not be deleted as they have been submitted.' % (len(id_list)-len(delete_failed),
+ message = '%i request(s) has been deleted. %i request %s could not be deleted as they have been submitted.' % (len(id_list)-len(delete_failed),
len(delete_failed), str(delete_failed))
status = 'warning'
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status=status,
- message=msg) )
+ message=message) )
def __undelete_request(self, trans, **kwd):
id_list = util.listify( kwd['id'] )
for id in id_list:
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
request.deleted = False
trans.sa_session.add( request )
@@ -960,12 +960,12 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
# check if all the required request and its sample fields have been filled
self.__validate(trans, request)
@@ -994,11 +994,11 @@
sample_id = int(params.get('sample_id', False))
sample = trans.sa_session.query( trans.app.model.Sample ).get( sample_id )
except:
- msg = "Invalid sample ID"
+ message = "Invalid sample ID"
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
events_list = []
all_events = sample.events
@@ -1015,8 +1015,8 @@
@web.require_login( "create/submit sequencing requests" )
def show_datatx_page( self, trans, **kwd ):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
sample = trans.sa_session.query( trans.app.model.Sample ).get( trans.security.decode_id( kwd['sample_id'] ) )
except:
diff -r 43b7a7f4bff5 -r f2b6d4f3189c lib/galaxy/web/controllers/requests_admin.py
--- a/lib/galaxy/web/controllers/requests_admin.py Fri Apr 02 15:09:29 2010 -0400
+++ b/lib/galaxy/web/controllers/requests_admin.py Fri Apr 02 16:06:43 2010 -0400
@@ -289,8 +289,8 @@
@web.require_admin
def edit(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', None ) ) )
except:
@@ -305,19 +305,19 @@
or params.get('edit_samples_button', False) == 'Edit samples':
request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) )
if not util.restore_text(params.get('name', '')):
- msg = 'Please enter the <b>Name</b> of the request'
- kwd['messagetype'] = 'error'
- kwd['msg'] = msg
+ message = 'Please enter the <b>Name</b> of the request'
+ kwd['status'] = 'error'
+ kwd['message'] = message
kwd['show'] = 'True'
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='edit',
**kwd) )
request = self.__save_request(trans, request, **kwd)
- msg = 'The changes made to the request named %s has been saved' % request.name
+ message = 'The changes made to the request named %s has been saved' % request.name
if params.get('save_changes_request_button', False) == 'Save changes':
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
- message=msg ,
+ message=message ,
status='done') )
elif params.get('edit_samples_button', False) == 'Edit samples':
new_kwd = {}
@@ -325,8 +325,8 @@
new_kwd['edit_samples_button'] = 'Edit samples'
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='show_request',
- msg=msg ,
- messagetype='done',
+ message=message ,
+ status='done',
**new_kwd) )
elif params.get('refresh', False) == 'true':
return self.__edit_request(trans, id=trans.security.encode_id(request.id), **kwd)
@@ -335,15 +335,15 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg) )
+ message=message) )
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
select_request_type = self.__select_request_type(trans, request.type.id)
# list of widgets to be rendered on the request form
widgets = []
@@ -367,8 +367,8 @@
request_type=request.type,
request=request,
widgets=widgets,
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
return self.__show_request_form(trans)
def __delete_request(self, trans, **kwd):
id_list = util.listify( kwd['id'] )
@@ -376,34 +376,34 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
request.deleted = True
trans.sa_session.add( request )
trans.sa_session.flush()
- msg = '%i request(s) has been deleted.' % len(id_list)
+ message = '%i request(s) has been deleted.' % len(id_list)
status = 'done'
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status=status,
- message=msg) )
+ message=message) )
def __undelete_request(self, trans, **kwd):
id_list = util.listify( kwd['id'] )
for id in id_list:
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(id) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
request.deleted = False
trans.sa_session.add( request )
@@ -416,20 +416,20 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
- msg = self.__validate(trans, request)
- if msg:
+ message = self.__validate(trans, request)
+ if message:
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
operation='edit',
- messagetype = 'error',
- msg=msg,
+ status = 'error',
+ message=message,
id=trans.security.encode_id(request.id) ) )
# change the request state to 'Submitted'
if request.user.email is not trans.user:
@@ -456,12 +456,12 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
return trans.fill_template( '/admin/requests/reject.mako',
request=request)
@@ -477,18 +477,18 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
# validate
if not params.get('comment', ''):
return trans.fill_template( '/admin/requests/reject.mako',
- request=request, messagetype='error',
- msg='A comment is required for rejecting a request.')
+ request=request, status='error',
+ message='A comment is required for rejecting a request.')
# create an event with state 'Rejected' for this request
comments = util.restore_text( params.comment )
event = trans.app.model.RequestEvent(request, request.states.REJECTED, comments)
@@ -503,12 +503,12 @@
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
except:
- msg = "Invalid request ID"
- log.warn( msg )
+ message = "Invalid request ID"
+ log.warn( message )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
status='error',
- message=msg,
+ message=message,
**kwd) )
events_list = []
all_events = request.events
@@ -547,35 +547,35 @@
@web.require_admin
def new(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
if params.get('select_request_type', False) == 'True':
return trans.fill_template( '/admin/requests/new_request.mako',
select_request_type=self.__select_request_type(trans, 'none'),
widgets=[],
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
elif params.get('create', False) == 'True':
if params.get('create_request_button', False) == 'Save' \
or params.get('create_request_samples_button', False) == 'Add samples':
request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) )
if not util.restore_text(params.get('name', '')) \
or util.restore_text(params.get('select_user', '')) == unicode('none'):
- msg = 'Please enter the <b>Name</b> of the request and the <b>user</b> on behalf of whom this request will be submitted before saving this request'
+ message = 'Please enter the <b>Name</b> of the request and the <b>user</b> on behalf of whom this request will be submitted before saving this request'
kwd['create'] = 'True'
- kwd['messagetype'] = 'error'
- kwd['msg'] = msg
+ kwd['status'] = 'error'
+ kwd['message'] = message
kwd['create_request_button'] = None
kwd['create_request_samples_button'] = None
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='new',
**kwd) )
request = self.__save_request(trans, None, **kwd)
- msg = 'The new request named %s has been created' % request.name
+ message = 'The new request named %s has been created' % request.name
if params.get('create_request_button', False) == 'Save':
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
- message=msg ,
+ message=message ,
status='done') )
elif params.get('create_request_samples_button', False) == 'Add samples':
new_kwd = {}
@@ -584,7 +584,7 @@
new_kwd['add_sample'] = True
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
- message=msg ,
+ message=message ,
status='done',
**new_kwd) )
else:
@@ -593,16 +593,16 @@
return self.__show_request_form(trans, **kwd)
def __show_request_form(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
request_type = trans.sa_session.query( trans.app.model.RequestType ).get( int( params.select_request_type ) )
except:
return trans.fill_template( '/admin/requests/new_request.mako',
select_request_type=self.__select_request_type(trans, 'none'),
widgets=[],
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
form_values = None
select_request_type = self.__select_request_type(trans, request_type.id)
# user
@@ -629,8 +629,8 @@
select_request_type=select_request_type,
request_type=request_type,
widgets=widgets,
- msg=msg,
- messagetype=messagetype)
+ message=message,
+ status=status)
def __select_user(self, trans, userid):
user_list = trans.sa_session.query( trans.app.model.User )\
.order_by( trans.app.model.User.email.asc() )
@@ -669,10 +669,10 @@
if field['required'] == 'required' and request.values.content[index] in ['', None]:
empty_fields.append(field['label'])
if empty_fields:
- msg = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
+ message = 'Fill the following fields of the request <b>%s</b> before submitting<br/>' % request.name
for ef in empty_fields:
- msg = msg + '<b>' +ef + '</b><br/>'
- return msg
+ message = message + '<b>' +ef + '</b><br/>'
+ return message
return None
def __save_request(self, trans, request=None, **kwd):
'''
@@ -746,8 +746,8 @@
#
def __show_request(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
add_sample = params.get('add_sample', False)
try:
request = trans.sa_session.query( trans.app.model.Request ).get( trans.security.decode_id(kwd['id']) )
@@ -787,7 +787,7 @@
current_samples=current_samples,
sample_copy=self.__copy_sample(current_samples),
details='hide', edit_mode=util.restore_text( params.get( 'edit_mode', 'False' ) ),
- msg=msg, messagetype=messagetype )
+ message=message, status=status )
def __library_widgets(self, trans, user, sample_index, libraries, sample=None, **kwd):
'''
This method creates the data library & folder selectbox for creating &
@@ -932,8 +932,8 @@
@web.require_login( "create/submit sequencing requests" )
def show_request(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
try:
request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', None ) ) )
except:
@@ -1010,28 +1010,28 @@
edit_mode=edit_mode)
elif params.get('save_samples_button', False) == 'Save':
# check for duplicate sample names
- msg = ''
+ message = ''
for index in range(len(current_samples)-len(request.samples)):
sample_index = index + len(request.samples)
sample_name = current_samples[sample_index]['name']
if not sample_name.strip():
- msg = 'Please enter the name of sample number %i' % sample_index
+ message = 'Please enter the name of sample number %i' % sample_index
break
count = 0
for i in range(len(current_samples)):
if sample_name == current_samples[i]['name']:
count = count + 1
if count > 1:
- msg = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name)
+ message = "This request has <b>%i</b> samples with the name <b>%s</b>.\nSamples belonging to a request must have unique names." % (count, sample_name)
break
- if msg:
+ if message:
return trans.fill_template( '/admin/requests/show_request.mako',
request=request,
request_details=self.request_details(trans, request.id),
current_samples = current_samples,
sample_copy=self.__copy_sample(current_samples),
details=details, edit_mode=edit_mode,
- messagetype='error', msg=msg)
+ status='error', message=message)
# save all the new/unsaved samples entered by the user
if edit_mode == 'False':
for index in range(len(current_samples)-len(request.samples)):
@@ -1050,18 +1050,18 @@
trans.sa_session.flush()
else:
- messagetype = 'done'
- msg = 'Changes made to the sample(s) are saved. '
+ status = 'done'
+ message = 'Changes made to the sample(s) are saved. '
for sample_index in range(len(current_samples)):
sample = request.samples[sample_index]
sample.name = current_samples[sample_index]['name']
sample.library = current_samples[sample_index]['library']
sample.folder = current_samples[sample_index]['folder']
if request.submitted():
- bc_msg = self.__validate_barcode(trans, sample, current_samples[sample_index]['barcode'])
- if bc_msg:
- messagetype = 'error'
- msg += bc_msg
+ bc_message = self.__validate_barcode(trans, sample, current_samples[sample_index]['barcode'])
+ if bc_message:
+ status = 'error'
+ message += bc_message
else:
if not sample.bar_code:
# if this is a 'new' (still in its first state) sample
@@ -1083,8 +1083,8 @@
action='list',
operation='show_request',
id=trans.security.encode_id(request.id),
- messagetype=messagetype,
- msg=msg ))
+ status=status,
+ message=message ))
elif params.get('edit_samples_button', False) == 'Edit samples':
edit_mode = 'True'
return trans.fill_template( '/admin/requests/show_request.mako',
@@ -1106,15 +1106,15 @@
current_samples=current_samples,
sample_copy=self.__copy_sample(current_samples),
details=details, libraries=libraries,
- edit_mode=edit_mode, messagetype=messagetype, msg=msg)
+ edit_mode=edit_mode, status=status, message=message)
@web.expose
@web.require_login( "create/submit sequencing requests" )
def delete_sample(self, trans, **kwd):
params = util.Params( kwd )
- msg = util.restore_text( params.get( 'msg', '' ) )
- messagetype = params.get( 'messagetype', 'done' )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
request = trans.sa_session.query( trans.app.model.Request ).get( int( params.get( 'request_id', 0 ) ) )
current_samples, details, edit_mode, libraries = self.__update_samples( trans, request, **kwd )
sample_index = int(params.get('sample_id', 0))
@@ -1182,11 +1182,11 @@
the given sample is gobally unique. That is, barcodes must be unique
across requests in Galaxy LIMS
'''
- msg = ''
+ message = ''
for index in range(len(sample.request.samples)):
# check for empty bar code
if not barcode.strip():
- msg = 'Please fill the barcode for sample <b>%s</b>.' % sample.name
+ message = 'Please fill the barcode for sample <b>%s</b>.' % sample.name
break
# check all the saved bar codes
all_samples = trans.sa_session.query( trans.app.model.Sample )
@@ -1195,20 +1195,20 @@
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/43b7a7f4bff5
changeset: 3605:43b7a7f4bff5
user: rc
date: Fri Apr 02 15:09:29 2010 -0400
description:
lims: default values for forms now working for text fields
diffstat:
lib/galaxy/model/__init__.py | 4 ++--
lib/galaxy/web/controllers/forms.py | 24 ++++++++++++++++++------
2 files changed, 20 insertions(+), 8 deletions(-)
diffs (107 lines):
diff -r 3914645ecccb -r 43b7a7f4bff5 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py Fri Apr 02 15:00:53 2010 -0400
+++ b/lib/galaxy/model/__init__.py Fri Apr 02 15:09:29 2010 -0400
@@ -1348,8 +1348,8 @@
# Since we do not have contents, set checkbox value to False
value = False
else:
- # Set other field types to empty string
- value = ''
+ # Set other field types to the default value of the field
+ value = field['default']
# create the field widget
field_widget = eval( field[ 'type' ] )( field_name )
if field[ 'type' ] == 'TextField':
diff -r 3914645ecccb -r 43b7a7f4bff5 lib/galaxy/web/controllers/forms.py
--- a/lib/galaxy/web/controllers/forms.py Fri Apr 02 15:00:53 2010 -0400
+++ b/lib/galaxy/web/controllers/forms.py Fri Apr 02 15:09:29 2010 -0400
@@ -72,7 +72,8 @@
'required': False,
'type': BaseField.form_field_types()[0],
'selectlist': [],
- 'layout': 'none' }
+ 'layout': 'none',
+ 'default': '' }
forms_grid = FormsGrid()
@web.expose
@@ -354,6 +355,7 @@
required = params.get( 'field_required_%i' % index, False )
field_type = util.restore_text( params.get( 'field_type_%i' % index, '' ) )
layout = params.get( 'field_layout_%i' % index, '' )
+ default = params.get( 'field_default_%i' % index, '' )
if field_type == 'SelectField':
selectlist = self.__get_selectbox_options(index, **kwd)
return {'label': name,
@@ -362,13 +364,15 @@
'required': required,
'type': field_type,
'selectlist': selectlist,
- 'layout': layout }
+ 'layout': layout,
+ 'default': default }
return {'label': name,
'helptext': helptext,
'visible': True,
'required': required,
'type': field_type,
- 'layout': layout}
+ 'layout': layout,
+ 'default': default}
def __get_selectbox_options(self, index, **kwd):
'''
This method gets all the options entered by the user for field when
@@ -453,7 +457,8 @@
'required': row[3],
'type': row[4],
'selectlist': options,
- 'layout':row[6]})
+ 'layout':row[6],
+ 'default': row[7]})
layouts.add(row[6])
else:
for row in reader:
@@ -463,7 +468,8 @@
'visible': row[2],
'required': row[3],
'type': row[4],
- 'selectlist': options})
+ 'selectlist': options,
+ 'default': row[7]})
except:
return trans.response.send_redirect( web.url_for( controller='forms',
action='new',
@@ -549,7 +555,9 @@
if layout_grids:
self.layout_selectbox = SelectField('field_layout_'+str(index))
for index, grid_name in enumerate(layout_grids):
- self.layout_selectbox.add_option("%i. %s" %(index+1, grid_name), index)
+ self.layout_selectbox.add_option("%i. %s" %(index+1, grid_name), index)
+ # default value
+ self.default = TextField('field_default_'+str(index), 40, '')
if field:
self.fill(trans, field, field_type, form_type)
def fill(self, trans, field, field_type=None, form_type=None):
@@ -557,6 +565,8 @@
self.label.value = field['label']
# helptext
self.helptext.value = field['helptext']
+ # default value
+ self.default.value = field['default']
# type
self.fieldtype = SelectField('field_type_'+str(self.index),
refresh_on_change=True,
@@ -608,11 +618,13 @@
return [( 'Label', self.label ),
( 'Help text', self.helptext ),
( 'Type', self.fieldtype, self.selectbox_options),
+ ( 'Default value', self.default ),
( '', self.required),
( 'Select the grid layout to place this field', self.layout_selectbox)]
return [( 'Label', self.label ),
( 'Help text', self.helptext ),
( 'Type', self.fieldtype, self.selectbox_options),
+ ( 'Default value', self.default ),
( '', self.required)]
def __repr__(self):
return str(self.index)+'.'+self.label
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/3914645ecccb
changeset: 3604:3914645ecccb
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Fri Apr 02 15:00:53 2010 -0400
description:
Handle user registration and login in the galaxy_main frame to ensure masthead. After registration or login, use javascript to redirect to the page the user was viewing when they attempted login. If javascript is disabled, a page will be displayed with links to the page they were visiting or the home page. Revamp functional tests to cover new behavior. Fix bugs where the username was not validated when a user registered, and add functional tests to cover. Fix a bug where the user's new session may have set it's history to the user's previous history, even if the history was deleted. Now a new history will be created for the current session instead. Add a new logout.mako template, and remove a create.mako template that was no longer used.
diffstat:
lib/galaxy/web/controllers/admin.py | 65 +------
lib/galaxy/web/controllers/user.py | 258 +++++++++-----------------
lib/galaxy/web/framework/__init__.py | 11 +-
templates/admin/user/create.mako | 43 ----
templates/library/common/browse_library.mako | 1 -
templates/user/index.mako | 16 +-
templates/user/login.mako | 51 +++--
templates/user/logout.mako | 6 +
templates/user/register.mako | 120 +++++++-----
templates/webapps/galaxy/base_panels.mako | 10 +-
test/base/twilltestcase.py | 82 ++++++--
test/functional/test_admin_features.py | 25 ++-
12 files changed, 301 insertions(+), 387 deletions(-)
diffs (969 lines):
diff -r 72daa0d41d1b -r 3914645ecccb lib/galaxy/web/controllers/admin.py
--- a/lib/galaxy/web/controllers/admin.py Fri Apr 02 14:34:35 2010 -0400
+++ b/lib/galaxy/web/controllers/admin.py Fri Apr 02 15:00:53 2010 -0400
@@ -711,69 +711,6 @@
return trans.response.send_redirect( web.url_for( controller='user',
action='create',
admin_view=True ) )
- email = ''
- password = ''
- confirm = ''
- subscribe = False
- email_filter = kwargs.get( 'email_filter', 'A' )
- if 'user_create_button' in kwargs:
- message = ''
- status = ''
- email = kwargs.get( 'email' , None )
- password = kwargs.get( 'password', None )
- confirm = kwargs.get( 'confirm', None )
- subscribe = kwargs.get( 'subscribe', None )
- if not email:
- message = 'Enter a valid email address'
- elif not password:
- message = 'Enter a valid password'
- elif not confirm:
- message = 'Confirm the password'
- elif len( email ) == 0 or "@" not in email or "." not in email:
- message = 'Enter a real email address'
- elif len( email) > 255:
- message = 'Email address exceeds maximum allowable length'
- elif trans.sa_session.query( trans.app.model.User ).filter_by( email=email ).first():
- message = 'User with that email already exists'
- elif len( password ) < 6:
- message = 'Use a password of at least 6 characters'
- elif password != confirm:
- message = 'Passwords do not match'
- if message:
- trans.response.send_redirect( web.url_for( controller='admin',
- action='users',
- email_filter=email_filter,
- message=util.sanitize_text( message ),
- status='error' ) )
- else:
- user = trans.app.model.User( email=email )
- user.set_password_cleartext( password )
- if trans.app.config.use_remote_user:
- user.external = True
- trans.sa_session.add( user )
- trans.sa_session.flush()
- trans.app.security_agent.create_private_user_role( user )
- trans.app.security_agent.user_set_default_permissions( user, history=False, dataset=False )
- message = 'Created new user account (%s)' % user.email
- status = 'done'
- #subscribe user to email list
- if subscribe:
- mail = os.popen( "%s -t" % trans.app.config.sendmail_path, 'w' )
- mail.write( "To: %s\nFrom: %s\nSubject: Join Mailing List\n\nJoin Mailing list." % ( trans.app.config.mailing_join_addr, email ) )
- if mail.close():
- message + ". However, subscribing to the mailing list has failed."
- status = 'error'
- trans.response.send_redirect( web.url_for( controller='admin',
- action='users',
- email_filter=email_filter,
- message=util.sanitize_text( message ),
- status=status ) )
- return trans.fill_template( '/admin/user/create.mako',
- email_filter=email_filter,
- email=email,
- password=password,
- confirm=confirm,
- subscribe=subscribe )
@web.expose
@web.require_admin
def reset_user_password( self, trans, **kwd ):
@@ -916,7 +853,7 @@
status='done' ) )
@web.expose
@web.require_admin
- def users( self, trans, **kwargs ):
+ def users( self, trans, **kwargs ):
if 'operation' in kwargs:
operation = kwargs['operation'].lower()
if operation == "roles":
diff -r 72daa0d41d1b -r 3914645ecccb lib/galaxy/web/controllers/user.py
--- a/lib/galaxy/web/controllers/user.py Fri Apr 02 14:34:35 2010 -0400
+++ b/lib/galaxy/web/controllers/user.py Fri Apr 02 15:00:53 2010 -0400
@@ -26,23 +26,24 @@
class User( BaseController ):
@web.expose
def index( self, trans, webapp='galaxy', **kwd ):
- return trans.fill_template( '/user/index.mako', user=trans.get_user(), webapp=webapp )
+ return trans.fill_template( '/user/index.mako', webapp=webapp )
@web.expose
- def login( self, trans, webapp='galaxy', **kwd ):
+ def login( self, trans, webapp='galaxy', redirect_url='', refresh_frames=[], **kwd ):
+ referer = kwd.get( 'referer', trans.request.referer )
use_panels = util.string_as_bool( kwd.get( 'use_panels', True ) )
msg = kwd.get( 'msg', '' )
messagetype = kwd.get( 'messagetype', 'done' )
+ header = ''
+ user = None
+ email = kwd.get( 'email', '' )
if kwd.get( 'login_button', False ):
- email = kwd.get( 'email', '' )
password = kwd.get( 'password', '' )
referer = kwd.get( 'referer', '' )
- if webapp == 'galaxy':
+ if webapp == 'galaxy' and not refresh_frames:
if trans.app.config.require_login:
refresh_frames = [ 'masthead', 'history', 'tools' ]
else:
refresh_frames = [ 'masthead', 'history' ]
- else:
- refresh_frames = []
user = trans.sa_session.query( trans.app.model.User ).filter( trans.app.model.User.table.c.email==email ).first()
if not user:
msg = "No such user"
@@ -59,38 +60,27 @@
else:
trans.handle_user_login( user, webapp )
trans.log_event( "User logged in" )
- msg = "You are now logged in as %s.<br>You can <a href='%s'>go back to the page you were visiting</a> or <a href='%s'>go to the home page</a>." % \
+ msg = 'You are now logged in as %s.<br>You can <a target="_top" href="%s">go back to the page you were visiting</a> or <a target="_top" href="%s">go to the home page</a>.' % \
( user.email, referer, url_for( '/' ) )
if trans.app.config.require_login:
- msg += ' <a href="%s">Click here</a> to continue to the home page.' % web.url_for( '/static/welcome.html' )
- return trans.response.send_redirect( web.url_for( controller='user',
- action='login',
- use_panels=use_panels,
- msg=msg,
- message_type='done' ) )
- if trans.app.config.require_login:
+ msg += ' <a target="_top" href="%s">Click here</a> to continue to the home page.' % web.url_for( '/static/welcome.html' )
+ redirect_url = referer
+ if not user and trans.app.config.require_login:
if trans.app.config.allow_user_creation:
- return trans.fill_template( '/user/login.mako',
- webapp=webapp,
- header=require_login_creation_template % web.url_for( action='create' ),
- use_panels=use_panels,
- msg=msg,
- messagetype=messagetype,
- active_view="user" )
+ header = require_login_creation_template % web.url_for( action='create' )
else:
- return trans.fill_template( '/user/login.mako',
- webapp=webapp,
- header=require_login_nocreation_template,
- use_panels=use_panels,
- msg=msg,
- messagetype=messagetype,
- active_view="user" )
+ header = require_login_nocreation_template
return trans.fill_template( '/user/login.mako',
webapp=webapp,
+ email=email,
+ header=header,
use_panels=use_panels,
+ redirect_url=redirect_url,
+ referer=referer,
+ refresh_frames=refresh_frames,
msg=msg,
messagetype=messagetype,
- active_view="use" )
+ active_view="user" )
@web.expose
def logout( self, trans, webapp='galaxy' ):
if webapp == 'galaxy':
@@ -103,18 +93,18 @@
# Since logging an event requires a session, we'll log prior to ending the session
trans.log_event( "User logged out" )
trans.handle_user_logout()
- msg = "You have been logged out.<br>You can log in again, <a href='%s'>go back to the page you were visiting</a> or <a href='%s'>go to the home page</a>." % \
+ msg = 'You have been logged out.<br>You can log in again, <a target="_top" href="%s">go back to the page you were visiting</a> or <a target="_top" href="%s">go to the home page</a>.' % \
( trans.request.referer, url_for( '/' ) )
- return trans.response.send_redirect( web.url_for( controller='user',
- action='login',
- msg=msg,
- message_type='done' ) )
+ return trans.fill_template( '/user/logout.mako',
+ webapp=webapp,
+ refresh_frames=refresh_frames,
+ msg=msg,
+ messagetype='done',
+ active_view="user" )
@web.expose
- def create( self, trans, webapp='galaxy', **kwd ):
+ def create( self, trans, webapp='galaxy', redirect_url='', refresh_frames=[], **kwd ):
params = util.Params( kwd )
- use_panels = kwd.get( 'use_panels', 'True' )
- # Convert use_panels to Boolean.
- use_panels = use_panels in [ 'True', 'true', 't', 'T' ]
+ use_panels = util.string_as_bool( kwd.get( 'use_panels', True ) )
email = util.restore_text( params.get( 'email', '' ) )
# Do not sanitize passwords, so take from kwd
# instead of params ( which were sanitized )
@@ -126,123 +116,56 @@
admin_view = util.string_as_bool( params.get( 'admin_view', False ) )
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
- if webapp == 'galaxy':
+ referer = kwd.get( 'referer', trans.request.referer )
+ if not refresh_frames and webapp == 'galaxy':
if trans.app.config.require_login:
refresh_frames = [ 'masthead', 'history', 'tools' ]
else:
refresh_frames = [ 'masthead', 'history' ]
- else:
- refresh_frames = []
+ error = ''
if not trans.app.config.allow_user_creation and not trans.user_is_admin():
- msg = 'User registration is disabled. Please contact your Galaxy administrator for an account.'
- return trans.response.send_redirect( web.url_for( controller='user',
- action='create',
- webapp=webapp,
- email=email,
- password=password,
- confirm=confirm,
- username=username,
- subscribe=subscribe,
- subscribe_checked=subscribe_checked,
- admin_view=admin_view,
- use_panels=use_panels,
- refresh_frames=refresh_frames,
- msg=error,
- messagetype='error' ) )
+ error = 'User registration is disabled. Please contact your Galaxy administrator for an account.'
# Create the user, save all the user info and login to Galaxy
- if params.get( 'create_user_button', False ):
+ elif params.get( 'create_user_button', False ):
# Check email and password validity
- error = self.__validate( trans, params, email, password, confirm, webapp )
- if error:
- return trans.response.send_redirect( web.url_for( controller='user',
- action='create',
- webapp=webapp,
- email=email,
- password=password,
- confirm=confirm,
- username=username,
- subscribe=subscribe,
- subscribe_checked=subscribe_checked,
- admin_view=admin_view,
- use_panels=use_panels,
- refresh_frames=refresh_frames,
- msg=error,
- messagetype='error' ) )
- # all the values are valid
- user = trans.app.model.User( email=email )
- user.set_password_cleartext( password )
- user.username = username
- trans.sa_session.add( user )
- trans.sa_session.flush()
- trans.app.security_agent.create_private_user_role( user )
- if webapp == 'galaxy':
- # We set default user permissions, before we log in and set the default history permissions
- trans.app.security_agent.user_set_default_permissions( user,
- default_access_private=trans.app.config.new_user_dataset_access_role_default_private )
- # save user info
- self.__save_user_info( trans, user, action='create', new_user=True, **kwd )
- if subscribe_checked:
- mail = os.popen( "%s -t" % trans.app.config.sendmail_path, 'w' )
- mail.write( "To: %s\nFrom: %s\nSubject: Join Mailing List\n\nJoin Mailing list." % ( trans.app.config.mailing_join_addr,email ) )
- if mail.close():
- msg = "Now logged in as " + user.email + ". However, subscribing to the mailing list has failed."
- return trans.response.send_redirect( web.url_for( controller='user',
- action='create',
- webapp=webapp,
- email=email,
- password=password,
- confirm=confirm,
- username=username,
- subscribe=subscribe,
- subscribe_checked=subscribe_checked,
- admin_view=admin_view,
- use_panels=use_panels,
- refresh_frames=refresh_frames,
- msg=error,
- messagetype='warn' ) )
- if not admin_view:
- # The handle_user_login() method has a call to the history_set_default_permissions() method
- # (needed when logging in with a history), user needs to have default permissions set before logging in
- trans.handle_user_login( user, webapp )
- trans.log_event( "User created a new account" )
- trans.log_event( "User logged in" )
- # subscribe user to email list
- msg = "Now logged in as %s.<br><a href='%s'>Return to the home page.</a>" % ( user.email, url_for( '/' ) )
- return trans.response.send_redirect( web.url_for( controller='user',
- action='create',
- webapp=webapp,
- email=email,
- password=password,
- confirm=confirm,
- username=username,
- subscribe=subscribe,
- subscribe_checked=subscribe_checked,
- admin_view=admin_view,
- use_panels=True,
- refresh_frames=refresh_frames,
- msg=msg,
- messagetype='done' ) )
- else:
- trans.response.send_redirect( web.url_for( controller='admin',
- action='users',
- message='Created new user account (%s)' % user.email,
- status='done' ) )
- else:
- msg = "Now logged in as %s.<br><a href='%s'>Return to the home page.</a>" % ( user.email, url_for( '/' ) )
- return trans.response.send_redirect( web.url_for( controller='user',
- action='create',
- webapp=webapp,
- email=email,
- password=password,
- confirm=confirm,
- username=username,
- subscribe=subscribe,
- subscribe_checked=subscribe_checked,
- admin_view=admin_view,
- use_panels=False,
- refresh_frames=refresh_frames,
- msg=error,
- messagetype='done' ) )
+ error = self.__validate( trans, params, email, password, confirm, username, webapp )
+ if not error:
+ # all the values are valid
+ user = trans.app.model.User( email=email )
+ user.set_password_cleartext( password )
+ user.username = username
+ trans.sa_session.add( user )
+ trans.sa_session.flush()
+ trans.app.security_agent.create_private_user_role( user )
+ msg = 'Now logged in as %s.<br><a target="_top" href="%s">Return to the home page.</a>' % ( user.email, url_for( '/' ) )
+ if webapp == 'galaxy':
+ # We set default user permissions, before we log in and set the default history permissions
+ trans.app.security_agent.user_set_default_permissions( user,
+ default_access_private=trans.app.config.new_user_dataset_access_role_default_private )
+ # save user info
+ self.__save_user_info( trans, user, action='create', new_user=True, **kwd )
+ if subscribe_checked:
+ # subscribe user to email list
+ mail = os.popen( "%s -t" % trans.app.config.sendmail_path, 'w' )
+ mail.write( "To: %s\nFrom: %s\nSubject: Join Mailing List\n\nJoin Mailing list." % ( trans.app.config.mailing_join_addr,email ) )
+ if mail.close():
+ error = "Now logged in as " + user.email + ". However, subscribing to the mailing list has failed."
+ if not error and not admin_view:
+ # The handle_user_login() method has a call to the history_set_default_permissions() method
+ # (needed when logging in with a history), user needs to have default permissions set before logging in
+ trans.handle_user_login( user, webapp )
+ trans.log_event( "User created a new account" )
+ trans.log_event( "User logged in" )
+ elif not error:
+ trans.response.send_redirect( web.url_for( controller='admin',
+ action='users',
+ message='Created new user account (%s)' % user.email,
+ status='done' ) )
+ if not error:
+ redirect_url = referer
+ if error:
+ msg=error
+ messagetype='error'
if webapp == 'galaxy':
user_info_select, user_info_form, widgets = self.__user_info_ui( trans, **kwd )
else:
@@ -261,6 +184,9 @@
widgets=widgets,
webapp=webapp,
use_panels=use_panels,
+ referer=referer,
+ redirect_url=redirect_url,
+ refresh_frames=refresh_frames,
msg=msg,
messagetype=messagetype )
def __save_user_info(self, trans, user, action, new_user=True, **kwd):
@@ -371,7 +297,7 @@
if len( username ) > 255:
return "User name cannot be more than 255 characters in length"
if not( VALID_USERNAME_RE.match( username ) ):
- return "User name must contain only letters, numbers and '-'"
+ return "User name must contain only lower-case letters, numbers and '-'"
if trans.sa_session.query( trans.app.model.User ).filter_by( username=username ).first():
return "This user name is not available"
return None
@@ -382,24 +308,24 @@
elif password != confirm:
error = "Passwords do not match"
return error
- def __validate( self, trans, params, email, password, confirm, webapp ):
+ def __validate( self, trans, params, email, password, confirm, username, webapp ):
error = self.__validate_email( trans, email )
- if error:
- return error
- error = self.__validate_password( trans, password, confirm )
- if error:
- return error
- if webapp == 'galaxy':
- # TODO: the user controller must be decoupled from the model, so this import causes problems.
- # The get_all_forms method is used only if Galaxy is the webapp, so it needs to be re-worked
- # so that it can be imported with no problems if the controller is not 'galaxy'.
- from galaxy.web.controllers.forms import get_all_forms
- if len( get_all_forms( trans,
- filter=dict( deleted=False ),
- form_type=trans.app.model.FormDefinition.types.USER_INFO ) ):
- if params.get( 'user_info_select', 'none' ) == 'none':
- return 'Select the user type and the user information'
- return None
+ if not error:
+ error = self.__validate_password( trans, password, confirm )
+ if not error and username:
+ error = self.__validate_username( trans, username )
+ if not error:
+ if webapp == 'galaxy':
+ # TODO: the user controller must be decoupled from the model, so this import causes problems.
+ # The get_all_forms method is used only if Galaxy is the webapp, so it needs to be re-worked
+ # so that it can be imported with no problems if the controller is not 'galaxy'.
+ from galaxy.web.controllers.forms import get_all_forms
+ if len( get_all_forms( trans,
+ filter=dict( deleted=False ),
+ form_type=trans.app.model.FormDefinition.types.USER_INFO ) ):
+ if not params.get( 'user_info_select', False ):
+ return 'Select the user type and the user information'
+ return error
def __user_info_ui(self, trans, user=None, **kwd):
'''
This method creates the user type select box & user information form widgets
diff -r 72daa0d41d1b -r 3914645ecccb lib/galaxy/web/framework/__init__.py
--- a/lib/galaxy/web/framework/__init__.py Fri Apr 02 14:34:35 2010 -0400
+++ b/lib/galaxy/web/framework/__init__.py Fri Apr 02 15:00:53 2010 -0400
@@ -72,7 +72,7 @@
return func( self, trans, *args, **kwargs )
else:
return trans.show_error_message(
- "You must be <a target='_top' href='%s'>logged in</a> to %s</div>."
+ 'You must be <a target="_top" href="%s">logged in</a> to %s</div>.'
% ( url_for( controller='user', action='login' ), verb ), use_panels=use_panels )
return decorator
return argcatcher
@@ -434,14 +434,19 @@
except:
users_last_session = None
last_accessed = False
- if prev_galaxy_session.current_history and prev_galaxy_session.current_history.datasets:
+ if prev_galaxy_session.current_history and \
+ not prev_galaxy_session.current_history.deleted and \
+ prev_galaxy_session.current_history.datasets:
if prev_galaxy_session.current_history.user is None or prev_galaxy_session.current_history.user == user:
# If the previous galaxy session had a history, associate it with the new
# session, but only if it didn't belong to a different user.
history = prev_galaxy_session.current_history
elif self.galaxy_session.current_history:
history = self.galaxy_session.current_history
- if not history and users_last_session and users_last_session.current_history:
+ if not history and \
+ users_last_session and \
+ users_last_session.current_history and \
+ not users_last_session.current_history.deleted:
history = users_last_session.current_history
elif not history:
history = self.get_history( create=True )
diff -r 72daa0d41d1b -r 3914645ecccb templates/admin/user/create.mako
--- a/templates/admin/user/create.mako Fri Apr 02 14:34:35 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if msg:
- ${render_msg( msg, messagetype )}
-%endif
-
-<div class="toolForm">
- <div class="toolFormTitle">Create user account</div>
- <div class="toolFormBody">
- <form name="form" action="${h.url_for( controller='admin', action='create_new_user', email_filter=email_filter )}" method="post" >
- <div class="form-row">
- <label>Email address:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="text" name="email" value="${email}" size="40">
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>Password:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="password" name="password" value="${password}" size="40">
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>Confirm password:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="password" name="confirm" value="${confirm}" size="40">
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>Subscribe To Mailing List:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="checkbox" name="subscribe" value="${subscribe}" size="40">
- </div>
- <div style="clear: both"></div>
- </div>
- <input type="submit" name="user_create_button" value="Create">
- </form>
- </div>
-</div>
diff -r 72daa0d41d1b -r 3914645ecccb templates/library/common/browse_library.mako
--- a/templates/library/common/browse_library.mako Fri Apr 02 14:34:35 2010 -0400
+++ b/templates/library/common/browse_library.mako Fri Apr 02 15:00:53 2010 -0400
@@ -30,7 +30,6 @@
${render_content()}
</div>
</div>
- ##${render_content()}
</%def>
## Render the grid's basic elements. Each of these elements can be subclassed.
diff -r 72daa0d41d1b -r 3914645ecccb templates/user/index.mako
--- a/templates/user/index.mako Fri Apr 02 14:34:35 2010 -0400
+++ b/templates/user/index.mako Fri Apr 02 15:00:53 2010 -0400
@@ -1,11 +1,13 @@
<%inherit file="/base.mako"/>
-<%def name="title()">User preferences</%def>
+<%namespace file="/message.mako" import="render_msg" />
+%if msg:
+ ${render_msg( msg, messagetype )}
+%endif
-<h2>${_('User preferences')}</h2>
-
-%if user:
- <p>You are currently logged in as ${user.email}.</p>
+%if trans.user:
+ <h2>${_('User preferences')}</h2>
+ <p>You are currently logged in as ${trans.user.email}.</p>
<ul>
%if webapp == 'galaxy':
<li><a href="${h.url_for( action='show_info' )}">${_('Manage your information')}</a></li>
@@ -14,7 +16,9 @@
<li><a href="${h.url_for( action='logout' )}">${_('Logout')}</a></li>
</ul>
%else:
- <p>${n_('You are currently not logged in.')}</p>
+ %if not msg:
+ <p>${n_('You are currently not logged in.')}</p>
+ %endif
<ul>
<li><a href="${h.url_for( action='login' )}">${_('Login')}</li>
<li><a href="${h.url_for( action='create' )}">${_('Register')}</a></li>
diff -r 72daa0d41d1b -r 3914645ecccb templates/user/login.mako
--- a/templates/user/login.mako Fri Apr 02 14:34:35 2010 -0400
+++ b/templates/user/login.mako Fri Apr 02 15:00:53 2010 -0400
@@ -1,30 +1,39 @@
<%inherit file="/base.mako"/>
<%namespace file="/message.mako" import="render_msg" />
-%if msg:
+%if redirect_url:
+ <script type="text/javascript">
+ top.location.href = '${redirect_url}';
+ </script>
+%endif
+
+%if not redirect_url and msg:
${render_msg( msg, messagetype )}
%endif
-<div class="toolForm">
- <div class="toolFormTitle">Login</div>
+
+%if not trans.user:
%if header:
${header}
%endif
- <form name="login" id="login" action="${h.url_for( controller='user', action='login' )}" method="post" >
- <div class="form-row">
- <label>Email address:</label>
- <input type="text" name="email" value="" size="40"/>
- <input type="hidden" name="webapp" value="${webapp}" size="40"/>
- <input type="hidden" name="referer" value="${trans.request.referer}" size="40"/>
- </div>
- <div class="form-row">
- <label>Password:</label>
- <input type="password" name="password" value="" size="40"/>
- <div class="toolParamHelp" style="clear: both;">
- <a href="${h.url_for( controller='user', action='reset_password', webapp=webapp, use_panels=use_panels )}">Forgot password? Reset here</a>
+ <div class="toolForm">
+ <div class="toolFormTitle">Login</div>
+ <form name="login" id="login" action="${h.url_for( controller='user', action='login' )}" method="post" >
+ <div class="form-row">
+ <label>Email address:</label>
+ <input type="text" name="email" value="${email}" size="40"/>
+ <input type="hidden" name="webapp" value="${webapp}" size="40"/>
+ <input type="hidden" name="referer" value="${referer}" size="40"/>
</div>
- </div>
- <div class="form-row">
- <input type="submit" name="login_button" value="Login"/>
- </div>
- </form>
-</div>
+ <div class="form-row">
+ <label>Password:</label>
+ <input type="password" name="password" value="" size="40"/>
+ <div class="toolParamHelp" style="clear: both;">
+ <a href="${h.url_for( controller='user', action='reset_password', webapp=webapp, use_panels=use_panels )}">Forgot password? Reset here</a>
+ </div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="login_button" value="Login"/>
+ </div>
+ </form>
+ </div>
+%endif
diff -r 72daa0d41d1b -r 3914645ecccb templates/user/logout.mako
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/user/logout.mako Fri Apr 02 15:00:53 2010 -0400
@@ -0,0 +1,6 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+%if msg:
+ ${render_msg( msg, messagetype )}
+%endif
diff -r 72daa0d41d1b -r 3914645ecccb templates/user/register.mako
--- a/templates/user/register.mako Fri Apr 02 14:34:35 2010 -0400
+++ b/templates/user/register.mako Fri Apr 02 15:00:53 2010 -0400
@@ -1,6 +1,12 @@
<%inherit file="/base.mako"/>
<%namespace file="/message.mako" import="render_msg" />
+%if redirect_url:
+ <script type="text/javascript">
+ top.location.href = '${redirect_url}';
+ </script>
+%endif
+
<%def name="javascripts()">
${parent.javascripts()}
<script type="text/javascript">
@@ -33,62 +39,70 @@
from galaxy.web.form_builder import CheckboxField
subscribe_check_box = CheckboxField( 'subscribe' )
%>
-%if msg:
+%if not redirect_url and msg:
${render_msg( msg, messagetype )}
%endif
-<div class="toolForm">
- <form name="registration" id="registration" action="${h.url_for( controller='user', action='create', admin_view=admin_view )}" method="post" >
- <div class="toolFormTitle">Create account</div>
- <div class="form-row">
- <label>Email address:</label>
- <input type="text" name="email" value="${email}" size="40"/>
- <input type="hidden" name="webapp" value="${webapp}" size="40"/>
- </div>
- <div class="form-row">
- <label>Password:</label>
- <input type="password" name="password" value="${password}" size="40"/>
- </div>
- <div class="form-row">
- <label>Confirm password:</label>
- <input type="password" name="confirm" value="${confirm}" size="40"/>
- </div>
- <div class="form-row">
- <label>Public user name:</label>
- <input type="text" name="username" size="40" value="${username}"/>
- <div class="toolParamHelp" style="clear: both;">
- When you share or publish items, this name is shown as the author.
+
+## An admin user may be creating a new user account, in which case we want to display the registration form.
+## But if the current user is not an admin user, then don't display the registration form.
+%if trans.user_is_admin() or not trans.user:
+ <div class="toolForm">
+ <form name="registration" id="registration" action="${h.url_for( controller='user', action='create', admin_view=admin_view )}" method="post" >
+ <div class="toolFormTitle">Create account</div>
+ <div class="form-row">
+ <label>Email address:</label>
+ <input type="text" name="email" value="${email}" size="40"/>
+ <input type="hidden" name="webapp" value="${webapp}" size="40"/>
+ <input type="hidden" name="referer" value="${referer}" size="40"/>
</div>
- </div>
- <div class="form-row">
- <label>Subscribe to mailing list:</label>
- %if subscribe_checked:
- <% subscribe_check_box.checked = True %>
+ <div class="form-row">
+ <label>Password:</label>
+ <input type="password" name="password" value="${password}" size="40"/>
+ </div>
+ <div class="form-row">
+ <label>Confirm password:</label>
+ <input type="password" name="confirm" value="${confirm}" size="40"/>
+ </div>
+ <div class="form-row">
+ <label>Public user name:</label>
+ <input type="text" name="username" size="40" value="${username}"/>
+ <div class="toolParamHelp" style="clear: both;">
+ Your user name is an optional identifier that will be used to generate addresses for information
+ you share publicly. User names must be at least four characters in length and contain only lower-case
+ letters, numbers, and the '-' character.
+ </div>
+ </div>
+ <div class="form-row">
+ <label>Subscribe to mailing list:</label>
+ %if subscribe_checked:
+ <% subscribe_check_box.checked = True %>
+ %endif
+ ${subscribe_check_box.get_html()}
+ </div>
+ %if user_info_select:
+ <div class="form-row">
+ <label>User type</label>
+ ${user_info_select.get_html()}
+ </div>
%endif
- ${subscribe_check_box.get_html()}
- </div>
- %if user_info_select:
+ %if user_info_form:
+ %for field in widgets:
+ <div class="form-row">
+ <label>${field['label']}</label>
+ ${field['widget'].get_html()}
+ <div class="toolParamHelp" style="clear: both;">
+ ${field['helptext']}
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ %endfor
+ %if not user_info_select:
+ <input type="hidden" name="user_info_select" value="${user_info_form.id}"/>
+ %endif
+ %endif
<div class="form-row">
- <label>User type</label>
- ${user_info_select.get_html()}
+ <input type="submit" name="create_user_button" value="Submit"/>
</div>
- %endif
- %if user_info_form:
- %for field in widgets:
- <div class="form-row">
- <label>${field['label']}</label>
- ${field['widget'].get_html()}
- <div class="toolParamHelp" style="clear: both;">
- ${field['helptext']}
- </div>
- <div style="clear: both"></div>
- </div>
- %endfor
- %if not user_info_select:
- <input type="hidden" name="user_info_select" value="${user_info_form.id}"/>
- %endif
- %endif
- <div class="form-row">
- <input type="submit" name="create_user_button" value="Submit"/>
- </div>
- </form>
-</div>
+ </form>
+ </div>
+%endif
diff -r 72daa0d41d1b -r 3914645ecccb templates/webapps/galaxy/base_panels.mako
--- a/templates/webapps/galaxy/base_panels.mako Fri Apr 02 14:34:35 2010 -0400
+++ b/templates/webapps/galaxy/base_panels.mako Fri Apr 02 15:00:53 2010 -0400
@@ -100,28 +100,26 @@
%>
<div class="submenu">
<ul class="loggedout-only" style="${style1}">
- <li><a href="${h.url_for( controller='/user', action='login' )}">Login</a></li>
+ <li><a target="galaxy_main" href="${h.url_for( controller='/user', action='login' )}">Login</a></li>
%if app.config.allow_user_creation:
- <li><a href="${h.url_for( controller='/user', action='create' )}">Register</a></li>
+ <li><a target="galaxy_main" href="${h.url_for( controller='/user', action='create' )}">Register</a></li>
%endif
</ul>
<ul class="loggedin-only" style="${style2}">
%if app.config.use_remote_user:
%if app.config.remote_user_logout_href:
- <li><a href="${app.config.remote_user_logout_href}" target="_top">Logout</a></li>
+ <li><a target="galaxy_main" href="${app.config.remote_user_logout_href}">Logout</a></li>
%endif
%else:
<li>Logged in as <span id="user-email">${user_email}</span></li>
<li><a target="galaxy_main" href="${h.url_for( controller='/user', action='index' )}">Preferences</a></li>
<%
if app.config.require_login:
- logout_target = ""
logout_url = h.url_for( controller='/root', action='index', m_c='user', m_a='logout' )
else:
- logout_target = ""
logout_url = h.url_for( controller='/user', action='logout' )
%>
- <li><a target="${logout_target}" href="${logout_url}">Logout</a></li>
+ <li><a target="_top" href="${logout_url}">Logout</a></li>
%endif
<li><hr style="color: inherit; background-color: gray"/></li>
<li><a target="galaxy_main" href="${h.url_for( controller='/history', action='list' )}">Histories</a></li>
diff -r 72daa0d41d1b -r 3914645ecccb test/base/twilltestcase.py
--- a/test/base/twilltestcase.py Fri Apr 02 14:34:35 2010 -0400
+++ b/test/base/twilltestcase.py Fri Apr 02 15:00:53 2010 -0400
@@ -793,20 +793,39 @@
self.assertTrue( genome_build == dbkey )
# Functions associated with user accounts
- def create( self, email='test(a)bx.psu.edu', password='testuser', username='admin-user', webapp='galaxy' ):
+ def create( self, email='test(a)bx.psu.edu', password='testuser', username='admin-user', webapp='galaxy', referer='' ):
# HACK: don't use panels because late_javascripts() messes up the twill browser and it
# can't find form fields (and hence user can't be logged in).
- self.visit_url( "%s/user/create?use_panels=False&webapp=%s" % ( self.url, webapp ) )
+ self.visit_url( "%s/user/create?use_panels=False" % self.url )
tc.fv( '1', 'email', email )
+ tc.fv( '1', 'webapp', webapp )
+ tc.fv( '1', 'referer', referer )
tc.fv( '1', 'password', password )
tc.fv( '1', 'confirm', password )
tc.fv( '1', 'username', username )
tc.submit( 'create_user_button' )
- self.check_page_for_string( "now logged in as %s" % email )
- # Make sure a new private role was created for the user
- self.visit_url( "%s/user/set_default_permissions" % self.url )
- self.check_page_for_string( email )
- self.home()
+ previously_created = False
+ username_taken = False
+ invalid_username = False
+ try:
+ self.check_page_for_string( "Created new user account" )
+ except:
+ try:
+ # May have created the account in a previous test run...
+ self.check_page_for_string( "User with that email already exists" )
+ previously_created = True
+ except:
+ try:
+ self.check_page_for_string( 'This user name is not available' )
+ username_taken = True
+ except:
+ try:
+ # Note that we're only checking if the usr name is >< 4 chars here...
+ self.check_page_for_string( 'User name must be at least 4 characters in length' )
+ invalid_username = True
+ except:
+ pass
+ return previously_created, username_taken, invalid_username
def create_user_with_info( self, email, password, username, user_info_forms, user_info_form_id, user_info_values ):
'''
This method registers a new user and also provides use info
@@ -815,7 +834,6 @@
self.visit_url( "%s/user/create?user_info_select=%i&admin_view=False&use_panels=False" % ( self.url, user_info_form_id ) )
else:
self.visit_url( "%s/user/create?admin_view=False&use_panels=False" % self.url )
- ##print self.write_temp_file( self.last_page() )
self.check_page_for_string( "Create account" )
tc.fv( "1", "email", email )
tc.fv( "1", "password", password )
@@ -906,20 +924,20 @@
self.visit_url( "%s/%s" % ( self.url, url ) )
self.check_page_for_string( 'Default history permissions have been changed.' )
self.home()
- def login( self, email='test(a)bx.psu.edu', password='testuser', username='admin-user', webapp='galaxy' ):
+ def login( self, email='test(a)bx.psu.edu', password='testuser', username='admin-user', webapp='galaxy', referer='' ):
# test(a)bx.psu.edu is configured as an admin user
- try:
- self.create( email=email, password=password, username=username, webapp=webapp )
- except:
- self.home()
+ previously_created, username_taken, invalid_username = \
+ self.create( email=email, password=password, username=username, webapp=webapp, referer=referer )
+ if previously_created:
+ # The acount has previously been created, so just login.
# HACK: don't use panels because late_javascripts() messes up the twill browser and it
# can't find form fields (and hence user can't be logged in).
self.visit_url( "%s/user/login?use_panels=False" % self.url )
tc.fv( '1', 'email', email )
+ tc.fv( '1', 'webapp', webapp )
+ tc.fv( '1', 'referer', referer )
tc.fv( '1', 'password', password )
- tc.submit( 'Login' )
- self.check_page_for_string( "now logged in as %s" %email )
- self.home()
+ tc.submit( 'login_button' )
def logout( self ):
self.home()
self.visit_page( "user/logout" )
@@ -1161,23 +1179,41 @@
# Dataset Security stuff
# Tests associated with users
- def create_new_account_as_admin( self, email='test4(a)bx.psu.edu', password='testuser', username='regular-user4' ):
+ def create_new_account_as_admin( self, email='test4(a)bx.psu.edu', password='testuser',
+ username='regular-user4', webapp='galaxy', referer='' ):
"""Create a new account for another user"""
+ # HACK: don't use panels because late_javascripts() messes up the twill browser and it
+ # can't find form fields (and hence user can't be logged in).
self.visit_url( "%s/user/create?admin_view=True" % self.url )
tc.fv( '1', 'email', email )
+ tc.fv( '1', 'webapp', webapp )
+ tc.fv( '1', 'referer', referer )
tc.fv( '1', 'password', password )
tc.fv( '1', 'confirm', password )
tc.fv( '1', 'username', username )
tc.submit( 'create_user_button' )
+ previously_created = False
+ username_taken = False
+ invalid_username = False
try:
self.check_page_for_string( "Created new user account" )
- previously_created = False
except:
- # May have created the account in a previous test run...
- self.check_page_for_string( "User with that email already exists" )
- previously_created = True
- self.home()
- return previously_created
+ try:
+ # May have created the account in a previous test run...
+ self.check_page_for_string( "User with that email already exists" )
+ previously_created = True
+ except:
+ try:
+ self.check_page_for_string( 'This user name is not available' )
+ username_taken = True
+ except:
+ try:
+ # Note that we're only checking if the usr name is >< 4 chars here...
+ self.check_page_for_string( 'User name must be at least 4 characters in length' )
+ invalid_username = True
+ except:
+ pass
+ return previously_created, username_taken, invalid_username
def reset_password_as_admin( self, user_id, password='testreset' ):
"""Reset a user password"""
self.home()
diff -r 72daa0d41d1b -r 3914645ecccb test/functional/test_admin_features.py
--- a/test/functional/test_admin_features.py Fri Apr 02 14:34:35 2010 -0400
+++ b/test/functional/test_admin_features.py Fri Apr 02 15:00:53 2010 -0400
@@ -24,7 +24,30 @@
# Logged in as admin_user
email = 'test3(a)bx.psu.edu'
password = 'testuser'
- previously_created = self.create_new_account_as_admin( email=email, password=password, username='regular-user3' )
+ # Test setting the user name to one that is already taken. Note that the account must not exist in order
+ # for this test to work as desired, so the email we're passing is important...
+ previously_created, username_taken, invalid_username = self.create_new_account_as_admin( email='diff(a)you.com',
+ password=password,
+ username='admin-user',
+ webapp='galaxy',
+ referer='' )
+ if not username_taken:
+ raise AssertionError, "The user name (%s) is already being used by another user, but no error was displayed" \
+ % 'admin-user'
+ # Test setting the user name to an invalid one. Note that the account must not exist in order
+ # for this test to work as desired, so the email we're passing is important...
+ previously_created, username_taken, invalid_username = self.create_new_account_as_admin( email='diff(a)you.com',
+ password=password,
+ username='h',
+ webapp='galaxy',
+ referer='' )
+ if not invalid_username:
+ raise AssertionError, "The user name (%s) is is invalid, but no error was displayed" % username
+ previously_created, username_taken, invalid_username = self.create_new_account_as_admin( email=email,
+ password=password,
+ username='regular-user3',
+ webapp='galaxy',
+ referer='' )
# Get the user object for later tests
global regular_user3
regular_user3 = get_user( email )
1
0
15 Apr '10
details: http://www.bx.psu.edu/hg/galaxy/rev/72daa0d41d1b
changeset: 3603:72daa0d41d1b
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Fri Apr 02 14:34:35 2010 -0400
description:
Removed 'Shared Histories' from history options menu because it doesn't work and is redundant as users can view shared/accessible/published histories from 'Saved Histories'.
diffstat:
templates/root/index.mako | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diffs (13 lines):
diff -r b95a24c9187e -r 72daa0d41d1b templates/root/index.mako
--- a/templates/root/index.mako Fri Apr 02 14:23:55 2010 -0400
+++ b/templates/root/index.mako Fri Apr 02 14:34:35 2010 -0400
@@ -10,9 +10,6 @@
"Saved Histories": function() {
galaxy_main.location = "${h.url_for( controller='history', action='list')}";
},
- "Shared Histories": function() {
- galaxy_main.location = "${h.url_for( controller='history', action='list', operation='sharing' )}";
- },
"Histories Shared with Me": function() {
galaxy_main.location = "${h.url_for( controller='history', action='list_shared')}";
},
1
0