예제 #1
0
파일: view.py 프로젝트: fredvdd/Swan
	def __init__(self, control, statuslist):
		super(StatusForm, self).__init__('POST', '')
		self.setAttribute('id','sf')	
		self.controller = control
		self.statuslist = statuslist
		self.textarea = TextArea().setAttribute("placeholder", "What's up?")
		self.submit = SubmitButton("Honk!")
		self.add(self.textarea, self.submit)
		self.onSubmit(self.submit_status)
예제 #2
0
파일: view.py 프로젝트: fredvdd/Swan
class StatusForm(Form):

	def __init__(self, control, statuslist):
		super(StatusForm, self).__init__('POST', '')
		self.setAttribute('id','sf')	
		self.controller = control
		self.statuslist = statuslist
		self.textarea = TextArea().setAttribute("placeholder", "What's up?")
		self.submit = SubmitButton("Honk!")
		self.add(self.textarea, self.submit)
		self.onSubmit(self.submit_status)

	def submit_status(self):
		self.controller.submit_status(self.textarea.getValue(), self.sucessful, self.fail)
		return False;
	
	def sucessful(self,response):
		print "Submission successful"
		self.textarea.setValue("")
		
	def fail(self, status):
		print "Submission failed"