comparison data/plugin/action/submitemail.py @ 623:5f499a634857

FormSubmit: fix pep8, remove unused imports, ...
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Mar 2013 17:20:34 +0100
parents 12465aa315be
children bdebdc59b057
comparison
equal deleted inserted replaced
622:12465aa315be 623:5f499a634857
7 7
8 @copyright: 2008 by Peter Bodi <petrdll@centrum.sk> 8 @copyright: 2008 by Peter Bodi <petrdll@centrum.sk>
9 @license: GNU GPL, see COPYING for details. 9 @license: GNU GPL, see COPYING for details.
10 """ 10 """
11 11
12 import os, sys, codecs
13
14 from MoinMoin import wikiutil 12 from MoinMoin import wikiutil
15 from MoinMoin.action import ActionBase 13 from MoinMoin.action import ActionBase
16 from MoinMoin.Page import Page 14 from MoinMoin.Page import Page
17 from MoinMoin.mail.sendmail import sendmail 15 from MoinMoin.mail.sendmail import sendmail
18 16
19 from submitbase import SubmitBase 17 from submitbase import SubmitBase
20 18
19
21 def execute(pagename, request): 20 def execute(pagename, request):
22 submitemail(pagename, request).render() 21 submitemail(pagename, request).render()
22
23 23
24 class submitemail(SubmitBase): 24 class submitemail(SubmitBase):
25 25
26 def __init__(self, pagename, request): 26 def __init__(self, pagename, request):
27 SubmitBase.__init__(self, pagename, request) 27 SubmitBase.__init__(self, pagename, request)
37 text = "" 37 text = ""
38 for label in self.labels: 38 for label in self.labels:
39 index = self.labels.index(label) 39 index = self.labels.index(label)
40 label = label.decode('utf-8') 40 label = label.decode('utf-8')
41 value = self.values[index] 41 value = self.values[index]
42 text += "%(label)s: %(value)s \n" % {'label': label, 'value':value} 42 text += "%(label)s: %(value)s \n" % {'label': label, 'value': value}
43
44 return text 43 return text
45 44
46 def submit(self): 45 def submit(self):
47 SubmitBase.submit(self) 46 SubmitBase.submit(self)
48 text = self.build_content() 47 text = self.build_content()
49 status, msg = sendmail(self.request, self.targetemail, self.subject, text, mail_from=self.targetemail) 48 status, msg = sendmail(self.request, self.targetemail, self.subject, text, mail_from=self.targetemail)
50 self.msg = self._(msg) 49 self.msg = self._(msg)
51 if status!=1: 50 if status != 1:
52 raise Exception(self.msg) 51 raise Exception(self.msg)
53