Show
Ignore:
Timestamp:
02/24/09 23:23:20 (4 years ago)
Author:
gpolo
Message:

Merged revisions 4193,4196-4197 via svnmerge from
http://svn.umitproject.org/svnroot/umit/branch/NetworkInventory

........

r4193 | gpolo | 2009-02-23 23:31:08 -0300 (Mon, 23 Feb 2009) | 1 line


Moving to log

........

r4196 | gpolo | 2009-02-24 20:08:10 -0300 (Tue, 24 Feb 2009) | 1 line


Fixed ticket #225: Use the i18n version of category names

........

r4197 | gpolo | 2009-02-24 20:13:11 -0300 (Tue, 24 Feb 2009) | 1 line


data_lenght -> data_length

........

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svnmerge-integrated changed from /branch/InterfaceEditor:1-4032 /branch/NetworkInventory:1-3849,3851-3864,3876-3919,3921-3948,3953-3955,3957-4191 /branch/UmitPlugins:1-2993,2997-2998,3008,3010-3011,3013-3015,3029-3031,3034-3073,3077-3086,3088,3091-3092,3098-3100,3105-3108,3110,3112,3120-3125,3128,3130-3131,3133,3135-3141,3143-3151,3153-3232,3234-3789,3792-4112 to /branch/InterfaceEditor:1-4032 /branch/NetworkInventory:1-3849,3851-3864,3876-3919,3921-3948,3953-3955,3957-4197 /branch/UmitPlugins:1-2993,2997-2998,3008,3010-3011,3013-3015,3029-3031,3034-3073,3077-3086,3088,3091-3092,3098-3100,3105-3108,3110,3112,3120-3125,3128,3130-3131,3133,3135-3141,3143-3151,3153-3232,3234-3789,3792-4112
  • trunk/umitInventory/TLChangesTree.py

    r4097 r4198  
    2323from umitCore.I18N import _ 
    2424 
     25from umitInventory.TLBase import categories 
     26 
    2527ALLCHANGES = _("View all changes") 
    2628LISTCHANGES = _("Changes listing") 
     
    3133    """ 
    3234 
    33     def __init__(self, connector, datagrabber, categories, inventory, 
     35    def __init__(self, connector, datagrabber, db_categories, inventory, 
    3436        hostaddr): 
    3537 
     
    3840        self.connector = connector 
    3941        self.datagrabber = datagrabber 
    40         self.categories = categories 
     42        self.db_categories = db_categories 
    4143        self.inventory = inventory 
    4244        self.hostaddr = hostaddr 
     
    6668        # startup situation 
    6769        self.treestore.append(None, [ALLCHANGES]) 
    68         for category in self.categories: 
    69             self.treestore.append(None, ["%s (0)" % category]) 
     70        for category in self.db_categories: 
     71            self.treestore.append(None, ["%s (0)" % categories[category]]) 
    7072 
    7173 
     
    8587 
    8688            elif len(path) == 2: 
    87                 # clicked on View all changes inside a category 
     89                # clicked on "View all changes" inside a category 
    8890                category_id = path[0] 
    8991                category_load = { } 
     
    142144        Grabs changes from range_start to range_end and then update tree. 
    143145        """ 
    144         categories = self.datagrabber.get_categories() 
    145         self.categories = [value[1] for key, value in categories.items()] 
     146        db_categories = self.datagrabber.get_categories() 
     147        self.db_categories = [value[1] for key, value in db_categories.items()] 
    146148 
    147149        data = { } 
     
    149151        # grab changes in timerange 
    150152        self.datagrabber.use_dict_cursor() 
    151         for key in categories.keys(): 
     153        for key in db_categories.keys(): 
    152154            if not range_start or not range_end: 
    153155                data[key] = { } 
     
    190192 
    191193                # update clean_data 
    192                 #if clean_data[category].has_key(inventories[fk_inventory]): 
    193194                if inventories[fk_inventory] in clean_data[category]: 
    194195                    cdata = clean_data[category][inventories[fk_inventory]] 
    195196 
    196                     #if cdata.has_key(addresses[fk_address]): 
    197197                    if addresses[fk_address] in cdata: 
    198198                        cdata[addresses[fk_address]] += 1 
     
    213213        self.treestore.append(None, [ALLCHANGES]) 
    214214 
    215         for indx, item in enumerate(self.categories): 
    216             data_lenght = len(data[indx + 1]) # keys starting at 1 
    217             changes_sum += data_lenght 
    218  
    219             root = self.treestore.append(None, ["%s (%d)" % (item, 
    220                 data_lenght)]) 
    221  
    222             if data_lenght > 0: 
     215        for indx, item in enumerate(self.db_categories): 
     216            data_length = len(data[indx + 1]) # keys starting at 1 
     217            changes_sum += data_length 
     218 
     219            root = self.treestore.append(None, ["%s (%d)" % (categories[item], 
     220                data_length)]) 
     221 
     222            if data_length > 0: 
    223223                self.treestore.append(root, [ALLCHANGES]) 
    224224