diff core/management/commands/ssl_images.py @ 870:ee56c8c8cf98

More WIP on ssl_images management command and tests.
author Brian Neal <bgneal@gmail.com>
date Mon, 15 Dec 2014 21:16:47 -0600
parents 64a5acb83937
children 6900040df0f8
line wrap: on
line diff
--- a/core/management/commands/ssl_images.py	Mon Dec 15 19:51:28 2014 -0600
+++ b/core/management/commands/ssl_images.py	Mon Dec 15 21:16:47 2014 -0600
@@ -24,8 +24,8 @@
 LOGFILE = os.path.join(settings.PROJECT_PATH, 'logs', 'ssl_images.log')
 logger = logging.getLogger(__name__)
 
-IMAGE_LINK_RE = re.compile(markdown.inlinepatterns.IMAGE_LINK_RE)
-IMAGE_REF_RE = re.compile(markdown.inlinepatterns.IMAGE_REFERENCE_RE)
+IMAGE_LINK_RE = re.compile(markdown.inlinepatterns.IMAGE_LINK_RE, re.UNICODE)
+IMAGE_REF_RE = re.compile(markdown.inlinepatterns.IMAGE_REFERENCE_RE, re.UNICODE)
 
 SG101_HOSTS = set(['www.surfguitar101.com', 'surfguitar101.com'])
 MODEL_CHOICES = ['comments', 'posts']
@@ -54,7 +54,7 @@
 
 
 def replace_image_markup(match):
-    src_parts = match.group(9).split()
+    src_parts = match.group(8).split()
     if src_parts:
         src = src_parts[0]
         if src[0] == "<" and src[-1] == ">":
@@ -65,7 +65,7 @@
     title = ''
     if len(src_parts) > 1:
         title = " ".join(src_parts[1:])
-    alt = match.group(2)
+    alt = match.group(1)
 
     new_src = ''
     if src: