Create extension for auto-assigning students to the students group

Review Request #7872 — Created Jan. 15, 2016 and submitted

Information

student-sonar
master
5750492...

Reviewers

A simple extension for auto-assigning students working on Review Board to
the "students" group.

I can imagine this maybe being useful for other projects as well, so I can
see this expanding out to allow multiple auto-assignments, but for now I've
just hard-coded the "students" group.

Created some test users and a "students" group. Entered the extension
configuration page and added some users in the comma-separated list to
auto-assign. Created review requests for the users in the list and saw
that they were correctly added to the "students" group. The review requests
from the other users were not.

Also verified that the "open" counts in the dashboard for the group
was updated correctly after creating an auto-assigned review request.

Description From Last Updated

Also a lie!

daviddavid

This is a lie.

daviddavid

Swap these two lines.

daviddavid

This is impossible.

daviddavid

These could be combined into a single assignment: assignees = [ s.strip() for s in self.settings.get('assignees').split(',') ]

daviddavid

This should probably be logging.debug.

daviddavid

No blank line here.

daviddavid

Localize this too?

daviddavid

Col: 22 E128 continuation line under-indented for visual indent

reviewbotreviewbot
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        misc/rb-auto-assigner/rb_auto_assigner/forms.py
        misc/rb-auto-assigner/rb_auto_assigner/extension.py
        misc/rb-auto-assigner/setup.py
        misc/rb-auto-assigner/rb_auto_assigner/admin_urls.py
    
    Ignored Files:
        misc/rb-auto-assigner/rb_auto_assigner/__init__.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        misc/rb-auto-assigner/rb_auto_assigner/forms.py
        misc/rb-auto-assigner/rb_auto_assigner/extension.py
        misc/rb-auto-assigner/setup.py
        misc/rb-auto-assigner/rb_auto_assigner/admin_urls.py
    
    Ignored Files:
        misc/rb-auto-assigner/rb_auto_assigner/__init__.py
    
    
  2. 
      
mike_conley
  1. Originally posted for review for the rb-extension-pack repo here: https://reviews.reviewboard.org/r/7856/

  2. 
      
david
  1. Please also see my comments on pre_save on your other review request for this.

    1. Done. I ended up having to use post_save, otherwise I got an error attempting to fiddle with the ManyToMany relationship:

      2016-01-16 06:55:37,323 - ERROR -  - Error when calling <bound method RBAutoAssigner.on_pre_save of <rb_auto_assigner.extension.RBAutoAssigner object at 0x10cfb32d0>> from SignalHook: "<ReviewRequest: (no summary)>" needs to have a value for field "reviewrequest" before this many-to-many relationship can be used.
      Traceback (most recent call last):
        File "/Users/mikeconley/Projects/rb-vm-dev/src/djblets/djblets/extensions/hooks.py", line 439, in _wrap_callback
          self.callback(extension=self.extension, **kwargs)
        File "/Users/mikeconley/Projects/rb-vm-dev/src/student-sonar/misc/rb-auto-assigner/rb_auto_assigner/extension.py", line 58, in on_pre_save
          instance.target_groups.add(group)
        File "/usr/local/lib/python2.7/site-packages/django/db/models/fields/related.py", line 827, in __get__
          through=self.field.rel.through,
        File "/usr/local/lib/python2.7/site-packages/django/db/models/fields/related.py", line 524, in __init__
          (instance, source_field_name))
      ValueError: "<ReviewRequest: (no summary)>" needs to have a value for field "reviewrequest" before this many-to-many relationship can be used.
      
  2. misc/rb-auto-assigner/setup.py (Diff revision 1)
     
     
     

    This is a lie.

  3. 
      
mike_conley
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        misc/rb-auto-assigner/rb_auto_assigner/forms.py
        misc/rb-auto-assigner/rb_auto_assigner/extension.py
        misc/rb-auto-assigner/setup.py
        misc/rb-auto-assigner/rb_auto_assigner/admin_urls.py
    
    Ignored Files:
        misc/rb-auto-assigner/rb_auto_assigner/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        misc/rb-auto-assigner/rb_auto_assigner/forms.py
        misc/rb-auto-assigner/rb_auto_assigner/extension.py
        misc/rb-auto-assigner/setup.py
        misc/rb-auto-assigner/rb_auto_assigner/admin_urls.py
    
    Ignored Files:
        misc/rb-auto-assigner/rb_auto_assigner/__init__.py
    
    
  2. 
      
david
  1. 
      
  2. Swap these two lines.

  3. misc/rb-auto-assigner/rb_auto_assigner/extension.py (Diff revision 2)
     
     
     
     
     

    This is impossible.

  4. These could be combined into a single assignment:

    assignees = [
        s.strip() for s in
        self.settings.get('assignees').split(',')
    ]
    
  5. This should probably be logging.debug.

  6. Can you verify that the open counts in the dashboard are updated correctly for this?

    1. Yep, after publishing, it looks like the counts are updated for the group.

  7. No blank line here.

  8. Localize this too?

  9. 
      
mike_conley
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        misc/rb-auto-assigner/rb_auto_assigner/forms.py
        misc/rb-auto-assigner/rb_auto_assigner/extension.py
        misc/rb-auto-assigner/setup.py
        misc/rb-auto-assigner/rb_auto_assigner/admin_urls.py
    
    Ignored Files:
        misc/rb-auto-assigner/rb_auto_assigner/__init__.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        misc/rb-auto-assigner/rb_auto_assigner/forms.py
        misc/rb-auto-assigner/rb_auto_assigner/extension.py
        misc/rb-auto-assigner/setup.py
        misc/rb-auto-assigner/rb_auto_assigner/admin_urls.py
    
    Ignored Files:
        misc/rb-auto-assigner/rb_auto_assigner/__init__.py
    
    
  2. Col: 22
     E128 continuation line under-indented for visual indent
    
  3. 
      
mike_conley
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        misc/rb-auto-assigner/rb_auto_assigner/forms.py
        misc/rb-auto-assigner/rb_auto_assigner/extension.py
        misc/rb-auto-assigner/setup.py
        misc/rb-auto-assigner/rb_auto_assigner/admin_urls.py
    
    Ignored Files:
        misc/rb-auto-assigner/rb_auto_assigner/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        misc/rb-auto-assigner/rb_auto_assigner/forms.py
        misc/rb-auto-assigner/rb_auto_assigner/extension.py
        misc/rb-auto-assigner/setup.py
        misc/rb-auto-assigner/rb_auto_assigner/admin_urls.py
    
    Ignored Files:
        misc/rb-auto-assigner/rb_auto_assigner/__init__.py
    
    
  2. 
      
mike_conley
david
  1. Ship It!
  2. 
      
mike_conley
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (f294119)
Loading...