예제 #1
0
 def set_payload(self, val, charset=None):
   self.modified = True
   try:
     val.seek(0)
     val = val.read()
   except: pass
   Message.set_payload(self,val,charset)
   self.submsg = None
예제 #2
0
파일: fbp822.py 프로젝트: stevegt/isconf4
 def mkmsg(self, type, _payload='', **kwargs):
     msg = Message()
     msg.add_header('_type', type)
     if _payload is not None:
         _payload = str(_payload)
         msg.set_payload(_payload)
         msg.add_header('_size', str(len(_payload)))
     else:
         msg.add_header('_size', str(0))
     for (var, val) in kwargs.items():
         if var.startswith("_"):
             raise Error822("parameter names can't start with '_'")
         msg.setheader(var, val)
     if self.authkey:
         msg.hmacset(self.authkey)
     return msg
예제 #3
0
 def mkmsg(self,type,_payload='',**kwargs):
     msg = Message()
     msg.add_header('_type',type)
     if _payload is not None:
         _payload=str(_payload)
         msg.set_payload(_payload)
         msg.add_header('_size',str(len(_payload)))
     else:
         msg.add_header('_size',str(0))
     for (var,val) in kwargs.items():
         if var.startswith("_"):
             raise Error822("parameter names can't start with '_'")
         msg.setheader(var,val)
     if self.authkey:
         msg.hmacset(self.authkey)
     return msg