Changeset a3fc2e in indico for indico/web/http_api/api.py
- Timestamp:
- 09/19/11 14:40:44 (21 months ago)
- Branches:
- master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.99, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 10eafd9ae230cbad5d99d5aaf22c24724fb6c98f
- Children:
- 2cb1cc
- Parents:
- 03c6d2d (diff), b2a7f8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
indico/web/http_api/api.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indico/web/http_api/api.py
r03c6d2d ra3fc2e 45 45 from indico.web.http_api.fossils import IConferenceMetadataFossil,\ 46 46 IConferenceMetadataWithContribsFossil, IConferenceMetadataWithSubContribsFossil,\ 47 IConferenceMetadataWithSessionsFossil, IPeriodFossil 47 IConferenceMetadataWithSessionsFossil, IPeriodFossil, ICategoryMetadataFossil,\ 48 ICategoryProtectedMetadataFossil 48 49 from indico.web.http_api.responses import HTTPAPIError 49 50 from indico.web.wsgi import webinterface_handler_config as apache … … 51 52 # indico legacy imports 52 53 from MaKaC.common.db import DBMgr 54 from MaKaC.conference import CategoryManager 53 55 from MaKaC.common.indexes import IndexesHolder 54 56 from MaKaC.common.info import HelperMaKaCInfo … … 204 206 raise NotImplementedError(self.PREFIX + '_' + self._type) 205 207 208 extraFunc = getattr(self, self.PREFIX + '_' + self._type + '_extra', None) 209 extra = extraFunc(aw) if extraFunc else None 210 206 211 if not self.COMMIT: 207 212 # Just execute the function, we'll never have to repeat it … … 222 227 raise HTTPAPIError('An unresolvable database conflict has occured', apache.HTTP_INTERNAL_SERVER_ERROR) 223 228 224 return resultList, complete, self.SERIALIZER_TYPE_MAP229 return resultList, extra, complete, self.SERIALIZER_TYPE_MAP 225 230 226 231 … … 408 413 return expInt.category(self._idList) 409 414 415 def export_categ_extra(self, aw): 416 return { 417 'categHierarchy': CategoryEventFetcher.getCategoryPath(self._idList, aw) 418 } 419 410 420 def export_event(self, aw): 411 421 expInt = CategoryEventFetcher(aw, self) … … 429 439 def _postprocess(self, obj, fossil, iface): 430 440 return self._addOccurrences(fossil, obj, self._fromDT, self._toDT) 441 442 @classmethod 443 def getCategoryPath(cls, idList, aw): 444 paths = {} 445 for id in idList: 446 paths['categ_' + id] = cls._getCategoryPath(id, aw) 447 return paths 448 449 @staticmethod 450 def _getCategoryPath(id, aw): 451 path = [] 452 cat = CategoryManager().getById(id) 453 while cat: 454 iface = ICategoryMetadataFossil if cat.canAccess(aw) else ICategoryProtectedMetadataFossil 455 path.append(fossilize(cat, iface)) 456 cat = cat.getOwner() 457 path.reverse() 458 return path 431 459 432 460 @staticmethod
Note: See TracChangeset
for help on using the changeset viewer.
