Changeset 4c1d2b in indico


Ignore:
Timestamp:
08/01/11 11:33:23 (22 months ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 4c7d4152dff271ba5df5a8606605969cab454080
Children:
f8dd55
Parents:
c673e1
git-author:
Pedro Ferreira <jose.pedro.ferreira@…> (08/01/11 11:31:44)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (08/01/11 11:33:23)
Message:

[FIX] Delete category entries from categ_conf_sd

  • When categories are deleted;
  • Also added extra param to getCategory(), so that an entry is not created by default (reduces chances of accident when debugging);
  • Fixed getitem;
Location:
indico
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/conference.py

    r894140 r4c1d2b  
    291291        nameIdx = indexes.IndexesHolder().getIndex('categoryName') 
    292292        nameIdx.unindex(category.getId()) 
     293        Catalog.getIdx('categ_conf_sd').remove_category(category.getId()) 
    293294 
    294295    def _newId( self ): 
  • indico/core/index/event.py

    r204831 r4c1d2b  
    3131 
    3232    def __getitem__(self, key): 
    33         return self.getCategory[key] 
     33        return self._container[key] 
    3434 
    3535    def __setitem__(self, key, value): 
    3636        self._container[key] = value 
    3737 
    38     def getCategory(self, categId): 
     38    def getCategory(self, categId, create=False): 
    3939        if categId not in self._container: 
    40             self._container[categId] =  IOIndex(IIndexableByStartDateTime) 
     40            if create: 
     41                self._container[categId] =  IOIndex(IIndexableByStartDateTime) 
     42            else: 
     43                raise KeyError(categId) 
    4144        return self._container[categId] 
    4245 
    4346    def index_obj(self, obj): 
    44         self.getCategory(obj.getOwner().getId()).index_obj(obj) 
     47        self.getCategory(obj.getOwner().getId(), create=True).index_obj(obj) 
    4548 
    4649    def unindex_obj(self, obj): 
    4750        self.getCategory(obj.getOwner().getId()).unindex_obj(obj) 
     51 
     52    def remove_category(self, categId): 
     53        del self._container[categId] 
    4854 
    4955    def _initializeSubIndex(self, cset): 
Note: See TracChangeset for help on using the changeset viewer.