The attached file contains the code that is generating the error, line 4 
specifically is called out in the traceback, but if I comment this line out 
I get the same error from the next line that is querying the database. If I 
start a web2py shell, I can copy and paste the offending line into the 
shell and it returns the expected results, also if I switch the database 
back to sqlite everything works as expected.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@auth.requires_login()
def show():

    use_case_set = list({row.use_case_name for row in db(db.scenarios).select()})

    if request.vars.use_case:
        use_case = request.vars.use_case
        # Kind of annoying, form doesn't overwrite the previous args, just creates a list and appends, shows when
        # arriving here after an update, then switching use cases
        if type(use_case) == list:
            use_case = use_case[-1]
    else:
        if use_case_set:
            use_case = use_case_set[0]
        else:
            use_case = ""

    fields = [
        Field('use_case', lablel='Use Case', default=use_case,
              requires=IS_IN_SET(use_case_set))
    ]

    use_case_form = SQLFORM.factory(
        *fields,
        links=[],
        submit_button="SELECT"
    )

    query = (db.scenarios.use_case_name == use_case)

    fields = [
        db.scenarios.name,
        db.scenarios.scenario_summary,
    ]

    headers = {
        "scenarios.name": "Scenario",
        "scenarios.scenario_summary": "Summary"
    }

    scenario_form = SQLFORM.grid(
        query=query,
        fields=fields,
        headers=headers,
        create=False,
        deletable=False,
        editable=False,
        details=False,
        maxtextlength=400,
        links=[
            lambda row: A("VIEW / UPDATE", _href=URL("scenarios", "update", args=[row.id])),
            lambda row: A("DELETE", _href=URL("scenarios", "delete", args=[row.id])),
        ]
    )

    return dict(use_case=use_case, use_case_form=use_case_form, scenario_form=scenario_form)

Reply via email to