Changeset d2e018 in indico


Ignore:
Timestamp:
04/15/11 11:12:11 (2 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
988cfe
Parents:
48b89d
Message:

[FIX] Status from plugins being ignored

  • Error codes such as 303 were being overridden;
Location:
indico/web/wsgi
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • indico/web/wsgi/indico_wsgi_handler.py

    r66b76d rd2e018  
    9999 
    100100                        if type(rh) == ClassType or RHHtdocs not in rh.mro(): 
    101                             plugin_publisher(req, url, rh, m.groupdict()) 
     101                            raise SERVER_RETURN, plugin_publisher(req, url, rh, m.groupdict()) 
    102102                        else: 
    103103                            # calculate the path to the resource 
     
    187187 
    188188    _convert_to_string(form) 
    189     _check_result(req, rh(req, **urlparams).process( form )) 
     189    return _check_result(req, rh(req, **urlparams).process( form )) 
    190190 
    191191def mp_legacy_publisher(req, possible_module, possible_handler): 
  • indico/web/wsgi/indico_wsgi_handler_utils.py

    r74a94c rd2e018  
    601601        to the client. 
    602602    """ 
    603     if result or req.bytes_sent > 0: 
    604  
    605         if result is (None or 0): 
    606             result = "" 
     603    if result is (None or 0): 
     604        result = "" 
     605    else: 
     606        result = str(result) 
     607 
     608    # unless content_type was manually set, we will attempt 
     609    # to guess it 
     610    if not req.content_type_set_p: 
     611        # make an attempt to guess content-type 
     612        if result[:100].strip()[:6].lower() == '<html>' \ 
     613           or result.find('</') > 0: 
     614            req.content_type = 'text/html' 
    607615        else: 
    608             result = str(result) 
    609  
    610         # unless content_type was manually set, we will attempt 
    611         # to guess it 
    612         if not req.content_type_set_p: 
    613             # make an attempt to guess content-type 
    614             if result[:100].strip()[:6].lower() == '<html>' \ 
    615                or result.find('</') > 0: 
    616                 req.content_type = 'text/html' 
    617             else: 
    618                 req.content_type = 'text/plain' 
    619  
    620         if req.header_only: 
    621             if req.status in (apache.HTTP_NOT_FOUND, ): 
    622                 raise apache.SERVER_RETURN, req.status 
    623         else: 
    624             # It might be interesting in future not to use the write callable 
    625             # with all the web pages. <http://www.python.org/dev/peps/pep-0333/#the-write-callable> 
    626             req.write(result) 
    627  
    628         return apache.OK 
    629  
     616            req.content_type = 'text/plain' 
     617 
     618    if req.header_only: 
     619        if req.status in (apache.HTTP_NOT_FOUND, ): 
     620            raise apache.SERVER_RETURN, req.status 
    630621    else: 
    631         req.log_error("publisher: %s returned nothing." % `object`) 
    632         return apache.HTTP_INTERNAL_SERVER_ERROR 
     622        # It might be interesting in future not to use the write callable 
     623        # with all the web pages. <http://www.python.org/dev/peps/pep-0333/#the-write-callable> 
     624        req.write(result) 
     625        return req.status 
     626 
     627    return apache.OK 
    633628 
    634629def registerException(errorText=""): 
Note: See TracChangeset for help on using the changeset viewer.