1. Patrick Guido Arminio
  2. django-fb_social_plugins

Commits

Patrick Guido Arminio  committed 9e2c15a

Fixed IndexError when no arguments were passed to a templatetag

  • Participants
  • Parent commits aeb85be
  • Branches default

Comments (0)

Files changed (1)

File fb_social_plugins/templatetags/fb_social_plugins.py

View file
     return tpl % args
 
 def render_recommendation(args):
-    tpl = '<iframe src="http://www.facebook.com/plugins/recommendations.php?site=%(url)&amp;width=%(width)s&amp;height=%(height)s&amp;header=%(header)s&amp;colorscheme=%(color_scheme)s&amp;font=%(font)s&amp;border_color=%(border_color)s" \
+    tpl = '<iframe src="http://www.facebook.com/plugins/recommendations.php?site=%(url)s&amp;width=%(width)s&amp;height=%(height)s&amp;header=%(header)s&amp;colorscheme=%(color_scheme)s&amp;font=%(font)s&amp;border_color=%(border_color)s" \
            scrolling="no" frameborder="0" allowTransparency="true" \
            style="border:none; overflow:hidden; width:%(width)s; height:%(height)s"></iframe>'
     
         'color_scheme': ('light', 'dark', 'evil'),
     }
     
-    arguments = parse_arguments(bits[1])
+    try:
+        arguments = parse_arguments(bits[1])
+    except IndexError:
+        arguments = []
     
     for arg, value in arguments:
         if value in defaults[arg]:
         'color_scheme': ('light', 'dark', 'evil'),
     }
 
-    arguments = parse_arguments(bits[1])
+    try:
+        arguments = parse_arguments(bits[1])
+    except IndexError:
+        arguments = []
 
     for arg, value in arguments:
         if value in defaults[arg]:
         pars['width'] = '450'
     if not 'height' in pars.keys():
         pars['height'] = '200'
-    if not 'height' in pars.keys():
-        pars['height'] = ''
+    if not 'border_color' in pars.keys():
+        pars['border_color'] = ''
 
     return RecommendationsNode(**pars)