~nikitajy/mnemosyne-proj/mybranch

« back to all changes in this revision

Viewing changes to mnemosyne/mnemosyne/libmnemosyne/component_manager.py

  • Committer: Peter Bienstman
  • Date: 2011-03-17 18:34:47 UTC
  • Revision ID: peter.bienstman@ugent.be-20110317183447-60fxwknn9bhqr4jo
Clean up, bug fixing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
            # See if there is a component registered for the parent class.
80
80
            # We need to do this both for the case where 'used_for' is a
81
81
            # tuple and a single class.
82
 
            class_keys = [_key for _key in self.components.keys() if \
83
 
                not isinstance(_key, str) and not (_key == None) \
84
 
                and isinstance(_key, tuple)]            
85
82
            if isinstance(used_for, tuple):
86
 
                for key in class_keys:                   
 
83
                tuple_class_keys = \
 
84
                    [_key for _key in self.components.keys() if \
 
85
                    not isinstance(_key, str) and not (_key == None) \
 
86
                    and isinstance(_key, tuple)]
 
87
                for key in tuple_class_keys:                   
87
88
                    if issubclass(used_for[0], key[0]) and \
88
89
                       issubclass(used_for[1], key[1]):
89
90
                        try:
92
93
                            return []
93
94
                return []
94
95
            else:
95
 
                for key in class_keys:
 
96
                non_tuple_class_keys = \
 
97
                    [_key for _key in self.components.keys() if \
 
98
                    not isinstance(_key, str) and not (_key == None) \
 
99
                    and not isinstance(_key, tuple)]
 
100
                for key in non_tuple_class_keys:
96
101
                    if issubclass(used_for, key):
97
102
                        try:
98
103
                            return self.components[key][comp_type]