webpyを使ってブログを作ろうとしています。
def getThread(self,num):
myvar = dict(numero=num)
print myvar
que = self.datab.select('contenidos',vars=myvar,what='contentTitle,content,update',where="category LIKE %%s%" %numero)
return que
私はあなたがこのウェブで答えるヒントのいくつかを使用しましたが、私は
<type'exceptions.NameError'> at / globalname'numero'が定義されていません
Python C:getThreadの\ xampp \ htdocs \ webpy \ Functions.py、42行目
Web GET http://:8080/
..。
分類された投稿をいくつか選択しようとしています。カテゴリ名とIDのテーブルがあります。コンテンツテーブルには、「1,2,3,5」の形式の文字列を受け取る列があります。
次に、LIKEステートメントといくつかの%something%マジックを使用して、正しいエントリを選択できると思います。しかし、私にはこの問題があります。
Webを構築する.pyファイルからコードを呼び出します。importステートメントは正しく機能します。getThreadはこのクラス内で定義されています。
class categoria(object):
def __init__(self,datab,nombre):
self.nombre = nombre
self.datab = datab
self.n = str(self.getCat()) #making the integer to be a string
self.thread = self.getThread(self.n)
return self.thread
def getCat(self):
'''
returns the id of the categorie (integer)
'''
return self.datab.select('categorias',what='catId', where='catName = %r' %(self.nombre), limit=1)