Changeset 9705e3 in indico
- Timestamp:
- 03/31/11 18:58:17 (2 years ago)
- 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)
- Location:
- indico
- Files:
-
- 5 edited
-
MaKaC/ICALinterface/conference.py (modified) (2 diffs)
-
MaKaC/RSSinterface/conference.py (modified) (4 diffs)
-
MaKaC/common/indexes.py (modified) (2 diffs)
-
htdocs/scripts/createCategoryHeader.py (modified) (6 diffs)
-
htdocs/scripts/export.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/ICALinterface/conference.py
rb05cf0 r9705e3 25 25 from MaKaC.ICALinterface.base import ICALBase 26 26 from MaKaC.common.utils import encodeUnicode 27 from MaKaC.common.indexes import IndexesHolder 28 from indico.util.date_time import nowutc 27 29 28 30 … … 54 56 55 57 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: 58 65 text += ConferenceToiCal(conf).getCore() 59 66 text += self._printFooter() -
indico/MaKaC/RSSinterface/conference.py
rbdd862 r9705e3 28 28 from MaKaC.common.timezoneUtils import nowutc 29 29 import MaKaC.common.info as info 30 30 31 31 32 class CategoryToRSS: 32 33 … … 40 41 41 42 def getBody(self): 42 res = sets.Set()43 43 im = indexes.IndexesHolder() 44 ca tIdx = im.getIndex('category')45 calIdx = im.getIndex('calendar') 44 calIdx = im.getIndex('categoryDate') 45 46 46 if self._date == None: 47 c 1 = calIdx.getObjectsEndingAfter(nowutc().astimezone(timezone(self._tz)))47 confs = calIdx.getObjectsEndingAfter(self._categ.getId(), nowutc().astimezone(timezone(self._tz))) 48 48 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) 55 52 res.sort(sortByStartDate) 56 53 rss = xmlGen.XMLGen() … … 68 65 rss.writeTag("webMaster", info.HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) 69 66 rss.writeTag("ttl","1440") 70 for confId in res: 71 ch = ConferenceHolder() 72 conf = ch.getById(confId) 67 for conf in res: 73 68 rss = ConferenceToRSS(conf, tz=self._tz).getCore(rss) 74 69 rss.closeTag("channel") … … 110 105 111 106 def 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 793 793 return [] 794 794 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 795 809 class CategoryDateIndexLtd(CategoryDateIndex): 796 810 """ Version of CategoryDateIndex whiself.ch indexing events … … 1460 1474 Idx[str(id)] = CategoryIndex() 1461 1475 elif id=="categoryDate": 1462 Idx[str(id)] = CategoryDa teIndex()1476 Idx[str(id)] = CategoryDayIndex() 1463 1477 elif id=="categoryName": 1464 1478 Idx[str(id)] = TextIndex() -
indico/htdocs/scripts/createCategoryHeader.py
rbdd862 r9705e3 30 30 from pytz import timezone 31 31 32 32 33 def index(req, **params): 33 34 """This script displays the list of meetings taking place in a given category … … 37 38 fid = params['fid'] 38 39 date = params['date'] 39 days = params['days']40 40 except: 41 41 return usage() … … 54 54 #instanciate indexes 55 55 im = indexes.IndexesHolder() 56 catIdx = im.getIndex('category') 57 calIdx = im.getIndex('calendar') 56 calIdx = im.getIndex('categoryDate') 58 57 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) 63 60 res.union_update(confIds) 64 61 … … 70 67 71 68 def 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"; 73 70 74 71 def sortByStartDate(conf1,conf2): 75 72 ch = ConferenceHolder() 76 return cmp(c h.getById(conf1).getStartDate().time(),ch.getById(conf2).getStartDate().time())73 return cmp(conf1.getStartDate().time(), conf2.getStartDate().time()) 77 74 78 75 def displayList(res,tz): … … 80 77 ch = ConferenceHolder() 81 78 curDate = None 82 for confId in res: 83 c = ch.getById(confId)79 80 for c in res: 84 81 if curDate!=c.getAdjustedStartDate(tz): 85 82 curDate = c.getAdjustedStartDate(tz) … … 89 86 90 87 def displayConf(conf,tz): 91 t = "<b>%s</b> / %s / <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> / %s / <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 93 91 94 92 def getCategText(categ): -
indico/htdocs/scripts/export.py
r4a3f5d r9705e3 140 140 data = icalBase._printHeader() 141 141 142 ch = ConferenceHolder() 143 for confId in res: 144 conf = ch.getById(confId) 142 for conf in res: 145 143 ical = ConferenceToiCal(conf.getConference()) 146 144 data += ical.getCore() … … 155 153 def displayList(res,startdate,enddate,repeat,displayCateg,tz): 156 154 text = "" 157 ch = ConferenceHolder()158 155 day = startdate 159 156 days = {} 160 157 found = {} 161 158 while day <= enddate: 162 for confId in res: 163 c = ch.getById(confId) 159 for c in res: 164 160 if day.date() >= c.getAdjustedStartDate(tz).date() and day.date() <= c.getAdjustedEndDate(tz).date() and (repeat==1 or not found.has_key(c)): 165 161 if not days.has_key(day): … … 206 202 xml = xmlGen.XMLGen() 207 203 xml.openTag("collection") 208 for confId in res: 209 c = ch.getById(confId) 204 for c in res: 210 205 xml = displayXMLConf(c,xml,tz,dc) 211 206 xml.closeTag("collection") … … 269 264 rss.writeTag("webMaster", HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) 270 265 rss.writeTag("ttl","1440") 271 for confId in res: 272 c = ch.getById(confId) 266 for c in res: 273 267 rss = displayRSSConf(c,rss,tz) 274 268 rss.closeTag("channel") … … 298 292 299 293 def sortByStartDate(conf1,conf2): 300 ch = ConferenceHolder() 301 return cmp(ch.getById(conf1).getStartDate(),ch.getById(conf2).getStartDate()) 294 return cmp(conf1.getStartDate(),conf2.getStartDate()) 302 295 303 296 def getConfList(startdate,enddate,ids): … … 306 299 #instanciate indexes 307 300 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) 315 305 res = list(res) 316 306 res.sort(sortByStartDate)
Note: See TracChangeset
for help on using the changeset viewer.
