• 
      

    Webapi Resource for integrations

    Review Request #7105 — Created March 23, 2015 and discarded

    Information

    Review Board
    master

    Reviewers

    This provides the webapi resource and the views for the integration admin page.

    The webapi resource for both Integration and ConfiguredIntegration are provided here. The Integration resource allows for getting the list of Integrations that implements the class and hook defined in review 6918.

    The ConfiguredIntegration resource allows GET, PUT and DELETE call to manage individual configured integration.

    Unit test done.
    Tested with WebapiResource test for both integrations and configuredIntegration resource.

    Description From Last Updated

    'PERMISSION_DENIED' imported but unused

    reviewbot reviewbot

    'NOT_LOGGED_IN' imported but unused

    reviewbot reviewbot

    'webapi_response_errors' imported but unused

    reviewbot reviewbot

    'webapi_login_required' imported but unused

    reviewbot reviewbot

    'webapi_check_local_site' imported but unused

    reviewbot reviewbot

    local variable 'manager' is assigned to but never used

    reviewbot reviewbot

    'IntegrationManager' imported but unused

    reviewbot reviewbot

    This function needs a docstring.

    brennie brennie

    This function needs a docstring.

    brennie brennie

    Please alphabetize these.

    brennie brennie

    Undo this change.

    brennie brennie

    This method isn't called from anywhere.

    brennie brennie

    This will raise an exception if integration_class is None. You should define integration as None before the if integration_class block.

    brennie brennie

    ConfiguredIntegration.

    brennie brennie

    This docstring will end up in public facing documentation. It should not mention class names of RB-specific things (e.g., ConfiguredIntegration). …

    brennie brennie

    ConfiguredIntegration

    brennie brennie

    integration-id

    brennie brennie

    When is_list is false, this will return a list. Shouldn't it return a single instance?

    brennie brennie

    Can we change this to use integration-id ?

    brennie brennie

    See previous comment about docstrings.

    brennie brennie

    You can use enabled as a key-word argument to the function to not have to look into kwargs.

    brennie brennie

    "Delete a configured integration."

    brennie brennie

    Can we just do the call to get_integration_manager inside the class's __init__ method? Are we ever expecting to instantiate this …

    brennie brennie

    Can we pull the query set out into a variable?

    brennie brennie

    Same comment here re: integration managers as in the previous resource.

    brennie brennie

    No blank line here.

    david david

    All str in here should be six.text_type for future Python 3 compatibility. Here and below.

    david david

    I think I'd prefer if these conditionals were switched: if config and config.integration: return config.integration.name else: return None

    david david

    Same as above.

    david david

    Same as above.

    david david

    Same as above.

    david david

    This should have a docstring.

    david david

    This should have a docstring.

    david david

    No blank line here.

    david david

    All str items in here should be six.text_type

    david david

    Please switch the conditional to test if integration: and return None in the else clause.

    david david

    This should have a docstring.

    david david
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/integrations/admin.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/integrations/admin.py
      
      
    2. 
        
    XU
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
    2. Show all issues
       'PERMISSION_DENIED' imported but unused
      
    3. Show all issues
       'NOT_LOGGED_IN' imported but unused
      
    4. Show all issues
       'webapi_response_errors' imported but unused
      
    5. Show all issues
       'webapi_login_required' imported but unused
      
    6. Show all issues
       'webapi_check_local_site' imported but unused
      
    7. 
        
    XU
    reviewbot
    1. Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
      
      Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
    2. 
        
    XU
    reviewbot
    1. Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
      
      Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
    2. Show all issues
       local variable 'manager' is assigned to but never used
      
    3. 
        
    XU
    reviewbot
    1. Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
      
      Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
    2. Show all issues
       'IntegrationManager' imported but unused
      
    3. 
        
    XU
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
    2. 
        
    brennie
    1. Can you change references to "webapi" in your summary and description to "WebAPI" ?

    2. reviewboard/integrations/views.py (Diff revision 6)
       
       
      Show all issues

      This function needs a docstring.

    3. reviewboard/integrations/views.py (Diff revision 6)
       
       
      Show all issues

      This function needs a docstring.

    4. reviewboard/webapi/resources/__init__.py (Diff revision 6)
       
       
       
      Show all issues

      Please alphabetize these.

    5. Show all issues

      Undo this change.

    6. Show all issues

      This method isn't called from anywhere.

      1. I understand how this works now, dropping.

    7. 
        
    XU
    reviewbot
    1. Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
      
      Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
    2. 
        
    brennie
    1. 
        
    2. reviewboard/integrations/views.py (Diff revision 7)
       
       
       
       
       
       
       
       
      Show all issues

      This will raise an exception if integration_class is None. You should define integration as None before the if integration_class block.

    3. Show all issues

      ConfiguredIntegration.

    4. reviewboard/webapi/resources/configured_integration.py (Diff revision 7)
       
       
       
       
       
       
       
      Show all issues

      This docstring will end up in public facing documentation. It should not mention class names of RB-specific things (e.g., ConfiguredIntegration). Instead it should just refer to, e.g., "configuration integration".

    5. Show all issues

      ConfiguredIntegration

    6. Show all issues

      integration-id

    7. Show all issues

      When is_list is false, this will return a list. Shouldn't it return a single instance?

      1. The superclass's get_object method in WebAPI resource will be calling get_queryset to get the queryset before reducing it down to a single item. From my understanding of the get_queryset method, it seems to be a pre-process optimzation stage to reduce/specialize the query depending on whether it is a list or not.

    8. Show all issues

      Can we change this to use integration-id ?

    9. reviewboard/webapi/resources/configured_integration.py (Diff revision 7)
       
       
       
       
       
       
      Show all issues

      See previous comment about docstrings.

    10. Show all issues

      You can use enabled as a key-word argument to the function to not have to look into kwargs.

    11. Show all issues

      "Delete a configured integration."

    12. Show all issues

      Can we just do the call to get_integration_manager inside the class's __init__ method?

      Are we ever expecting to instantiate this with a different integration manager?

    13. reviewboard/webapi/resources/integration.py (Diff revision 7)
       
       
       
       
      Show all issues

      Can we pull the query set out into a variable?

    14. Show all issues

      Same comment here re: integration managers as in the previous resource.

    15. 
        
    XU
    reviewbot
    1. Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
      
      Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/root.py
          reviewboard/integrations/urls.py
          reviewboard/webapi/resources/__init__.py
          reviewboard/webapi/tests/test_configured_integration.py
          reviewboard/integrations/views.py
          reviewboard/webapi/resources/configured_integration.py
          reviewboard/webapi/resources/integration.py
          reviewboard/urls.py
          reviewboard/webapi/tests/test_integration.py
          reviewboard/integrations/admin.py
      
      
    2. 
        
    david
    1. Some of the parts of this change look like they'd be more appropriate for /r/7106 (like the admin.py, urls.py, and views.py changes)

    2. Show all issues

      No blank line here.

    3. Show all issues

      All str in here should be six.text_type for future Python 3 compatibility. Here and below.

    4. Show all issues

      I think I'd prefer if these conditionals were switched:

      if config and config.integration:
          return config.integration.name
      else:
          return None
      
    5. Show all issues

      Same as above.

    6. reviewboard/webapi/resources/configured_integration.py (Diff revision 8)
       
       
       
       
       
       
      Show all issues

      Same as above.

    7. Show all issues

      Same as above.

    8. Show all issues

      This should have a docstring.

    9. Show all issues

      This should have a docstring.

    10. Show all issues

      No blank line here.

    11. Show all issues

      All str items in here should be six.text_type

    12. reviewboard/webapi/resources/integration.py (Diff revision 8)
       
       
       
       
       
       
      Show all issues

      Please switch the conditional to test if integration: and return None in the else clause.

    13. Show all issues

      This should have a docstring.

    14. 
        
    XU
    Review request changed
    Status:
    Discarded
    Change Summary:

    Closed in favor of a revised version of Integrations that landed for 3.0.