• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python web_util.escape函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tool_shed.util.web_util.escape函数的典型用法代码示例。如果您正苦于以下问题:Python escape函数的具体用法?Python escape怎么用?Python escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了escape函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: undelete_category

 def undelete_category( self, trans, **kwd ):
     message = escape( kwd.get( 'message', '' ) )
     status = kwd.get( 'status', 'done' )
     id = kwd.get( 'id', None )
     if id:
         ids = util.listify( id )
         count = 0
         undeleted_categories = ""
         for category_id in ids:
             category = suc.get_category( trans.app, category_id )
             if category.deleted:
                 category.deleted = False
                 trans.sa_session.add( category )
                 trans.sa_session.flush()
                 # Update the Tool Shed's repository registry.
                 trans.app.repository_registry.add_category_entry( category )
                 count += 1
                 undeleted_categories += " %s" % category.name
         message = "Undeleted %d categories: %s" % ( count, escape( undeleted_categories ) )
     else:
         message = "No category ids received for undeleting."
         status = 'error'
     trans.response.send_redirect( web.url_for( controller='admin',
                                                action='manage_categories',
                                                message=util.sanitize_text( message ),
                                                status='done' ) )
开发者ID:ValentinaPeona,项目名称:galaxy,代码行数:26,代码来源:admin.py


示例2: create_category

 def create_category(self, trans, **kwd):
     message = escape(kwd.get('message', ''))
     status = kwd.get('status', 'done')
     name = kwd.get('name', '').strip()
     description = kwd.get('description', '').strip()
     if kwd.get('create_category_button', False):
         if not name or not description:
             message = 'Enter a valid name and a description'
             status = 'error'
         elif suc.get_category_by_name(trans.app, name):
             message = 'A category with that name already exists'
             status = 'error'
         else:
             # Create the category
             category = trans.app.model.Category(name=name, description=description)
             trans.sa_session.add(category)
             trans.sa_session.flush()
             # Update the Tool Shed's repository registry.
             trans.app.repository_registry.add_category_entry(category)
             message = "Category '%s' has been created" % escape(category.name)
             status = 'done'
             trans.response.send_redirect(web.url_for(controller='admin',
                                                      action='manage_categories',
                                                      message=message,
                                                      status=status))
     return trans.fill_template('/webapps/tool_shed/category/create_category.mako',
                                name=name,
                                description=description,
                                message=message,
                                status=status)
开发者ID:ImmPortDB,项目名称:immport-galaxy,代码行数:30,代码来源:admin.py


示例3: purge_category

 def purge_category(self, trans, **kwd):
     # This method should only be called for a Category that has previously been deleted.
     # Purging a deleted Category deletes all of the following from the database:
     # - RepoitoryCategoryAssociations where category_id == Category.id
     message = escape(kwd.get('message', ''))
     id = kwd.get('id', None)
     if id:
         ids = util.listify(id)
         count = 0
         purged_categories = ""
         message = "Purged %d categories: " % len(ids)
         for category_id in ids:
             category = suc.get_category(trans.app, category_id)
             if category.deleted:
                 # Delete RepositoryCategoryAssociations
                 for rca in category.repositories:
                     trans.sa_session.delete(rca)
                 trans.sa_session.flush()
                 purged_categories += " %s " % category.name
         message = "Purged %d categories: %s" % (count, escape(purged_categories))
     else:
         message = "No category ids received for purging."
     trans.response.send_redirect(web.url_for(controller='admin',
                                              action='manage_categories',
                                              message=util.sanitize_text(message),
                                              status='done'))
开发者ID:ImmPortDB,项目名称:immport-galaxy,代码行数:26,代码来源:admin.py


