New submission from Ezio Melotti:

I haven't tried the patch yet, but in

+        if len(user_id) > 1:
+            # pick first matching user, when multiple found
+            user_id = user_id[0]
+        elif len(user_id) < 1:
+            # set bpobot as userid when none is found
+            user_id = self.db.user.filter(None, {'username': 'python-dev'})
+            if len(user_id) != 1:
+                # python-dev does not exists, anonymous will be used instead
+                return
+        username = self.db.user.get(user_id[0], 'username')
+        self.db.setCurrentUser(username)

I think you'll end up with a user_id in the >1 case and a list (assuming filter 
returns a list) in the <1 case.  At the end you take the first element of the 
list, which is correct only for the <1 case (unless filters returns a single 
id, but in that case I'm not sure what the [0] at the end is for).  I would 
also suggest to user user_ids and user_id to distinguish the list from the 
single id.

I would rename set_current_user() to something more explicit, or, if the only 
purpose of this method is to affect the author=self.db.getuid(), perhaps remove 
the method and use a module/class-level constant.  The same constant could also 
be used in the snippet I pasted above to avoid duplication.

Does

+            newmsg = self.db.msg.create(content=msg, author=self.db.getuid())
+            issue_msgs.append(newmsg)
+            self.db.issue.set(issue_id, messages=issue_msgs)

produces the correct output in the history at the bottom of the issue? (i.e. 
does it show "set  messages: +msgXXX" with only the new message, rather than 
the whole list of messages?)

I would move the .encode('utf-8') from dispatch() to handle_action() (add it to 
the line "'branch': branch.encode('utf-8'),").

The commit_id variable in handle_action() is unused.

Any reason why you used Template() instead of a simply using format() (or %)?  
You might also be able to get rid of all those encode if you use format().

github/roundup should be capitalized properly in the docstrings.  The docstring 
for handle_action() could be a bit more explicit :)

_______________________________________________________
PSF Meta Tracker <metatrac...@psf.upfronthosting.co.za>
<http://psf.upfronthosting.co.za/roundup/meta/issue611>
_______________________________________________________
_______________________________________________
Tracker-discuss mailing list
Tracker-discuss@python.org
https://mail.python.org/mailman/listinfo/tracker-discuss
Code of Conduct: https://www.python.org/psf/codeofconduct/

Reply via email to