~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/mail/commands.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-18 13:44:27 UTC
  • mfrom: (13691.1.8 private-bug-1)
  • Revision ID: launchpad@pqm.canonical.com-20110818134427-cmplu2l2iybxdtcy
[r=stevenk][no-qa] Convert doctests to unittests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
428
428
        """Split the path part into two.
429
429
 
430
430
        The first part is the part before any slash, and the other is
431
 
        the part behind the slash:
432
 
 
433
 
            >>> AffectsEmailCommand._splitPath('foo/bar/baz')
434
 
            ('foo', 'bar/baz')
435
 
 
436
 
        If No slash is in the path, the other part will be empty.
437
 
 
438
 
            >>> AffectsEmailCommand._splitPath('foo')
439
 
            ('foo', '')
 
431
        the part behind the slash.
440
432
        """
441
433
        if '/' not in path:
442
434
            return path, ''
450
442
        Previously the path had to start with either /distros/ or
451
443
        /products/. Simply remove any such prefixes to stay backward
452
444
        compatible.
453
 
 
454
 
            >>> AffectsEmailCommand._normalizePath('/distros/foo/bar')
455
 
            'foo/bar'
456
 
            >>> AffectsEmailCommand._normalizePath('/distros/foo/bar')
457
 
            'foo/bar'
458
 
 
459
 
        Also remove a starting slash, since that's a common mistake.
460
 
 
461
 
            >>> AffectsEmailCommand._normalizePath('/foo/bar')
462
 
            'foo/bar'
463
445
        """
464
446
        for prefix in ['/distros/', '/products/', '/']:
465
447
            if path.startswith(prefix):