示例4: create_component

 def create_component( self, trans, **kwd ):
     message = escape( kwd.get( 'message', '' ) )
     status = kwd.get( 'status', 'done' )
     name = kwd.get( 'name', '' )
     description = kwd.get( 'description', '' )
     if kwd.get( 'create_component_button', False ):
         if not name or not description:
             message = 'Enter a valid name and a description'
             status = 'error'
         elif review_util.get_component_by_name( trans.app, name ):
             message = 'A component with that name already exists'
             status = 'error'
         else:
             component = trans.app.model.Component( name=name, description=description )
             trans.sa_session.add( component )
             trans.sa_session.flush()
             message = "Component '%s' has been created" % escape( component.name )
             status = 'done'
             trans.response.send_redirect( web.url_for( controller='repository_review',
                                                        action='manage_components',
                                                        message=message,
                                                        status=status ) )
     return trans.fill_template( '/webapps/tool_shed/repository_review/create_component.mako',
                                 name=name,
                                 description=description,
                                 message=message,
                                 status=status )
开发者ID:galaxyguardians,项目名称:galaxy,代码行数:27,代码来源:repository_review.py


示例5: mark_category_deleted

 def mark_category_deleted( self, trans, **kwd ):
     # TODO: We should probably eliminate the Category.deleted column since it really makes no
     # sense to mark a category as deleted (category names and descriptions can be changed instead).
     # If we do this, and the following 2 methods can be eliminated.
     message = escape( kwd.get( 'message', '' ) )
     status = kwd.get( 'status', 'done' )
     id = kwd.get( 'id', None )
     if id:
         ids = util.listify( id )
         message = "Deleted %d categories: " % len( ids )
         for category_id in ids:
             category = suc.get_category( trans.app, category_id )
             category.deleted = True
             trans.sa_session.add( category )
             trans.sa_session.flush()
             # Update the Tool Shed's repository registry.
             trans.app.repository_registry.remove_category_entry( category )
             message += " %s " % escape( category.name )
     else:
         message = "No category ids received for deleting."
         status = 'error'
     trans.response.send_redirect( web.url_for( controller='admin',
                                                action='manage_categories',
                                                message=util.sanitize_text( message ),
                                                status='done' ) )
开发者ID:ValentinaPeona,项目名称:galaxy,代码行数:25,代码来源:admin.py


示例6: create_category

 def create_category(self, trans, **kwd):
     message = escape(kwd.get("message", ""))
     status = kwd.get("status", "done")
     name = kwd.get("name", "").strip()
     description = kwd.get("description", "").strip()
     if kwd.get("create_category_button", False):
         if not name or not description:
             message = "Enter a valid name and a description"
             status = "error"
         elif suc.get_category_by_name(trans.app, name):
             message = "A category with that name already exists"
             status = "error"
         else:
             # Create the category
             category = trans.app.model.Category(name=name, description=description)
             trans.sa_session.add(category)
             trans.sa_session.flush()
             # Update the Tool Shed's repository registry.
             trans.app.repository_registry.add_category_entry(category)
             message = "Category '%s' has been created" % escape(category.name)
             status = "done"
             trans.response.send_redirect(
                 web.url_for(controller="admin", action="manage_categories", message=message, status=status)
             )
     return trans.fill_template(
         "/webapps/tool_shed/category/create_category.mako",
         name=name,
         description=description,
         message=message,
         status=status,
     )
开发者ID:mb12985,项目名称:Galaxy,代码行数:31,代码来源:admin.py


