New recent nuance on this. Is there any way to avoid the conditional 
phrasing in function add_new_anything below?  

The problem is there is a user prompt in select_country_manually function 
that is called called from add_new_anything. The _href in 
select_country_manually requires a controller to go to in order to capture 
the correct country and then exit.  Then I have to build conditionals to 
let the script pickup where it left off in add_new_anything.

Is this the only way to write this? It is anticipated that 
select_country_manually will be called from many different functions.


Alex Glaros

def add_new_anything():
    populating_address_type = str(request.get_vars.populating_address_type)
    session.populating_address_type = populating_address_type
    session.countryID = request.get_vars.countryID
    if not session.countryID:
        redirect(URL('default', 'select_country_manually', vars = 
= 'add_new_anything')))
    response.title = session.countryID
    return locals()

def select_country_manually():
    controller_to_return_to = request.get_vars.controller_to_return_to
    session.countryID = None
    session.country_name = None
    db.Country.country_name.represent = lambda v, r: A(v, _href = URL(
'default', controller_to_return_to, vars = dict(countryID = 
    grid = SQLFORM.grid(db.Country, editable = False, deletable = False, 
create = False,  details = False, maxtextlength = {'Country.country_name':
'140'}, paginate = 300, fields = [, db.Country.country_name, db
    response.title = T('Select country')
    return locals()

- (Documentation)
- (Source code)
- (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 
For more options, visit

Reply via email to