my code.py

class Index:
    """
        Class Index Controller.
        Show the report pages.
    """
    def GET(self):
        records = model.get_records()
        return render.index(records)

========================================================

my model.py

import web

db = web.database(dbn='mssql', host='the_host', db='the_database',
user='the_user', pw='the_password')

def get_records():
    records = db.query("SELECT * FROM varigvem.pesquisa_satisfacao
ORDER BY empresa")
    for row in records:
        print "%s" % str(row['empresa'])
    return records

========================================================

python2.7 code.py
http://0.0.0.0:8080/
ERR: SELECT * FROM varigvem.pesquisa_satisfacao ORDER BY empresa
Traceback (most recent call last):
  File "/home/leandro/tmp/report_marketing/web/application.py", line
242, in process
    return self.handle()
  File "/home/leandro/tmp/report_marketing/web/application.py", line
233, in handle
    return self._delegate(fn, self.fvars, args)
  File "/home/leandro/tmp/report_marketing/web/application.py", line
415, in _delegate
    return handle_class(cls)
  File "/home/leandro/tmp/report_marketing/web/application.py", line
390, in handle_class
    return tocall(*args)
  File "/home/leandro/tmp/report_marketing/code.py", line 22, in GET
    records = model.get_records()
  File "/home/leandro/tmp/report_marketing/model.py", line 6, in
get_records
    records = db.query("SELECT * FROM varigvem.pesquisa_satisfacao
ORDER BY empresa")
  File "/home/leandro/tmp/report_marketing/web/db.py", line 611, in
query
    self._db_execute(db_cursor, sql_query)
  File "/home/leandro/tmp/report_marketing/web/db.py", line 562, in
_db_execute
    out = cur.execute(sql_query.query(paramstyle), sql_query.values())
  File "/usr/lib/pymodules/python2.7/pymssql.py", line 192, in execute
    self._source.execute_query(operation, args[0])
ValueError: 'params' arg can be only a tuple or a dictionary.

127.0.0.1:34069 - - [18/Aug/2011 09:20:37] "HTTP/1.1 GET /" - 500
Internal Server Error

Any idea ?

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to