diff shoutbox/forms.py @ 991:4aadaf3bc234

Added SITE_SCHEME setting. Configure site scheme to be either http or https based on SITE_SCHEME setting. Updated code to use it.
author Brian Neal <bgneal@gmail.com>
date Sun, 01 Nov 2015 15:56:05 -0600
parents ee87ea74d46b
children
line wrap: on
line diff
--- a/shoutbox/forms.py	Sat Oct 31 17:36:31 2015 -0500
+++ b/shoutbox/forms.py	Sun Nov 01 15:56:05 2015 -0600
@@ -1,24 +1,7 @@
 """
 Forms for the Shoutbox application.
 """
-
-import re
 from django import forms
 
-url_re = re.compile('('
-   r'^https?://' # http:// or https://
-   r'(?:(?:[A-Z0-9-]+\.)+[A-Z]{2,6}|' #domain...
-   r'localhost|' #localhost...
-   r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip
-   r'(?::\d+)?' # optional port
-   r'(?:/?|/\S+))', re.IGNORECASE)
-
-
 class ShoutBoxForm(forms.Form):
    msg = forms.CharField(label='', max_length=2048, required=True)
-
-   def get_shout(self):
-      msg = self.cleaned_data['msg']
-      msg = re.sub(url_re, r'<a href="\1">URL</a>', msg)
-      return msg
-