]> jfr.im git - erebus.git/commitdiff
urls - fix calling some regexes
authorJohn Runyon <redacted>
Thu, 24 Aug 2023 01:12:16 +0000 (19:12 -0600)
committerJohn Runyon <redacted>
Thu, 24 Aug 2023 01:12:16 +0000 (19:12 -0600)
modules/urls.py

index 9ac8629fbbf3db90b39c55af769abb448805e18d..e790979fa11267e6f8a501e6a19861f4a8e900c9 100644 (file)
@@ -23,12 +23,14 @@ modstop = lib.modstop
 # module code
 import sys
 if sys.version_info.major < 3:
+       stringbase = basestring
        import urllib2
        import urlparse
        import HTMLParser
        html = HTMLParser.HTMLParser()
        from BeautifulSoup import BeautifulSoup
 else:
+       stringbase = str
        import urllib.request as urllib2
        import urllib.parse as urlparse
        import html
@@ -86,7 +88,10 @@ def process_line(line):
                                        num_found += 1
                                        if num_found > limit:
                                                return responses
-                                       resp = action(match)
+                                       if isinstance(match, stringbase):
+                                               resp = action(match)
+                                       else:
+                                               resp = action(*match)
                                        if resp is not None:
                                                responses.append("%s: %s" % (prefix, action(match)))
        return responses