Do you mean this?

# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without
limitations

#########################################################################
## This is a samples controller
## - index is the default action of any application
## - user is required for authentication and authorization
## - download is for downloading files uploaded in the db (does streaming)
## - call exposes all registered services (none by default)
#########################################################################
def family():
    datasource = db(db.hijo.id>0).select()
    return dict(table=SQLTABLE(datasource),
                  powertable=plugin_powerTable(datasource))


@auth.requires_login()
def clientes():
    """
        Lista todos os clientes cadastrados
    """

    class Virtual(object):
        @virtualsettings(label=T('Nome do Cliente:'))
        def virtualtooltip(self):
            text = 'Endereço: %s'
            tooltiptext = T(text % self.cliente.endereco)
            return tooltiptext

    # Consultando todos os clientes
    query = db.cliente.id > 0 and db.cliente.aniversario <= request.now
    clientes = db(query).select(orderby=db.cliente.nome)

    #Preparando a tabela
    table = plugins.powerTable
    table.datasource = clientes
    table.uitheme = 'redmond'
    table.dtfeatures['sPaginationType'] = 'scrolling'
    table.keycolumn = 'cliente.id'
    table.columns = ['cliente.nome','cliente.endereco','cliente.telefone']
    table.headers = 'labels'
    table.showkeycolumn = False
    table.columnsearch = True
    table.extra =
dict(details={'detailscolumns':'cliente.nome,cliente.endereco,cliente.telefone'},
                       tooltip={'type':'virtual'}
                       )
    table.virtualfields = Virtual()

    #return dict(table=SQLTABLE(clientes))

    # Caso nao tiver nenhum registro mostrar mensagem
    if clientes:
        # Retornando os registros
        return dict(clientes=clientes, table = table.create())
    else:
        return dict(clientes = clientes, mensagem = T('sem_registros'))


def index():
    """
    example action using the internationalization operator T and flash
    rendered by views/default/index.html or views/generic.html
    """
    class Virtual(object):
        @virtualsettings(label=T('User Information:'))
        def virtualtooltip(self):
            text = 'This user mail address is %s'
            tooltiptext = T(text % self.auth_user.email)
            return tooltiptext

    response.flash = T('You are successfully running web2py.')

    # Consultando todos os funcionarios cadastrados
    # no sistema
    query = db.auth_user.id>0
    funcionarios = db(query).select(orderby=db.auth_user.first_name)

    #Preparando a tabela
    table = plugins.powerTable
    table.datasource = funcionarios
    table.uitheme = 'redmond'
    table.dtfeatures['sPaginationType'] = 'scrolling'
    table.keycolumn = 'auth_user.id'
    table.columns = ['auth_user.first_name','auth_user.last_name']
    table.headers = 'labels'
    table.showkeycolumn = False
    table.columnsearch = True
    table.extra = dict(details={'detailscolumns':'auth_user.email,
auth_user.id'},
                       tooltip={'type':'virtual'}
                       )

    table.virtualfields = Virtual()


    return dict(table=table.create())

def user():
    if request.args(0) == 'logout':
        #do something here
        db(db.table.id==someid).delete()
    return dict(form=auth())

2011/1/12 pk <[email protected]>

> hi togehter,
>
> how can i edit my own commands (for example i will delete something in
> a db table) if
> user get logged out? where can i do this?
>
> thanks peter




-- 

Bruno Rocha
http://about.me/rochacbruno/bio

Reply via email to