207
214
data["UserWipOverrideComment"] = None;
208
215
if ("AssignedUsers" in data and
209
216
"assigned_user_id" not in self.dirty_attrs):
210
del data['AssignedUserId']
211
del data['AssignedUserName']
217
if 'AssignedUserId' in data.keys():
218
del data['AssignedUserId']
219
if 'AssignedUserName' in data.keys():
220
del data['AssignedUserName']
212
221
data['AssignedUserIds'] = map(
213
222
lambda X: X['AssignedUserId'], data['AssignedUsers'])
293
302
self.external_card_id = src.external_card_id
294
303
self.assigned_user_id = src.assigned_user_id
307
def parsed_description(self):
308
"""Parse the card description to find key=value pairs.
310
:return: A tuple of (json_annotations, text_before_json,
311
text_after_json), where json_annotations contains the
312
JSON loaded with json.loads().
314
match = ANNOTATION_REGEX.search(self.description)
316
start = match.start()
319
Record(json.loads(self.description[start:end])),
320
self.description[:start].strip(),
321
self.description[end:].strip())
323
return Record(), self.description, ''
325
def _setDescriptionAnnotations(self, new_annotations):
326
"""Update the card's description annotations.
328
Note that this will overwrite all the annotations in the
331
:param new_annotations: A dict of new annotations to store.
333
old_annotations, text_before_json, text_after_json = (
334
self.parsed_description)
335
annotation_text = json.dumps(new_annotations)
336
new_description = dedent("""
341
text_before_json=text_before_json, json_data=annotation_text,
342
text_after_json=text_after_json)
343
self.description = new_description.strip()
346
def description_annotations(self):
347
if self._description_annotations is None:
348
annotations, ignored_1, ignored_2 = self.parsed_description
349
self._description_annotations = annotations
350
return self._description_annotations
296
353
class LeankitLane(Converter):
297
354
attributes = ['Id', 'Title', 'Index', 'Orientation', 'ParentLaneId']
298
355
optional_attributes = ['Type']
410
468
self._populateUsers(self.details['BoardUsers'])
411
469
self._populateCardTypes(self.details['CardTypes'])
470
self._archive = self.connector.get(
471
"/Board/" + str(self.id) + "/Archive").ReplyData[0]
472
archive_lanes = [lane_dict['Lane'] for lane_dict in self._archive]
473
archive_lanes.extend([lane_dict['Lane'] for lane_dict in self._archive[0]['ChildLanes']])
474
self._backlog = self.connector.get(
475
"/Board/" + str(self.id) + "/Backlog").ReplyData[0]
412
476
self._populateLanes(
413
self.details['Lanes'] + self.details['Archive'] +
414
self.details['Backlog'])
477
self.details['Lanes'] + archive_lanes + self._backlog)
416
479
def _populateUsers(self, user_data):