← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~ivo-kracht/launchpad/bug-425934 into lp:launchpad

 

Ivo Kracht has proposed merging lp:~ivo-kracht/launchpad/bug-425934 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ivo-kracht/launchpad/bug-425934/+merge/110786

I changed one line in the helper.py so that it converts all uppercase characters to lowercase characters. Incoming commands and args are now case insensitive. Converting everything to lowercase in the parse.commands function may be a little bit rough but should not create any problems. The only potential problem i can see is when project names and/or usernames are passed to the function but as far as I can see they have to be lowercase anyway.

Pre-imp call with adeuring

tests:

./bin/test services -vvt test_helpers

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/services/mail/helpers.py
  lib/lp/services/mail/tests/test_helpers.py
-- 
https://code.launchpad.net/~ivo-kracht/launchpad/bug-425934/+merge/110786
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~ivo-kracht/launchpad/bug-425934 into lp:launchpad.
=== modified file 'lib/lp/services/mail/helpers.py'
--- lib/lp/services/mail/helpers.py	2012-03-02 19:45:41 +0000
+++ lib/lp/services/mail/helpers.py	2012-06-18 11:45:39 +0000
@@ -110,6 +110,7 @@
     commands = []
     for line in content.splitlines():
         # All commands have to be indented.
+        line = line.lower()
         if line.startswith(' ') or line.startswith('\t'):
             command_string = line.strip()
             if command_string == 'done':

=== modified file 'lib/lp/services/mail/tests/test_helpers.py'
--- lib/lp/services/mail/tests/test_helpers.py	2012-03-05 20:13:15 +0000
+++ lib/lp/services/mail/tests/test_helpers.py	2012-06-18 11:45:39 +0000
@@ -56,6 +56,13 @@
             [('command', ['arg1', 'arg2'])],
             parse_commands(' command arg1 arg2', ['command']))
 
+    def test_parse_commands_args_uppercase(self):
+        """Commands and args containing uppercase letters are converted to
+        lowercase."""
+        self.assertEqual(
+            [('command', ['arg1', 'arg2'])],
+            parse_commands(' comMand Arg1 aRg2', ['command']))
+
     def test_parse_commands_args_quoted(self):
         """Commands indented with spaces are recognized."""
         self.assertEqual(


Follow ups