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

« back to all changes in this revision

Viewing changes to ibid/plugins/network.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:
528
528
                            break
529
529
                        self.protocols[proto.lower()].append(port)
530
530
 
531
 
    @match(r'^(?:(.+)\s+)?ports?(?:\s+numbers?)?(?(1)|\s+for\s+(.+))$')
532
 
    def portfor(self, event, proto1, proto2):
 
531
    @match(r'(?:{proto:any} )?ports?(?: numbers?)?(?(1)| for {proto:any})')
 
532
    def portfor(self, event, proto):
533
533
        self._load_services()
534
 
        protocol = (proto1 or proto2).lower()
 
534
        protocol = proto.lower()
535
535
        if protocol in self.protocols:
536
536
            event.addresponse(human_join(self.protocols[protocol]))
537
537
        else: