示例#1
0
def show_indices(id, id2):
    bread = [['⌂', url_for('index')],
             [url_pref.strip('/'),
              url_for('inventory_app.show_edit_root')],
             [id, url_for('inventory_app.show_edit_child', id=id)],
             [id2,
              url_for('inventory_app.show_inventory', id=id, id2=id2)],
             [
                 'indices',
                 url_for('inventory_app.show_indices', id=id, id2=id2)
             ]]
    try:
        valid = inventory_viewer.is_valid_db_collection(id, id2)
        if not valid:
            raise BadNameError('')
        nice_name = inventory_viewer.get_nicename(db_name=id,
                                                  collection_name=id2)
    except BadNameError as e:
        return render_template(
            'edit_bad_name.html',
            db_name=id,
            coll_name=id2,
            bread=[
                ['⌂', url_for('index')],
                [url_pref.strip('/'),
                 url_for('inventory_app.show_edit_root')],
                [id, url_for('inventory_app.show_edit_child', id=id)],
                [id2,
                 url_for('inventory_app.show_indices', id=id, id2=id2)]
            ])
    except ih.ConnectOrAuthFail as e:
        linv.log_dest.error("Returning auth fail page")

        new_url = str(request.referrer)

        bread = [['⌂', url_for('index')],
                 [
                     url_pref.strip('/'),
                     url_for('inventory_app.show_edit_root')
                 ]]
        mess = "Connect or Auth failure: (" + str(
            dt.now().strftime('%d/%m/%y %H:%M:%S')) + ") " + e.message
        return render_template('edit_authfail.html',
                               new_url=new_url,
                               message=mess,
                               submit_contact=linv.email_contact,
                               bread=bread)
    return render_template('view_indices.html',
                           db_name=id,
                           collection_name=id2,
                           bread=bread,
                           nice_name=nice_name,
                           index_fields=linv.index_field_order())
示例#2
0
def show_indices(id, id2):
    bread=[['⌂', url_for('index')],[url_pref.strip('/'), url_for('inventory_app.show_edit_root')], [id, url_for('inventory_app.show_edit_child', id=id)], [id2, url_for('inventory_app.show_inventory', id=id, id2=id2)], ['indices', url_for('inventory_app.show_indices', id=id, id2=id2)]]
    try:
        valid = inventory_viewer.is_valid_db_table(id, id2)
        if not valid:
            raise BadNameError('')
        nice_name = inventory_viewer.get_nicename(db_name = id, table_name = id2)
    except BadNameError as e:
        return render_template('edit_bad_name.html', db_name=id, table_name=id2, bread=[['⌂', url_for('index')],[url_pref.strip('/'), url_for('inventory_app.show_edit_root')],[id, url_for('inventory_app.show_edit_child', id=id)], [id2, url_for('inventory_app.show_indices', id=id, id2=id2)]])
    except ih.ConnectOrAuthFail as e:
        linv.log_dest.error("Returning auth fail page")

        new_url = str(request.referrer)

        bread=[['⌂', url_for('index')],[url_pref.strip('/'), url_for('inventory_app.show_edit_root')]]
        mess = "Connect or Auth failure: ("+str(dt.now().strftime('%d/%m/%y %H:%M:%S'))+") "+e.message
        return render_template('edit_authfail.html', new_url=new_url, message = mess, submit_contact=linv.email_contact, bread=bread)
    return render_template('view_indices.html', db_name=id, table_name=id2, bread=bread, nice_name=nice_name, index_fields=linv.index_field_order())