From db3f6dff72345c0a6c760ab6e0e670e5301be22d Mon Sep 17 00:00:00 2001 From: Kosta Harlan Date: Thu, 3 Apr 2014 20:27:18 -0400 Subject: [PATCH] Convert body text to markdown --- bugwarrior/README.rst | 8 ++++++-- bugwarrior/services/activecollab.py | 10 +++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/bugwarrior/README.rst b/bugwarrior/README.rst index 2059d735a..04792791f 100644 --- a/bugwarrior/README.rst +++ b/bugwarrior/README.rst @@ -15,7 +15,7 @@ It currently supports the following remote resources: - `teamlab `_ - `redmine `_ - `jira `_ - - `activecollab `_ (2.x and 3.x) + - `activecollab `_ (2.x and 3.x/4.x) - `phabricator `_ Configuring @@ -361,7 +361,11 @@ Create a ``~/.bugwarriorrc`` file with the following contents. # will make 21 API calls on each run: 1 call to get a list of favorites, then # 2 API calls per projects, one for tasks and one for subtasks. # - # You must install the pyac library (python-activecollab): `pip install pyac`. + # Required python modules: + # + # - pypandoc + # - pyac + # [activecollab] service = activecollab activecollab.url = https://ac.example.org/api.php diff --git a/bugwarrior/services/activecollab.py b/bugwarrior/services/activecollab.py index 7d9e4c21d..c16a08405 100644 --- a/bugwarrior/services/activecollab.py +++ b/bugwarrior/services/activecollab.py @@ -1,11 +1,9 @@ import itertools -import json -import urllib2 import time -import six from twiggy import log +import pypandoc from pyac.library import activeCollab from bugwarrior.services import IssueService, Issue from bugwarrior.config import die @@ -128,7 +126,8 @@ def to_taskwarrior(self): 'project': self.record['project'], 'priority': self.get_priority(), self.NAME: self.record.get('name'), - self.BODY: self.record.get('body'), + self.BODY: pypandoc.convert(self.record.get('body'), + 'md', format='html'), self.PERMALINK: self.record['permalink'], self.TASK_ID: self.record.get('task_id'), self.PROJECT_ID: self.record['project'], @@ -192,7 +191,8 @@ def __init__(self, *args, **kw): self.client = ActiveCollabClient( self.url, self.key, self.user_id, self.projects ) - self.ac = activeCollab(url=self.url, key=self.key, user_id=self.user_id) + self.ac = activeCollab(url=self.url, key=self.key, + user_id=self.user_id) data = self.ac.get_projects() for item in data: