Preserve decorator state across webapi decorators.

Review Request #4652 — Created Sept. 26, 2013 and submitted

chipx86
Djblets
master
djblets

Preserve decorator state across webapi decorators.

Several of the webapi decorators attempted to set things like possible
error results, but they'd be lost, due to decorators not passing on that
information correctly. In some other cases, the wrong function would be
modified (which ended up working anyway, due to the function's
dictionary being transferred after, but it polluted the function).

There's now a @webapi_decorator, which intelligently merges things like
the error response and request field lists. It's meant as a replacement
for @simple_decorator for creating webapi-specific decorators.

Along with this, the calls to @webapi_response_errors in decorators have
been moved to decorate the correct function.

Added new unit tests, which pass.

Tested with my API lintian tool that error responses were being set correctly
now.

Description From Last Updated

local variable 'result' is assigned to but never used

reviewbotreviewbot

local variable 'result' is assigned to but never used

reviewbotreviewbot

local variable 'old_db_name' is assigned to but never used

reviewbotreviewbot

'contextlib' imported but unused

reviewbotreviewbot

undefined name 'old_name'

reviewbotreviewbot
reviewbot
  1. This is a review from Review Bot.
    Tool: PEP8 Style Checker
    Processed Files:
    djblets/webapi/decorators.py
    tests/runtests.py
    djblets/webapi/errors.py
    djblets/webapi/tests.py
    Ignored Files:

  2. 
      
reviewbot
  1. This is a review from Review Bot.
    Tool: Pyflakes
    Processed Files:
    djblets/webapi/decorators.py
    tests/runtests.py
    djblets/webapi/errors.py
    djblets/webapi/tests.py
    Ignored Files:

  2. djblets/webapi/tests.py (Diff revision 1)
     
     

    local variable 'result' is assigned to but never used

  3. djblets/webapi/tests.py (Diff revision 1)
     
     

    local variable 'result' is assigned to but never used

  4. tests/runtests.py (Diff revision 1)
     
     

    local variable 'old_db_name' is assigned to but never used

  5. tests/runtests.py (Diff revision 1)
     
     

    'contextlib' imported but unused

  6. tests/runtests.py (Diff revision 1)
     
     

    undefined name 'old_name'

  7. 
      
david
  1. Looks good once you make ReviewBot happy.

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Loading...