prewikka/master: Handle empty value for DistributionCharts

[email protected] Mon, 8 Feb 2010 12:34:27 +0100 (CET)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit 17d01296c7cec37fcaeb99c93633464ed1501941
Author: Yoann Vandoorselaere <[email protected]>
Date:   Mon Feb 8 12:34:48 2010 +0100

    Handle empty value for DistributionCharts
    
    An exception could be raised in case we were generating a distribution
    Chart with empty values. This close #369.


========================================

 prewikka/views/stats.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

========================================

diff --git a/prewikka/views/stats.py b/prewikka/views/stats.py
index feb038a..80243d3 100644
--- a/prewikka/views/stats.py
+++ b/prewikka/views/stats.py
@@ -398,12 +398,15 @@ class GenericTimelineStats(DistributionStats):
         if limit > 0:
             res = self.env.idmef_db.getValues(self._getSelection(), criteria = criteria, limit=self._limit)
 
-            c = ""
+            c = u""
             for name, count in res:
                 if c:
                     c += " || "
-                c += "%s = '%s'" % (self._path, utils.escape_criteria(name))
 
+                if name:
+                    c += "%s = '%s'" % (self._path, utils.escape_criteria(name))
+                else:
+                    c += "! %s" % (self._path)
             if c:
                 criteria.append(c)
 
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-technologies.com/mailman/listinfo/prelude-cvslog