[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, debian, updated. upstream/0.9.5.5-717-g0f98819

Sebastian Krzyszkowiak seba.dos1 at gmail.com
Sat Aug 6 08:17:44 UTC 2011


The following commit has been merged in the debian branch:
commit e96a204768744130859ab091162ec5c976854d49
Author: Sebastian Krzyszkowiak <seba.dos1 at gmail.com>
Date:   Fri Aug 7 21:14:30 2009 +0200

    opimd: fix posible division by zero when matching entries. Should fix delivery reports.

diff --git a/framework/subsystems/opimd/pimd_calls.py b/framework/subsystems/opimd/pimd_calls.py
index f836f25..be9cd5a 100644
--- a/framework/subsystems/opimd/pimd_calls.py
+++ b/framework/subsystems/opimd/pimd_calls.py
@@ -350,7 +350,6 @@ class Call():
             best_field_match = 0.0
 
             matcher = re.compile(field_value)
-            seq2_len = len(field_value)
 
             # Check if field value(s) of this call match(es) the query field
             try:
@@ -371,10 +370,10 @@ class Call():
                     else:
                         match_len = 0
 
-                    if seq2_len==0:
-                        field_match = 0.0
-                    else:
+                    if field_value and comp_value:
                         field_match = float(match_len) / len(comp_value)
+                    else:
+                        field_match = 0.0
 
                     if field_match > best_field_match: best_field_match = field_match
                     logger.debug("Calls: Field match for %s / %s: %f", comp_value, field_value, field_match)
diff --git a/framework/subsystems/opimd/pimd_contacts.py b/framework/subsystems/opimd/pimd_contacts.py
index 3a19234..cf067af 100644
--- a/framework/subsystems/opimd/pimd_contacts.py
+++ b/framework/subsystems/opimd/pimd_contacts.py
@@ -374,7 +374,6 @@ class Contact():
             best_field_match = 0.0
 
             matcher = re.compile(field_value)
-            seq2_len = len(field_value)
 
             # Check if field value(s) of this contact match(es) the query field
             try:
@@ -395,10 +394,10 @@ class Contact():
                     else:
                         match_len = 0
 
-                    if seq2_len==0:
-                        field_match = 0.0
-                    else:
+                    if field_value and comp_value:
                         field_match = float(match_len) / len(comp_value)
+                    else:
+                        field_match = 0.0
 
                     if field_match > best_field_match: best_field_match = field_match
                     logger.debug("Contacts: Field match for %s / %s: %f", comp_value, field_value, field_match)
diff --git a/framework/subsystems/opimd/pimd_messages.py b/framework/subsystems/opimd/pimd_messages.py
index fe4aec0..c70d3b1 100644
--- a/framework/subsystems/opimd/pimd_messages.py
+++ b/framework/subsystems/opimd/pimd_messages.py
@@ -376,7 +376,6 @@ class Message():
             best_field_match = 0.0
 
             matcher = re.compile(field_value)
-            seq2_len = len(field_value)
 
             # Check if field value(s) of this message match(es) the query field
             try:
@@ -397,10 +396,10 @@ class Message():
                     else:
                         match_len = 0
 
-                    if seq2_len==0:
-                        field_match = 0.0
-                    else:
+                    if field_value and comp_value:
                         field_match = float(match_len) / len(comp_value)
+                    else:
+                        field_match = 0.0
 
                     if field_match > best_field_match: best_field_match = field_match
 

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list