Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 46 lines (34 sloc) 1.174 kb
b81caf7 @lethain Initial commit of LifeFlow files from SVN to Git.
authored
1 import cgi
75a32f8 @lethain Updated to be compatable with Django Alpha.
authored
2 from django import forms
8e3efc1 @lethain Reworked how comments and text are being rendered to be more flexible fo...
authored
3 from lifeflow.text_filters import comment_markup
b81caf7 @lethain Initial commit of LifeFlow files from SVN to Git.
authored
4
5
6 class CommentForm(forms.Form):
7 name = forms.CharField(required=False)
8 email = forms.CharField(required=False)
9 webpage = forms.CharField(required=False)
10 body = forms.CharField(widget=forms.Textarea, required=False)
11
12
13 def clean_name(self):
14 name = self.cleaned_data['name']
15 if name == u"":
16 name = u"name"
17 else:
18 name = cgi.escape(name)
19 return name
20
21
22 def clean_email(self):
23 email = self.cleaned_data['email']
24 if email == u"":
25 email = u"email"
26 else:
27 email = cgi.escape(email)
28 return email
29
30
31 def clean_webpage(self):
32 webpage = self.cleaned_data['webpage']
33 if webpage == u"":
34 webpage = u"webpage"
35 else:
36 webpage = cgi.escape(webpage)
37 if webpage.find('://') == -1: webpage = "http://%s" % webpage
38 return webpage
39
40
41 def clean_body(self):
42 body = self.cleaned_data['body']
8e3efc1 @lethain Reworked how comments and text are being rendered to be more flexible fo...
authored
43 self.cleaned_data['html'] = unicode(comment_markup(body))
b81caf7 @lethain Initial commit of LifeFlow files from SVN to Git.
authored
44 return body
45
Something went wrong with that request. Please try again.