~manishsinha/zeitgeist/fix-blacklist-api

« back to all changes in this revision

Viewing changes to _zeitgeist/engine/extensions/blacklist.py

  • Committer: Manish Sinha
  • Date: 2011-01-02 20:47:04 UTC
  • Revision ID: manishsinha.tech@gmail.com-20110102204704-4qpd6uq1eqqukeei
Fixed unit tests and cleaned the blacklist extension

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
                        log.debug("No existing blacklist config found")
71
71
                        self._blacklist = {}
72
72
                
73
 
                print(self._blacklist)
74
 
        
75
73
        def pre_insert_event(self, event, sender):
76
74
                for tmpl in self._blacklist:
77
75
                        for single_event in self._blacklist[tmpl]:
80
78
        
81
79
        # PUBLIC
82
80
        def set_blacklist(self, event_templates, blacklister):
83
 
                print(event_templates)
84
81
                try:
85
82
                        event_list = self._blacklist[blacklister]
86
 
                        print("Blacklister exists")
87
83
                except KeyError:
88
 
                        print("Blacklister does not exist")
89
84
                        event_list = []
90
85
                        self._blacklist[blacklister] = event_list
91
86
 
102
97
                                                continue
103
98
                                        # The event is new, insert it to the blacklist`
104
99
                                        new_templates.append(event)
105
 
                                        print("Appended template")
106
100
                else:
107
101
                        new_templates.extend(event_templates)
108
102
 
109
 
                print(new_templates)
110
103
                event_list.extend(new_templates)
111
104
                
112
105
                # Create plain python objects and pickel it