我正在使用谷歌应用引擎,我有 2 个类,即 A 和 B,一个 db 模型说 DB,我已经在 A 类中处理了 DB 模型的对象,我想在 B 类中发送相同的对象,我该怎么做这?这是我的代码,
class Candidate(db.Model):
name = db.StringProperty()
lastname = db.StringProperty()
email = db.StringProperty()
mobno = db.StringProperty()
class A(webapp2.RequestHandler):
def post(self):
currCandidate = Candidate(key_name=self.request.get('email'))
currCandidate.name = self.request.get('name')
currCandidate.lastname=self.request.get('lname')
currCandidate.email=self.request.get('email')
currCandidate.mobno=self.request.get('mobno')
class B(webapp2.RequestHandler):
def get(self):
# currCandidate
# want to access currCandidate object here,
# currCandidate is from class A
我想从 B 类访问 currCandidate 对象。