フレームワークとして web.py を使用して Web サイトを構築しています。
これは私のURLです:
urls = (
'/', 'index',
'/search', 'search',
'/book/(.*)', 'book'
)
book クラスは次のようになります。
class book:
def GET(self, isbn):
isbnvar = "isbn = '{0}'".format(isbn)
book_details = db.select('books_bookdata',where=isbnvar)
return render.book(book_details,price) # price is a global variable
編集:私の本のテンプレートは-で始まります
$def with (book_details, price)
/book/9876543210987 に移動すると、__template__() takes no arguments (2 given)
エラーがスローされます。私は何が間違っているのか理解できません。
編集:これは完全なトレースバックです
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/web/application.py", line 239, in process
return self.handle()
File "/usr/local/lib/python2.7/dist-packages/web/application.py", line 230, in handle
return self._delegate(fn, self.fvars, args)
File "/usr/local/lib/python2.7/dist-packages/web/application.py", line 420, in _delegate
return handle_class(cls)
File "/usr/local/lib/python2.7/dist-packages/web/application.py", line 396, in handle_class
return tocall(*args)
File "/home/chaitanya/justcompare/code.py", line 45, in GET
return render.book(book_details,price)
File "/usr/local/lib/python2.7/dist-packages/web/template.py", line 881, in __call__
return BaseTemplate.__call__(self, *a, **kw)
File "/usr/local/lib/python2.7/dist-packages/web/template.py", line 808, in __call__
return self.t(*a, **kw)
TypeError: __template__() takes no arguments (2 given)