~ibid-core/ibid/old-trunk-1.6

« back to all changes in this revision

Viewing changes to ibid/plugins/factoid.py

  • Committer: Tarmac
  • Author(s): Keegan Carruthers-Smith
  • Date: 2011-03-23 16:11:13 UTC
  • mfrom: (1015.6.8 named-groups-656201)
  • Revision ID: ibid-lp-lander@rivera.za.net-20110323161113-vzgpclmucy8fxyzi
Added named arguments to the match decorator.
Author: Keegan Carruthers-Smith
Merge Request: http://code.launchpad.net/~keegan-csmith/ibid/named-groups-656201/+merge/51159
Approved by: Stefano Rivera, Max Rabkin
Fixes LP: #656201

Show diffs side-by-side

added added

removed removed

Lines of Context:
684
684
                    event.identity, event.sender['connection'])
685
685
            event.addresponse(True)
686
686
 
687
 
    @match(r'^(.+?)(?:\s+#(\d+)|\s+/(.+?)/(r?))?\s*(?:~=|=~)\s*([sy](?P<sep>.).+(?P=sep).*(?P=sep)[gir]*)$')
 
687
    @match(r'(?P<name>.+?)'
 
688
           r'(?: #{number:digits}| /(?P<pattern>.+?)/(?P<is_regex>r?))?'
 
689
           r'\s*(?:~=|=~)\s*'
 
690
           r'(?P<operation>[sy](?P<sep>.).+(?P=sep).*(?P=sep)[gir]*)$')
688
691
    @authorise(fallthrough=False)
689
 
    def modify(self, event, name, number, pattern, is_regex, operation, separator):
 
692
    def modify(self, event, name, number, pattern, is_regex, operation, sep):
690
693
        factoids = get_factoid(event.session, name, number, pattern, is_regex, all=True)
691
694
        if len(factoids) == 0:
692
695
            if pattern:
707
710
                return
708
711
 
709
712
            # Not very pythonistic, but escaping is a nightmare.
 
713
            separator = sep
710
714
            parts = [[]]
711
715
            pos = 0
712
716
            while pos < len(operation):