示例7: upload

 def upload( self, trans, **kwd ):
     message = escape( kwd.get( 'message', '' ) )
     status = kwd.get( 'status', 'done' )
     commit_message = escape( kwd.get( 'commit_message', 'Uploaded'  ) )
     category_ids = util.listify( kwd.get( 'category_id', '' ) )
     categories = suc.get_categories( trans.app )
     repository_id = kwd.get( 'repository_id', '' )
     repository = suc.get_repository_in_tool_shed( trans.app, repository_id )
     repo_dir = repository.repo_path( trans.app )
     repo = hg_util.get_repo_for_repository( trans.app, repository=None, repo_path=repo_dir, create=False )
     uncompress_file = util.string_as_bool( kwd.get( 'uncompress_file', 'true' ) )
     remove_repo_files_not_in_tar = util.string_as_bool( kwd.get( 'remove_repo_files_not_in_tar', 'true' ) )
     uploaded_file = None
     upload_point = commit_util.get_upload_point( repository, **kwd )
     tip = repository.tip( trans.app )
     file_data = kwd.get( 'file_data', '' )
     url = kwd.get( 'url', '' )
     # Part of the upload process is sending email notification to those that have registered to
     # receive them.  One scenario occurs when the first change set is produced for the repository.
     # See the suc.handle_email_alerts() method for the definition of the scenarios.
     new_repo_alert = repository.is_new( trans.app )
     uploaded_directory = None
     if kwd.get( 'upload_button', False ):
         if file_data == '' and url == '':
             message = 'No files were entered on the upload form.'
             status = 'error'
             uploaded_file = None
         elif url and url.startswith( 'hg' ):
             # Use mercurial clone to fetch repository, contents will then be copied over.
             uploaded_directory = tempfile.mkdtemp()
             repo_url = 'http%s' % url[ len( 'hg' ): ]
             repo_url = repo_url.encode( 'ascii', 'replace' )
             try:
                 commands.clone( hg_util.get_configured_ui(), repo_url, uploaded_directory )
             except Exception, e:
                 message = 'Error uploading via mercurial clone: %s' % basic_util.to_html_string( str( e ) )
                 status = 'error'
                 basic_util.remove_dir( uploaded_directory )
                 uploaded_directory = None
         elif url:
             valid_url = True
             try:
                 stream = urllib.urlopen( url )
             except Exception, e:
                 valid_url = False
                 message = 'Error uploading file via http: %s' % str( e )
                 status = 'error'
                 uploaded_file = None
             if valid_url:
                 fd, uploaded_file_name = tempfile.mkstemp()
                 uploaded_file = open( uploaded_file_name, 'wb' )
                 while 1:
                     chunk = stream.read( util.CHUNK_SIZE )
                     if not chunk:
                         break
                     uploaded_file.write( chunk )
                 uploaded_file.flush()
                 uploaded_file_filename = url.split( '/' )[ -1 ]
                 isempty = os.path.getsize( os.path.abspath( uploaded_file_name ) ) == 0
开发者ID:BinglanLi,项目名称:galaxy,代码行数:59,代码来源:upload.py


示例8: handle_role_associations

def handle_role_associations( app, role, repository, **kwd ):
    sa_session = app.model.context.current
    message = escape( kwd.get( 'message', '' ) )
    status = kwd.get( 'status', 'done' )
    repository_owner = repository.user
    if kwd.get( 'manage_role_associations_button', False ):
        in_users_list = util.listify( kwd.get( 'in_users', [] ) )
        in_users = [ sa_session.query( app.model.User ).get( x ) for x in in_users_list ]
        # Make sure the repository owner is always associated with the repostory's admin role.
        owner_associated = False
        for user in in_users:
            if user.id == repository_owner.id:
                owner_associated = True
                break
        if not owner_associated:
            in_users.append( repository_owner )
            message += "The repository owner must always be associated with the repository's administrator role.  "
            status = 'error'
        in_groups_list = util.listify( kwd.get( 'in_groups', [] ) )
        in_groups = [ sa_session.query( app.model.Group ).get( x ) for x in in_groups_list ]
        in_repositories = [ repository ]
        app.security_agent.set_entity_role_associations( roles=[ role ],
                                                               users=in_users,
                                                               groups=in_groups,
                                                               repositories=in_repositories  )
        sa_session.refresh( role )
        message += "Role <b>%s</b> has been associated with %d users, %d groups and %d repositories.  " % \
            ( escape( str( role.name ) ), len( in_users ), len( in_groups ), len( in_repositories ) )
    in_users = []
    out_users = []
    in_groups = []
    out_groups = []
    for user in sa_session.query( app.model.User ) \
                          .filter( app.model.User.table.c.deleted==False ) \
                          .order_by( app.model.User.table.c.email ):
        if user in [ x.user for x in role.users ]:
            in_users.append( ( user.id, user.email ) )
        else:
            out_users.append( ( user.id, user.email ) )
    for group in sa_session.query( app.model.Group ) \
                           .filter( app.model.Group.table.c.deleted==False ) \
                           .order_by( app.model.Group.table.c.name ):
        if group in [ x.group for x in role.groups ]:
            in_groups.append( ( group.id, group.name ) )
        else:
            out_groups.append( ( group.id, group.name ) )
    associations_dict = dict( in_users=in_users,
                              out_users=out_users,
                              in_groups=in_groups,
                              out_groups=out_groups,
                              message=message,
                              status=status )
    return associations_dict
