Merge lp:~jseutter/lp2kanban/description-too-long into lp:~launchpad/lp2kanban/trunk

Proposed by Jerry Seutter
Status: Rejected
Rejected by: William Grant
Proposed branch: lp:~jseutter/lp2kanban/description-too-long
Merge into: lp:~launchpad/lp2kanban/trunk
Diff against target: 53 lines (+20/-2)
3 files modified
src/lp2kanban/bugs2cards.py (+2/-1)
src/lp2kanban/kanban.py (+0/-1)
src/lp2kanban/tests/test_bugs2cards.py (+18/-0)
To merge this branch: bzr merge lp:~jseutter/lp2kanban/description-too-long
Reviewer Review Type Date Requested Status
Chad Smith (community) Disapprove
Canonical Launchpad Engineering Pending
Review via email: mp+180159@code.launchpad.net

Description of the change

Leankit appears to have a limitation on card description size of just under 20,000 characters. When bugs2cards tries to save a card with a larger description an error is thrown and the script fails. The Launchpad bug description should be truncated to avoid this situation.

To post a comment you must log in.
Revision history for this message
Chad Smith (chad.smith) wrote :

This branch has been resubmitted shepherded into lp:~landscape/lp2kanban/landscape-deploy. We can close this request against lp:lp2kanban

review: Disapprove

Unmerged revisions

90. By Jerry Seutter

Truncate description length when too long for Leankit.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/lp2kanban/bugs2cards.py'
2--- src/lp2kanban/bugs2cards.py 2013-06-19 19:44:20 +0000
3+++ src/lp2kanban/bugs2cards.py 2013-08-14 14:48:14 +0000
4@@ -396,7 +396,8 @@
5 print " Creating card for bug %s in %s." % (bug.id, next_lane.title)
6 card = next_lane.addCard()
7 card.title = bug.title
8- card.description = bug.description
9+ # Leankit empirically has a max description length of 19997 bytes
10+ card.description = bug.description[:19500]
11 card.external_card_id = str(bug.id)
12 card.type_id = new_cardtype
13 card.save()
14
15=== modified file 'src/lp2kanban/kanban.py'
16--- src/lp2kanban/kanban.py 2013-05-24 14:48:07 +0000
17+++ src/lp2kanban/kanban.py 2013-08-14 14:48:14 +0000
18@@ -106,7 +106,6 @@
19 print "Error from kanban"
20 pprint(resp)
21 raise IOError('kanban error %d' % (resp.status_code))
22-
23 response = Record(json.loads(resp.content))
24
25 if (handle_errors and
26
27=== modified file 'src/lp2kanban/tests/test_bugs2cards.py'
28--- src/lp2kanban/tests/test_bugs2cards.py 2013-04-08 12:50:46 +0000
29+++ src/lp2kanban/tests/test_bugs2cards.py 2013-08-14 14:48:14 +0000
30@@ -750,6 +750,24 @@
31 [card] = board.cards
32 self.assertEqual('incoming', card.lane.path)
33
34+ def test_bug_with_long_description_truncated(self):
35+ # Bug descriptions that exceed the 19997 character limit of a
36+ # kanban card are truncated to 19500 bytes.
37+ board = FauxBoard()
38+ bug_lane = board.addLane('bugs')
39+ project = FauxLaunchpadProject(
40+ bug_tasks=[FauxBugTask(
41+ bug_id=42, title='Test bug',
42+ description='x' * 20000,
43+ tags=['kanban'])])
44+ create_new_cards(board, project, 'kanban')
45+ [card] = board.cards
46+ self.assertEqual('Test bug', card.title)
47+ self.assertEqual(19500, len(card.description))
48+ self.assertEqual('42', card.external_card_id)
49+ self.assertEqual(board.default_cardtype.id, card.type_id)
50+ self.assertTrue(card.saved)
51+
52
53 class GroupsConfigTest(unittest.TestCase):
54

Subscribers

People subscribed via source and target branches