auth.wiki() is much better, supports autolinks

This commit is contained in:
mdipierro committed 2012-08-01 23:49:55 -05:00
1 parent 8a06a98b18
commit ad3f34b8f1
5 files changed
+89 -32

No files matched your search

+7 -1
View File
@@ -44,9 +44,13 @@ viddler.com
import re, cgi, sys
from simplejson import loads
from BeautifulSoup import BeautifulSoup, Comment
import urllib
import uuid
try:
from BeautifulSoup import BeautifulSoup, Comment
have_soup = True
except ImportError:
have_soup = False
regex_link = re.compile('https?://\S+')
@@ -160,6 +164,8 @@ def expand_one(url,cdict):
return '<a href="%(u)s">%(u)s</a>' % dict(u=url)
def expand_html(html,cdict=None):
if not have_soup:
raise RuntimeError, "Missing BeautifulSoup"
soup = BeautifulSoup(html)
comments = soup.findAll(text=lambda text:isinstance(text, Comment))
[comment.extract() for comment in comments]