开发者ID:BinglanLi,项目名称:galaxy,代码行数:53,代码来源:repository_util.py


示例9: edit_category

 def edit_category(self, trans, **kwd):
     '''Handle requests to edit TS category name or description'''
     message = escape(kwd.get('message', ''))
     status = kwd.get('status', 'done')
     id = kwd.get('id', None)
     if not id:
         message = "No category ids received for editing"
         trans.response.send_redirect(web.url_for(controller='admin',
                                                  action='manage_categories',
                                                  message=message,
                                                  status='error'))
     category = suc.get_category(trans.app, id)
     original_category_name = str(category.name)
     original_category_description = str(category.description)
     if kwd.get('edit_category_button', False):
         flush_needed = False
         new_name = kwd.get('name', '').strip()
         new_description = kwd.get('description', '').strip()
         if original_category_name != new_name:
             if not new_name:
                 message = 'Enter a valid name'
                 status = 'error'
             elif original_category_name != new_name and suc.get_category_by_name(trans.app, new_name):
                 message = 'A category with that name already exists'
                 status = 'error'
             else:
                 category.name = new_name
                 flush_needed = True
         if original_category_description != new_description:
             category.description = new_description
             if not flush_needed:
                 flush_needed = True
         if flush_needed:
             trans.sa_session.add(category)
             trans.sa_session.flush()
             if original_category_name != new_name:
                 # Update the Tool Shed's repository registry.
                 trans.app.repository_registry.edit_category_entry(original_category_name, new_name)
             message = "The information has been saved for category '%s'" % escape(category.name)
             status = 'done'
             return trans.response.send_redirect(web.url_for(controller='admin',
                                                             action='manage_categories',
                                                             message=message,
                                                             status=status))
     return trans.fill_template('/webapps/tool_shed/category/edit_category.mako',
                                category=category,
                                message=message,
                                status=status)
开发者ID:ImmPortDB,项目名称:immport-galaxy,代码行数:48,代码来源:admin.py


示例10: delete_repository_metadata

 def delete_repository_metadata(self, trans, **kwd):
     message = escape(kwd.get("message", ""))
     status = kwd.get("status", "done")
     id = kwd.get("id", None)
     if id:
         ids = util.listify(id)
         count = 0
         for repository_metadata_id in ids:
             repository_metadata = metadata_util.get_repository_metadata_by_id(trans.app, repository_metadata_id)
             trans.sa_session.delete(repository_metadata)
             trans.sa_session.flush()
             count += 1
         if count:
             message = "Deleted %d repository metadata %s" % (count, inflector.cond_plural(len(ids), "record"))
     else:
         message = "No repository metadata ids received for deleting."
         status = "error"
     trans.response.send_redirect(
         web.url_for(
             controller="admin",
             action="browse_repository_metadata",
             message=util.sanitize_text(message),
             status=status,
         )
     )
开发者ID:mb12985,项目名称:Galaxy,代码行数:25,代码来源:admin.py


示例11: check_for_updates

def check_for_updates( app, model, repository_id=None ):
    message = ''
    status = 'ok'
    if repository_id is None:
        success_count = 0
        repository_names_not_updated = []
        updated_count = 0
        for repository in model.context.query( model.ToolShedRepository ) \
                                       .filter( model.ToolShedRepository.table.c.deleted == false() ):
            ok, updated = \
                check_or_update_tool_shed_status_for_installed_repository( app, repository )
            if ok:
                success_count += 1
            else:
                repository_names_not_updated.append( '<b>%s</b>' % escape( str( repository.name ) ) )
            if updated:
                updated_count += 1
        message = "Checked the status in the tool shed for %d repositories.  " % success_count
        message += "Updated the tool shed status for %d repositories.  " % updated_count
        if repository_names_not_updated:
            message += "Unable to retrieve status from the tool shed for the following repositories:\n"
            message += ", ".join( repository_names_not_updated )
    else:
        repository = suc.get_tool_shed_repository_by_id( app, repository_id )
        ok, updated = \
            check_or_update_tool_shed_status_for_installed_repository( app, repository )
        if ok:
            if updated:
                message = "The tool shed status for repository <b>%s</b> has been updated." % escape( str( repository.name ) )
            else:
                message = "The status has not changed in the tool shed for repository <b>%s</b>." % escape( str( repository.name ) )
        else:
            message = "Unable to retrieve status from the tool shed for repository <b>%s</b>." % escape( str( repository.name ) )
            status = 'error'
    return message, status
