I'm passing a few variables from the controller(including one of them a 
list) to the view and I have a link that is built using those 
variables.Below is the controller function:

def indexResumo():
    meses = 
{'Janeiro':1,'Fevereiro':2,'Março':3,'Abril':4,'Maio':5,'Junho':6,'Julho':7,'Agosto':8,'Setembro':9,'Outubro':10,'Novembro':11,'Dezembro':12}
    newlist=[]
    year =request.now.year
    name = session.auth.user.first_name + ' ' + session.auth.user.last_name
    month = (list(meses.keys())[list(meses.values()).index(request.now.month - 
1)])
    query = (db.auth_user.Supervisor == session.auth.user.id)
    colaboradores = 
db(query).select(db.auth_user.first_name,db.auth_user.last_name)
    for x in colaboradores:
        newlist.append(x.first_name + ' ' + x.last_name)

    return locals()


And here is part of the view "indexResumo" that matters:

<a 
href="{{=URL('default','resumoMensalTMN',vars={'nome':name,'mes':month,'ano':year,'colaboradores':newlist})}}">

<a 
href="{{=URL('default','resumoMensalLocal',vars={'nome':name,'mes':month,'ano':year,'colaboradores':newlist})}}">


When the above link loads, I have a javascript function that reads each of 
the variables passed:

getUrlVars()["name_of_the_var"];


My question is,what would be better: reading the variables this way, or 
move the code in the function "indexResumo" to both functions 
"resumoMensalTMN" and "resumoMensalLocal",have no variables sent in the 
url, and read those via json on my view? I hope I made any sense here.

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to