]> git.llucax.com Git - software/subdivxget.git/commitdiff
Reduce indentation by returning ASAP
authorLeandro Lucarella <luca@llucax.com.ar>
Sat, 14 Jul 2012 18:09:47 +0000 (20:09 +0200)
committerLeandro Lucarella <luca@llucax.com.ar>
Sat, 14 Jul 2012 18:12:53 +0000 (20:12 +0200)
subdivxget

index 5f67edbfeb8852a47a2cbfcf89b1e83c522dc8d1..1aecc66b904811165ec5b5f1bfd44798cd551d42 100755 (executable)
@@ -72,18 +72,19 @@ class SubDivXHTMLParser(HTMLParser.HTMLParser):
                        self.parsing = False
 
        def handle_data(self, data):
-               if self.parsing:
-                       data = data.strip()
-                       if self.attr is not None and data:
-                               self.cur[self.attr] = data
-                               self.attr = None
-                       elif data in ('Downloads:', 'Cds:', 'Comentarios:',
-                                       'Formato:'):
-                               self.attr = data[:-1].lower()
-                       elif data == 'Subido por:':
-                               self.attr = 'autor'
-                       elif data == 'el':
-                               self.attr = 'fecha'
+               if not self.parsing:
+                       return
+               data = data.strip()
+               if self.attr is not None and data:
+                       self.cur[self.attr] = data
+                       self.attr = None
+               elif data in ('Downloads:', 'Cds:', 'Comentarios:',
+                               'Formato:'):
+                       self.attr = data[:-1].lower()
+               elif data == 'Subido por:':
+                       self.attr = 'autor'
+               elif data == 'el':
+                       self.attr = 'fecha'
 
 
 def subdivx_get_subs(query_str):