开发者ID:BenjaminHCCarr,项目名称:galaxy,代码行数:35,代码来源:repository_util.py


示例12: edit_component

 def edit_component( self, trans, **kwd ):
     message = escape( kwd.get( 'message', '' ) )
     status = kwd.get( 'status', 'done' )
     id = kwd.get( 'id', None )
     if not id:
         message = "No component ids received for editing"
         trans.response.send_redirect( web.url_for( controller='admin',
                                                    action='manage_categories',
                                                    message=message,
                                                    status='error' ) )
     component = review_util.get_component( trans.app, id )
     if kwd.get( 'edit_component_button', False ):
         new_description = kwd.get( 'description', '' ).strip()
         if component.description != new_description:
             component.description = new_description
             trans.sa_session.add( component )
             trans.sa_session.flush()
             message = "The information has been saved for the component named <b>%s</b>" % escape( component.name )
             status = 'done'
             return trans.response.send_redirect( web.url_for( controller='repository_review',
                                                               action='manage_components',
                                                               message=message,
                                                               status=status ) )
     return trans.fill_template( '/webapps/tool_shed/repository_review/edit_component.mako',
                                 component=component,
                                 message=message,
                                 status=status )
开发者ID:galaxyguardians,项目名称:galaxy,代码行数:27,代码来源:repository_review.py


示例13: review_tool_migration_stages

 def review_tool_migration_stages( self, trans, **kwd ):
     message = escape( galaxy.util.restore_text( kwd.get( 'message', '' ) ) )
     status = galaxy.util.restore_text( kwd.get( 'status', 'done' ) )
     migration_stages_dict = odict()
     migration_modules = []
     migration_scripts_dir = os.path.abspath( os.path.join( trans.app.config.root, 'lib', 'tool_shed', 'galaxy_install', 'migrate', 'versions' ) )
     migration_scripts_dir_contents = os.listdir( migration_scripts_dir )
     for item in migration_scripts_dir_contents:
         if os.path.isfile( os.path.join( migration_scripts_dir, item ) ) and item.endswith( '.py' ):
             module = item.replace( '.py', '' )
             migration_modules.append( module )
     if migration_modules:
         migration_modules.sort()
         # Remove the 0001_tools.py script since it is the seed.
         migration_modules = migration_modules[ 1: ]
         # Reverse the list so viewing will be newest to oldest.
         migration_modules.reverse()
     for migration_module in migration_modules:
         migration_stage = int( migration_module.replace( '_tools', '' ) )
         repo_name_dependency_tups = self.check_for_tool_dependencies( trans, migration_stage )
         open_file_obj, file_name, description = imp.find_module( migration_module, [ migration_scripts_dir ] )
         imported_module = imp.load_module( 'upgrade', open_file_obj, file_name, description )
         migration_info = imported_module.__doc__
         open_file_obj.close()
         migration_stages_dict[ migration_stage ] = ( migration_info, repo_name_dependency_tups )
     return trans.fill_template( 'admin/review_tool_migration_stages.mako',
                                 migration_stages_dict=migration_stages_dict,
                                 message=message,
                                 status=status )
开发者ID:ashvark,项目名称:galaxy,代码行数:29,代码来源:admin.py


示例14: regenerate_statistics

 def regenerate_statistics(self, trans, **kwd):
     message = escape(kwd.get("message", ""))
     status = kwd.get("status", "done")
     if "regenerate_statistics_button" in kwd:
         trans.app.shed_counter.generate_statistics()
         message = "Successfully regenerated statistics"
     return trans.fill_template("/webapps/tool_shed/admin/statistics.mako", message=message, status=status)
开发者ID:mb12985,项目名称:Galaxy,代码行数:7,代码来源:admin.py


