[asterisk-commits] kmoore: testsuite/asterisk/trunk r4470 - /asterisk/trunk/lib/python/asterisk/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Dec 16 09:32:35 CST 2013
Author: kmoore
Date: Mon Dec 16 09:32:32 2013
New Revision: 4470
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4470
Log:
Force tail anchoring for CEL regex matches
This is part of r4466 that was missed and ensures that strings without
regex modifiers match as exact, whole strings as expected.
Modified:
asterisk/trunk/lib/python/asterisk/ami.py
Modified: asterisk/trunk/lib/python/asterisk/ami.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/ami.py?view=diff&rev=4470&r1=4469&r2=4470
==============================================================================
--- asterisk/trunk/lib/python/asterisk/ami.py (original)
+++ asterisk/trunk/lib/python/asterisk/ami.py Mon Dec 16 09:32:32 2013
@@ -304,14 +304,17 @@
extra_item = item.get(extra_key.lower())
if extra_item is None:
continue
- if re.search(extra_item, str(extra_value)) is None:
+ extra_match = re.match(extra_item, str(extra_value))
+ if extra_match is None or extra_match.end() != len(str(extra_value)):
logger.debug('Skipping %s - %s does not equal %s for extra-subfield %s' %
(event['eventname'], extra_item, str(extra_value), extra_key))
return False
- elif re.search(item, value) is None:
- logger.debug('Skipping %s - %s does not equal %s for field %s' %
- (event['eventname'], item, value, key))
- return False
+ else:
+ match = re.match(item, value)
+ if match is None or match.end() != len(value):
+ logger.debug('Skipping %s - %s does not equal %s for field %s' %
+ (event['eventname'], item, value, key))
+ return False
logger.debug('Matched CEL event %s' % event['eventname'])
return True
More information about the asterisk-commits
mailing list