Changeset d160e4d in indico
- Timestamp:
- 08/23/11 15:38:54 (21 months ago)
- Branches:
- master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
- Children:
- 4dd9bd0
- Parents:
- c5fcd0
- git-author:
- Pedro Ferreira <jose.pedro.ferreira@…> (05/25/11 09:09:23)
- git-committer:
- Jose Benito <jose.benito.gonzalez@…> (08/23/11 15:38:54)
- Location:
- indico
- Files:
-
- 3 edited
-
util/fossilize/__init__.py (modified) (5 diffs)
-
util/metadata/serializer.py (modified) (1 diff)
-
web/http_api/handlers.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indico/util/fossilize/__init__.py
rcfffdf8 rd160e4d 57 57 zope.interface.classImplements(klazz, fossil) 58 58 59 59 60 def clearCache(): 60 61 """ … … 63 64 Fossilizable.clearCache() 64 65 66 65 67 class NonFossilizableException(Exception): 66 68 """ 67 69 Object is not fossilizable (doesn't implement Fossilizable) 68 70 """ 71 69 72 70 73 class InvalidFossilException(Exception): … … 74 77 """ 75 78 79 76 80 class IFossil(zope.interface.Interface): 77 81 """ 78 82 Fossil base interface. All fossil classes should derive from this one. 79 83 """ 84 80 85 81 86 class Fossilizable(object): … … 187 192 return interface 188 193 194 189 195 @classmethod 190 196 def clearCache(cls): … … 193 199 """ 194 200 cls.__fossilAttrsCache = {} 201 195 202 196 203 @classmethod -
indico/util/metadata/serializer.py
ra71221 rd160e4d 18 18 ## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 19 19 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 20 21 21 22 class Serializer(object): -
indico/web/http_api/handlers.py
rdb9819 rd160e4d 26 26 import hashlib 27 27 import hmac 28 import itertools29 28 import re 30 29 import time … … 32 31 from urlparse import parse_qs 33 32 from ZODB.POSException import ConflictError 34 import pytz35 33 36 34 # indico imports 37 from indico.web.http_api import Export Interface, LimitExceededException, Exporter35 from indico.web.http_api import Exporter 38 36 from indico.web.http_api.auth import APIKeyHolder 39 37 from indico.web.http_api.cache import RequestCache 40 38 from indico.web.http_api.responses import HTTPAPIResult, HTTPAPIError 41 39 from indico.web.http_api.util import remove_lists, get_query_parameter 42 from indico.web.http_api import API_MODE_ KEY, API_MODE_ONLYKEY, API_MODE_SIGNED, API_MODE_ONLYKEY_SIGNED, API_MODE_ALL_SIGNED40 from indico.web.http_api import API_MODE_ONLYKEY, API_MODE_SIGNED, API_MODE_ONLYKEY_SIGNED, API_MODE_ALL_SIGNED 43 41 from indico.web.wsgi import webinterface_handler_config as apache 44 42 from indico.util.metadata.serializer import Serializer … … 46 44 # indico legacy imports 47 45 from MaKaC.common import DBMgr 48 from MaKaC.common.fossilize import fossilizes, fossilize, Fossilizable 46 from MaKaC.common.logger import Logger 47 from MaKaC.common.fossilize import fossilize 49 48 from MaKaC.accessControl import AccessWrapper 50 49 from MaKaC.common.info import HelperMaKaCInfo 51 from MaKaC.plugins.base import PluginsHolder 52 53 # Maximum number of records that will get exported for each detail level 54 MAX_RECORDS = { 55 'events': 10000, 56 'contributions': 500, 57 'subcontributions': 500, 58 'sessions': 100, 59 } 60 61 # Valid URLs for export handlers. the last group has to be the response type 62 EXPORT_URL_MAP = { 63 r'/export/(event|categ)/(\w+(?:-\w+)*)\.(\w+)$': 'handler_event_categ' 64 } 65 66 # Compile url regexps 67 EXPORT_URL_MAP = dict((re.compile(pathRe), handlerFunc) for pathRe, handlerFunc in EXPORT_URL_MAP.iteritems()) 50 51 68 52 # Remove the extension at the end or before the querystring 69 53 RE_REMOVE_EXTENSION = re.compile(r'\.(\w+)(?:$|(?=\?))') … … 135 119 136 120 def handler(req, **params): 121 logger = Logger.get('httpapi') 137 122 path, query = req.URLFields['PATH_INFO'], req.URLFields['QUERY_STRING'] 138 123 # Parse the actual query string … … 173 158 174 159 obj = None 175 add _to_cache = True160 addToCache = True 176 161 cache_key = RE_REMOVE_EXTENSION.sub('', cache_key) 177 162 if not no_cache: … … 180 165 result, complete, typeMap = obj.getContent() 181 166 ts = obj.getTS() 182 add _to_cache = False167 addToCache = False 183 168 if result is None: 184 169 # Perform the actual exporting 185 170 result, complete, typeMap = func(aw) 186 if result is not None and add _to_cache:171 if result is not None and addToCache: 187 172 cache.cacheObject(cache_key, (result, complete, typeMap)) 188 173 except HTTPAPIError, e: … … 222 207 223 208 req.headers_out['Content-Type'] = serializer.getMIMEType() 224 return serializer(resultFossil) 209 210 try: 211 return serializer(resultFossil) 212 except: 213 logger.exception('Serialization error in request %s?%s' % (path, query)) 214 raise
Note: See TracChangeset
for help on using the changeset viewer.