示例15: create_repository

def create_repository(
    app,
    name,
    type,
    description,
    long_description,
    user_id,
    category_ids=[],
    remote_repository_url=None,
    homepage_url=None,
):
    """Create a new ToolShed repository"""
    sa_session = app.model.context.current
    # Add the repository record to the database.
    repository = app.model.Repository(
        name=name,
        type=type,
        remote_repository_url=remote_repository_url,
        homepage_url=homepage_url,
        description=description,
        long_description=long_description,
        user_id=user_id,
    )
    # Flush to get the id.
    sa_session.add(repository)
    sa_session.flush()
    # Create an admin role for the repository.
    repository_admin_role = create_repository_admin_role(app, repository)
    # Determine the repository's repo_path on disk.
    dir = os.path.join(app.config.file_path, *directory_hash_id(repository.id))
    # Create directory if it does not exist.
    if not os.path.exists(dir):
        os.makedirs(dir)
    # Define repo name inside hashed directory.
    repository_path = os.path.join(dir, "repo_%d" % repository.id)
    # Create local repository directory.
    if not os.path.exists(repository_path):
        os.makedirs(repository_path)
    # Create the local repository.
    repo = hg_util.get_repo_for_repository(app, repository=None, repo_path=repository_path, create=True)
    # Add an entry in the hgweb.config file for the local repository.
    lhs = "repos/%s/%s" % (repository.user.username, repository.name)
    app.hgweb_config_manager.add_entry(lhs, repository_path)
    # Create a .hg/hgrc file for the local repository.
    hg_util.create_hgrc_file(app, repository)
    flush_needed = False
    if category_ids:
        # Create category associations
        for category_id in category_ids:
            category = sa_session.query(app.model.Category).get(app.security.decode_id(category_id))
            rca = app.model.RepositoryCategoryAssociation(repository, category)
            sa_session.add(rca)
            flush_needed = True
    if flush_needed:
        sa_session.flush()
    # Update the repository registry.
    app.repository_registry.add_entry(repository)
    message = "Repository <b>%s</b> has been created." % escape(str(repository.name))
    return repository, message
开发者ID:sveinugu,项目名称:proto,代码行数:59,代码来源:repository_util.py


示例16: delete_repository

 def delete_repository(self, trans, **kwd):
     message = escape(kwd.get("message", ""))
     status = kwd.get("status", "done")
     id = kwd.get("id", None)
     if id:
         # Deleting multiple items is currently not allowed (allow_multiple=False), so there will only be 1 id.
         ids = util.listify(id)
         count = 0
         deleted_repositories = ""
         for repository_id in ids:
             repository = suc.get_repository_in_tool_shed(trans.app, repository_id)
             if repository:
                 if not repository.deleted:
                     # Mark all installable repository_metadata records as not installable.
                     for repository_metadata in repository.downloadable_revisions:
                         repository_metadata.downloadable = False
                         trans.sa_session.add(repository_metadata)
                     # Mark the repository admin role as deleted.
                     repository_admin_role = repository.admin_role
                     if repository_admin_role is not None:
                         repository_admin_role.deleted = True
                         trans.sa_session.add(repository_admin_role)
                     repository.deleted = True
                     trans.sa_session.add(repository)
                     trans.sa_session.flush()
                     # Update the repository registry.
                     trans.app.repository_registry.remove_entry(repository)
                     count += 1
                     deleted_repositories += " %s " % repository.name
         if count:
             message = "Deleted %d %s: %s" % (
                 count,
                 inflector.cond_plural(len(ids), "repository"),
                 escape(deleted_repositories),
             )
         else:
             message = "All selected repositories were already marked deleted."
     else:
         message = "No repository ids received for deleting."
         status = "error"
     trans.response.send_redirect(
         web.url_for(
             controller="admin", action="browse_repositories", message=util.sanitize_text(message), status=status
         )
     )
开发者ID:mb12985,项目名称:Galaxy,代码行数:45,代码来源:admin.py


