[web2py] Re: what to put in models besides models?
I think in theory you should be able to do that, but do you really want to be opening all those files on every page request? Can you show what code generated the error? My line 109 in appadmin is blank.
[web2py] Re: what to put in models besides models?
'sorted' is a Python builtin, and it happens to be called in the appadmin.html view. All variables/objects created in the model files are available in the view environment as well, so you have redefined the Python builtin sorted() function as a dictionary -- *sorted=Analises*. To be safe, try to avoid using Python keywords as variable names. Anthony On Thursday, July 21, 2011 11:53:19 AM UTC-4, Ramos wrote: hello, i have some startup variables that i defined in db.py when i go to database administration i get an error. Traceback (most recent call last): File gluon/restricted.py, line 192, in restricted File D:/web2py10/web2py/applications/Lims/views/appadmin.html, line 109, in module TypeError: 'dict' object is not callable the code i added to db.py is this import pickle file = open(d:\\Analises.pck, r) *Analises = pickle.load(file)* file.close() file = open(d:\\Unidades.pck, r) Unidades= pickle.load(file) file.close() file = open(d:\\Templates.pck, r) *Templates = pickle.load(file)* file.close() file = open(d:\\Tipo.pck, r) Tipo = pickle.load(file) file.close() *sorted=Analises* What could be the cause for the error? and again, what can i not declare in models? thank you António
[web2py] Re: what to put in models besides models?
On Thursday, July 21, 2011 12:01:56 PM UTC-4, pbreit wrote: I think in theory you should be able to do that, but do you really want to be opening all those files on every page request? Can you show what code generated the error? My line 109 in appadmin is blank. Note, in tracebacks for view errors, I believe the line numbers refer to the view code _after_ it has been converted to Python, not the original template code. Anthony
Re: [web2py] Re: what to put in models besides models?
My traceback gives this in line 109 * for db in sorted(databases):* * * * * * * 2011/7/21 Anthony abasta...@gmail.com On Thursday, July 21, 2011 12:01:56 PM UTC-4, pbreit wrote: I think in theory you should be able to do that, but do you really want to be opening all those files on every page request? Can you show what code generated the error? My line 109 in appadmin is blank. Note, in tracebacks for view errors, I believe the line numbers refer to the view code _after_ it has been converted to Python, not the original template code. Anthony