Ticket #2855: astrisk.patch

File astrisk.patch, 1.4 kB (added by doki_pen, 5 months ago)

move glob to regex code to query instead of save to avoid duplicate replacements

  • announcerplugin/subscribers/wiki.py

    old new  
    3636         
    3737        for sid, authenticated, value in cursor.fetchall(): 
    3838            for raw in value.split(' '): 
    39                 pat = urllib.unquote(raw) 
     39                pat = urllib.unquote(raw).replace('*', '.*') 
    4040                if re.match(pat, name): 
    4141                    self.log.debug( 
    4242                        "GeneralWikiSubscriber added '%s (%s)' because name '%s' matches pattern: %s" % ( 
     
    5757                options = results.splitlines() 
    5858                 
    5959                sess['announcer_wiki_interests'] = ' '.join( 
    60                     urllib.quote( 
    61                         x.replace('*', '.*?') 
    62                     ) for x in options 
     60                    urllib.quote(x) for x in options 
    6361                ) 
    6462                 
    6563        if 'announcer_wiki_interests' in sess: 
     
    6967             
    7068        return "prefs_announcer_wiki.html", dict( 
    7169            wiki_interests = '\n'.join( 
    72                 urllib.unquote( 
    73                     x.replace('.*?', '*') 
    74                 ) for x in interests.split(' ') 
     70                urllib.unquote(x) for x in interests.split(' ') 
    7571            ) 
    7672        )