示例17: regenerate_statistics

 def regenerate_statistics(self, trans, **kwd):
     message = escape(kwd.get('message', ''))
     status = kwd.get('status', 'done')
     if 'regenerate_statistics_button' in kwd:
         trans.app.shed_counter.generate_statistics()
         message = "Successfully regenerated statistics"
     return trans.fill_template('/webapps/tool_shed/admin/statistics.mako',
                                message=message,
                                status=status)
开发者ID:ImmPortDB,项目名称:immport-galaxy,代码行数:9,代码来源:admin.py


示例18: edit_category

 def edit_category(self, trans, **kwd):
     message = escape(kwd.get("message", ""))
     status = kwd.get("status", "done")
     id = kwd.get("id", None)
     if not id:
         message = "No category ids received for editing"
         trans.response.send_redirect(
             web.url_for(controller="admin", action="manage_categories", message=message, status="error")
         )
     category = suc.get_category(trans.app, id)
     original_category_name = str(category.name)
     original_category_description = str(category.description)
     if kwd.get("edit_category_button", False):
         flush_needed = False
         new_name = kwd.get("name", "").strip()
         new_description = kwd.get("description", "").strip()
         if original_category_name != new_name:
             if not new_name:
                 message = "Enter a valid name"
                 status = "error"
             elif original_category_name != new_name and suc.get_category_by_name(trans.app, new_name):
                 message = "A category with that name already exists"
                 status = "error"
             else:
                 category.name = new_name
                 flush_needed = True
             if original_category_description != new_description:
                 category.description = new_description
                 if not flush_needed:
                     flush_needed = True
             if flush_needed:
                 trans.sa_session.add(category)
                 trans.sa_session.flush()
                 if original_category_name != new_name:
                     # Update the Tool Shed's repository registry.
                     trans.app.repository_registry.edit_category_entry(original_category_name, new_name)
                 message = "The information has been saved for category '%s'" % escape(category.name)
                 status = "done"
                 return trans.response.send_redirect(
                     web.url_for(controller="admin", action="manage_categories", message=message, status=status)
                 )
     return trans.fill_template(
         "/webapps/tool_shed/category/edit_category.mako", category=category, message=message, status=status
     )
开发者ID:mb12985,项目名称:Galaxy,代码行数:44,代码来源:admin.py


示例19: manage_repositories_reviewed_by_me

 def manage_repositories_reviewed_by_me( self, trans, **kwd ):
     # The value of the received id is the encoded repository id.
     message = escape( kwd.get( 'message', '' ) )
     status = kwd.get( 'status', 'done' )
     if 'operation' in kwd:
         kwd[ 'mine' ] = True
         return trans.response.send_redirect( web.url_for( controller='repository_review',
                                                           action='manage_repositories_with_reviews',
                                                           **kwd ) )
     self.repositories_reviewed_by_me_grid.title = 'Repositories reviewed by me'
     return self.repositories_reviewed_by_me_grid( trans, **kwd )
开发者ID:BinglanLi,项目名称:galaxy,代码行数:11,代码来源:repository_review.py


示例20: approve_repository_review

 def approve_repository_review( self, trans, **kwd ):
     # The value of the received id is the encoded review id.
     message = escape( kwd.get( 'message', '' ) )
     status = kwd.get( 'status', 'done' )
     encoded_review_id = kwd[ 'id' ]
     review = review_util.get_review( trans.app, encoded_review_id )
     if kwd.get( 'approve_repository_review_button', False ):
         approved_select_field_name = '%s%sapproved' % ( encoded_review_id, STRSEP )
         approved_select_field_value = str( kwd[ approved_select_field_name ] )
         review.approved = approved_select_field_value
         trans.sa_session.add( review )
         trans.sa_session.flush()
         message = 'Approved value <b>%s</b> saved for this revision.' % escape( approved_select_field_value )
     repository_id = trans.security.encode_id( review.repository_id )
     changeset_revision = review.changeset_revision
     return trans.response.send_redirect( web.url_for( controller='repository_review',
                                                       action='manage_repository_reviews_of_revision',
                                                       id=repository_id,
                                                       changeset_revision=changeset_revision,
                                                       message=message,
                                                       status=status ) )
开发者ID:galaxyguardians,项目名称:galaxy,代码行数:21,代码来源:repository_review.py



注:本文中的tool_shed.util.web_util.escape函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap