Please help me to understand the behaviour of the following controller.  It
receives a name of a table and that table's title-field from a form.

def lys_vermiste_titels():
    """
    tt = title-field
    tabel = tabelname
    """
    tabel = request.vars.tabel
    tt = request.vars.tt
    db[tabel].id.represents = lambda id, row: A(T('check'),
                         _href = URL(r = request, c = 'default',
                                   f = 'hanteer_vermiste_titels',
                                       vars = dict(id = str(id), tabel =
tabel, tt = tt)))

    query =  db.akb_articles.title==None
    fields = [db[tabel].id, db[tabel][tt]]
    # tb  = SQLFORM.grid(query, fields = fields,
    #                    left = db.akb_articles.on(db.akb_articles.ltitle
== db[tabel].ltitle),
    #                    editable = False, searchable = False, create =
False,
    #                    deletable = False)
    tb  = SQLTABLE(db(query).select(
        db[tabel].id, db[tabel][tt],
        left = db.akb_articles.on(db.akb_articles.ltitle ==
db[tabel].ltitle)), truncate = 150)
    lengte = len(tb)
    if lengte:
        print tb
        opskrif = H2(T("Titles in %s which are not in  AKB") % tabel)
    else:
        opskrif = H2(T('All the article titles in %s are in AKB') % tabel)
        tb = H3(P(T('No absent titles.')))
    return dict(vorm = tb, opskrif = opskrif)

1. If I use the SQLFORM.grid (commented out in this example) in this case:
the fields are all empty although the number of records for the query is
the same as in the second case where I use tb = SQLTABLE which presents the
expected data.  Why would this be?
2. My .represent definition has no effect.  I get the bare id numbers in
the view.  Why?

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

Reply via email to