Changeset 9705e3 in indico


Ignore:
Timestamp:
03/31/11 18:58:17 (2 years 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, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
084dec
Parents:
a0d701
git-author:
Pedro Ferreira <jose.pedro.ferreira@…> (03/31/11 18:53:30)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (03/31/11 18:58:17)
Message:

[FIX] metadata export - use new indexes

  • non-visible content won't show up in higher categories
Location:
indico
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/ICALinterface/conference.py

    rb05cf0 r9705e3  
    2525from MaKaC.ICALinterface.base import ICALBase 
    2626from MaKaC.common.utils import encodeUnicode 
     27from MaKaC.common.indexes import IndexesHolder 
     28from indico.util.date_time import nowutc 
    2729 
    2830 
     
    5456 
    5557    def getBody(self): 
    56         text = self._printHeader() 
    57         for conf in self._categ.getAllConferenceList(): 
     58        im = IndexesHolder() 
     59        calIdx = im.getIndex('categoryDate') 
     60 
     61        text = self._printHeader() 
     62        confs = calIdx.getObjectsEndingAfter(self._categ.getId(), 
     63                                             nowutc()) 
     64        for conf in confs: 
    5865            text += ConferenceToiCal(conf).getCore() 
    5966        text += self._printFooter() 
  • indico/MaKaC/RSSinterface/conference.py

    rbdd862 r9705e3  
    2828from MaKaC.common.timezoneUtils import nowutc 
    2929import MaKaC.common.info as info 
    30   
     30 
     31 
    3132class CategoryToRSS: 
    3233 
     
    4041 
    4142    def getBody(self): 
    42         res = sets.Set() 
    4343        im = indexes.IndexesHolder() 
    44         catIdx = im.getIndex('category') 
    45         calIdx = im.getIndex('calendar') 
     44        calIdx = im.getIndex('categoryDate') 
     45 
    4646        if self._date == None: 
    47             c1 = calIdx.getObjectsEndingAfter(nowutc().astimezone(timezone(self._tz))) 
     47            confs = calIdx.getObjectsEndingAfter(self._categ.getId(), nowutc().astimezone(timezone(self._tz))) 
    4848        else: 
    49             date = self._date 
    50             c1 = calIdx.getObjectsInDay(date) 
    51         confIds=sets.Set(catIdx.getItems(self._categ.getId())) 
    52         confIds.intersection_update(c1) 
    53         res.union_update(confIds) 
    54         res = list(res) 
     49            confs = calIdx.getObjectsInDay(self._categ.getId(), self._date) 
     50 
     51        res = list(confs) 
    5552        res.sort(sortByStartDate) 
    5653        rss = xmlGen.XMLGen() 
     
    6865        rss.writeTag("webMaster", info.HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) 
    6966        rss.writeTag("ttl","1440") 
    70         for confId in res: 
    71             ch = ConferenceHolder() 
    72             conf = ch.getById(confId) 
     67        for conf in res: 
    7368            rss = ConferenceToRSS(conf, tz=self._tz).getCore(rss) 
    7469        rss.closeTag("channel") 
     
    110105 
    111106def sortByStartDate(conf1,conf2): 
    112   ch = ConferenceHolder() 
    113   return cmp(ch.getById(conf1).getStartDate(),ch.getById(conf2).getStartDate()) 
     107  return cmp(conf1.getStartDate(), conf2.getStartDate()) 
  • indico/MaKaC/common/indexes.py

    rb1193d r9705e3  
    793793            return [] 
    794794 
     795    def getObjectsInDay( self, categid, sDate): 
     796        categid = str(categid) 
     797        if self._idxCategItem.has_key(categid): 
     798            return self._idxCategItem[categid].getObjectsInday(sDate) 
     799        else: 
     800            return [] 
     801 
     802    def getObjectsEndingAfter( self, categid, sDate): 
     803        categid = str(categid) 
     804        if self._idxCategItem.has_key(categid): 
     805            return self._idxCategItem[categid].getObjectsEndingAfter(sDate) 
     806        else: 
     807            return [] 
     808 
    795809class CategoryDateIndexLtd(CategoryDateIndex): 
    796810    """ Version of CategoryDateIndex whiself.ch indexing events 
     
    14601474                Idx[str(id)] = CategoryIndex() 
    14611475            elif id=="categoryDate": 
    1462                 Idx[str(id)] = CategoryDateIndex() 
     1476                Idx[str(id)] = CategoryDayIndex() 
    14631477            elif id=="categoryName": 
    14641478                Idx[str(id)] = TextIndex() 
  • indico/htdocs/scripts/createCategoryHeader.py

    rbdd862 r9705e3  
    3030from pytz import timezone 
    3131 
     32 
    3233def index(req, **params): 
    3334  """This script displays the list of meetings taking place in a given category 
     
    3738    fid = params['fid'] 
    3839    date = params['date'] 
    39     days = params['days'] 
    4040  except: 
    4141    return usage() 
     
    5454  #instanciate indexes 
    5555  im = indexes.IndexesHolder() 
    56   catIdx = im.getIndex('category') 
    57   calIdx = im.getIndex('calendar') 
     56  calIdx = im.getIndex('categoryDate') 
    5857 
    59   c1 = calIdx.getObjectsIn(startdate, enddate) 
    60   for id in ids: 
    61     confIds=sets.Set(catIdx.getItems(id)) 
    62     confIds.intersection_update(c1) 
     58  for cid in ids: 
     59    confIds = calIdx.getObjectsInDays(cid, startdate, enddate) 
    6360    res.union_update(confIds) 
    6461 
     
    7067 
    7168def usage(): 
    72   return "usage: createCategoryHeader.py?fid=xxx&date=yyyy-mm-dd&days=xxx"; 
     69  return "usage: createCategoryHeader.py?fid=xxx&date=yyyy-mm-dd"; 
    7370 
    7471def sortByStartDate(conf1,conf2): 
    7572  ch = ConferenceHolder() 
    76   return cmp(ch.getById(conf1).getStartDate().time(),ch.getById(conf2).getStartDate().time()) 
     73  return cmp(conf1.getStartDate().time(), conf2.getStartDate().time()) 
    7774 
    7875def displayList(res,tz): 
     
    8077  ch = ConferenceHolder() 
    8178  curDate = None 
    82   for confId in res: 
    83     c = ch.getById(confId) 
     79 
     80  for c in res: 
    8481    if curDate!=c.getAdjustedStartDate(tz): 
    8582      curDate = c.getAdjustedStartDate(tz) 
     
    8986 
    9087def displayConf(conf,tz): 
    91   t = "<b>%s</b>&nbsp;/&nbsp;%s&nbsp;/&nbsp;<a href=\"http://indico.cern.ch/conferenceDisplay.py?confId=%s\">%s</a>/%s" % (conf.getAdjustedStartDate(tz).time().isoformat()[0:5],getCategText(conf.getOwnerList()[0]),conf.getId(),conf.getTitle(),conf.getRoom().getName()) 
    92   return t 
     88    room = conf.getRoom() 
     89    t = "<b>%s</b>&nbsp;/&nbsp;%s&nbsp;/&nbsp;<a href=\"http://indico.cern.ch/conferenceDisplay.py?confId=%s\">%s</a>/%s" % (conf.getAdjustedStartDate(tz).time().isoformat()[0:5],getCategText(conf.getOwnerList()[0]),conf.getId(),conf.getTitle(), (room.getName() if room else '')) 
     90    return t 
    9391 
    9492def getCategText(categ): 
  • indico/htdocs/scripts/export.py

    r4a3f5d r9705e3  
    140140  data = icalBase._printHeader() 
    141141 
    142   ch = ConferenceHolder() 
    143   for confId in res: 
    144     conf = ch.getById(confId) 
     142  for conf in res: 
    145143    ical = ConferenceToiCal(conf.getConference()) 
    146144    data += ical.getCore() 
     
    155153def displayList(res,startdate,enddate,repeat,displayCateg,tz): 
    156154  text = "" 
    157   ch = ConferenceHolder() 
    158155  day = startdate 
    159156  days = {} 
    160157  found = {} 
    161158  while day <= enddate: 
    162     for confId in res: 
    163       c = ch.getById(confId) 
     159    for c in res: 
    164160      if day.date() >= c.getAdjustedStartDate(tz).date() and day.date() <= c.getAdjustedEndDate(tz).date() and (repeat==1 or not found.has_key(c)): 
    165161        if not days.has_key(day): 
     
    206202  xml = xmlGen.XMLGen() 
    207203  xml.openTag("collection") 
    208   for confId in res: 
    209     c = ch.getById(confId) 
     204  for c in res: 
    210205    xml = displayXMLConf(c,xml,tz,dc) 
    211206  xml.closeTag("collection") 
     
    269264  rss.writeTag("webMaster", HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) 
    270265  rss.writeTag("ttl","1440") 
    271   for confId in res: 
    272     c = ch.getById(confId) 
     266  for c in res: 
    273267    rss = displayRSSConf(c,rss,tz) 
    274268  rss.closeTag("channel") 
     
    298292 
    299293def sortByStartDate(conf1,conf2): 
    300   ch = ConferenceHolder() 
    301   return cmp(ch.getById(conf1).getStartDate(),ch.getById(conf2).getStartDate()) 
     294  return cmp(conf1.getStartDate(),conf2.getStartDate()) 
    302295 
    303296def getConfList(startdate,enddate,ids): 
     
    306299  #instanciate indexes 
    307300  im = indexes.IndexesHolder() 
    308   catIdx = im.getIndex('category') 
    309   calIdx = im.getIndex('calendar') 
    310   c1 = calIdx.getObjectsIn(startdate, enddate) 
    311   for id in ids: 
    312     confIds=sets.Set(catIdx.getItems(id)) 
    313     confIds.intersection_update(c1) 
    314     res.union_update(confIds) 
     301  calIdx = im.getIndex('categoryDate') 
     302  for cid in ids: 
     303      confs = calIdx.getObjectsInDays(cid, startdate, enddate) 
     304      res.union_update(confs) 
    315305  res = list(res) 
    316306  res.sort(sortByStartDate) 
Note: See TracChangeset for help on using the changeset viewer.