Changeset 5746

Show
Ignore:
Timestamp:
11/22/08 16:44:23 (2 months ago)
Author:
faide
Message:

white spaces so I don't suffocate when reading the code.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/turbogears/controllers.py

    r5728 r5746  
    325325    if not template: 
    326326        template = format 
     327 
    327328    if format == "json" or (format is None and template is None): 
    328329        template = "json" 
    329330        allow_json = True 
     331 
    330332    if content_type is None: 
    331333        content_type = config.get("tg.content_type", None) 
     
    376378def _execute_func(func, template, format, content_type, mapping, fragment, args, kw): 
    377379    """Call controller method and process it's output.""" 
     380 
    378381    if config.get("tg.strict_parameters", False): 
    379382        tg_util.remove_keys(kw, ["tg_random", "tg_format"] 
    380383            + config.get("tg.ignore_parameters", [])) 
     384 
    381385    else: 
    382386        # get special parameters used by upstream decorators like paginate 
    383387        try: 
    384388            tg_kw = dict([(k, v) for k, v in kw.items() if k in func._tg_args]) 
     389 
    385390        except AttributeError: 
    386391            tg_kw = {} 
     392 
    387393        # remove excessive parameters 
    388394        args, kw = tg_util.adapt_call(func, args, kw) 
    389395        # add special parameters again 
    390396        kw.update(tg_kw) 
     397 
    391398    if config.get('server.environment', 'development') == 'development': 
    392399        # Only output this in development mode: If it's a field storage object, 
    393400        # this means big memory usage, and we don't want that in production 
    394401        log.debug("Calling %s with *(%s), **(%s)", func, args, kw) 
     402 
    395403    output = errorhandling.try_call(func, *args, **kw) 
    396404    if isinstance(output, list): 
    397405        return output 
     406 
    398407    if str(getattr(response, 'status', '')).startswith('204'): 
    399408        # HTTP status 204 indicates a response with no body 
     
    401410        try: 
    402411            del response.headers['Content-Type'] 
     412 
    403413        except (AttributeError, KeyError): pass 
    404414        return 
     415 
    405416    else: 
    406417        assert isinstance(output, basestring) or isinstance(output, dict) \ 
     
    409420               "be of type basestring, dict or generator." % ( 
    410421                args[0].__class__.__name__, fun.__name__) 
     422 
    411423        if isinstance(output, dict): 
    412424            template = output.pop("tg_template", template) 
    413425            format = output.pop("tg_format", format) 
     426 
    414427        if template and template.startswith("."): 
    415428            template = func.__module__[:func.__module__.rfind('.')]+template 
     429 
    416430        return _process_output(output, template, format, content_type, mapping, 
    417431                               fragment)