我有一个问题是我的 django 视图
def home(request):
try:
from_number = request.GET['from_number']
to_number = request.GET['to_number']
messagetext = request.GET['msg_text']
date_time = request.GET['date_time']
date_received = request.GET['date_received']
status = 0
except:
LOG_ERROR('Invalid Parameter')
#Return to some product page or 500 error with message
#pass # return some value after discussing with sir
# #Based on from number identify the Vmn and his class anc class the respective receieve method of that class
if from_number !=None and to_number != None:
try:getvmn = ServiceProvider.objects.get(status = False)
except:
LOG_FATAL("VMN doesn't exists ")
getvmn = False
if getvmn:
print "-=-=-=-=-==-=-=-==================="
# get_related_class = ServiceProvider.objects.filter(id = getvmn.merchant,status = False)
get_related_class = ServiceProvider.objects.get(status = False)
b = SMSMgr()
for objec in b._allsp:
if objec.class_Name == 'MessageNet':
# messageglobalobject =
MessageNet.receive(MessageGlobal(from_number,to_number,messagetext,date_received,status))
这是 smsmessage.py
class MessageGlobal():
def __init__(self,from_number,to_number,messagetext,date,status = None):
self.messagetext = messagetext
self.to_number = to_number
self.from_number = from_number
self.date = date
self.status = status
这是 MessageNet 类
class MessageNet():
def __init__(self,username,password,sendingurl,class_Name):
self.username = username
self.password = password
self.messagetext = None
self.sendingurl = sendingurl
self.class_Name = class_Name
self.PhoneNumber = None
# self.apiurl = apiurl
def send(self,mg):
payload = {'username': self.username, 'Pwd': self.password,'PhoneNumber':mg.tonumber,'PhoneMessage':mg.messagetext}
r = requests.get(self.sendingurl, params=payload)
LOG_INFO("Message sent to %s via %s", self.PhoneNumber,'Messagenet')
# Call to ms manager
def receive(self,getmessageobject):
print "receive and notify the user "
我收到错误消息
MessageNet.receive(MessageGlobal(from_number,to_number,messagetext,date_received,status))
of my views .
我正在尝试将 MessageGlobal 的对象传递给接收方法,以便我可以在 MessageNet 类的接收方法中访问它们。
请告诉我为什么会收到此错误。